yiguolei commented on code in PR #63622:
URL: https://github.com/apache/doris/pull/63622#discussion_r3303380059
##########
be/src/storage/segment/encoding_info.h:
##########
@@ -107,21 +111,40 @@ class EncodingInfoResolver {
EncodingInfoResolver();
~EncodingInfoResolver();
- EncodingTypePB get_default_encoding(FieldType type, EncodingPreference
encoding_preference,
- bool optimize_value_seek) const;
+ EncodingTypePB get_legacy_default_encoding(FieldType type) const;
+ EncodingTypePB get_v3_default_encoding(FieldType type) const;
+ EncodingTypePB get_value_seek_encoding(FieldType type) const;
- Status get(FieldType data_type, EncodingTypePB encoding_type,
- EncodingPreference encoding_preference, const EncodingInfo**
out);
+ Status get(FieldType data_type, EncodingTypePB encoding_type, const
EncodingInfo** out);
private:
- // Not thread-safe
- template <FieldType type, EncodingTypePB encoding_type, bool
optimize_value_seek = false>
- void _add_map();
-
- std::unordered_map<FieldType, EncodingTypePB, EncodingMapHash>
_default_encoding_type_map;
+ // Registration helpers used by the constructor. Not thread-safe.
+ //
+ // _add: this (type, encoding) is a supported
combination.
+ // _set_legacy_default: ... and is the default for the legacy (V1/V2)
write path.
+ // _set_v3_default: ... and is the default for the V3 write path.
+ // _set_value_seek_default: ... and is the default for the value-seek path
(PK / zone map).
+ //
+ // Each "_set_*_default" inserts into _encoding_map (idempotently) and
then writes the
+ // corresponding default map exactly once (enforced by DCHECK).
+ template <FieldType type, EncodingTypePB encoding>
+ void _add();
+ template <FieldType type, EncodingTypePB encoding>
+ void _set_legacy_default();
+ template <FieldType type, EncodingTypePB encoding>
+ void _set_v3_default();
+ template <FieldType type, EncodingTypePB encoding>
+ void _set_value_seek_default();
+
+ static EncodingTypePB _lookup(
+ const std::unordered_map<FieldType, EncodingTypePB,
EncodingMapHash>& m, FieldType t) {
+ auto it = m.find(t);
+ return it != m.end() ? it->second : UNKNOWN_ENCODING;
+ }
- // default encoding for each type which optimizes value seek
- std::unordered_map<FieldType, EncodingTypePB, EncodingMapHash>
_value_seek_encoding_map;
+ std::unordered_map<FieldType, EncodingTypePB, EncodingMapHash>
_legacy_default_map;
+ std::unordered_map<FieldType, EncodingTypePB, EncodingMapHash>
_v3_default_map;
+ std::unordered_map<FieldType, EncodingTypePB, EncodingMapHash>
_value_seek_default_map;
Review Comment:
这个value seek 想想换个名字啊
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]