yiguolei commented on code in PR #63291:
URL: https://github.com/apache/doris/pull/63291#discussion_r3287169956
##########
be/src/storage/segment/encoding_info.cpp:
##########
@@ -444,11 +446,23 @@ EncodingInfo::EncodingInfo(TraitsClass traits)
if (_encoding == BIT_SHUFFLE) {
_data_page_pre_decoder = std::make_unique<BitShufflePagePreDecoder>();
} else if (_encoding == DICT_ENCODING) {
- _data_page_pre_decoder = std::make_unique<BinaryDictPagePreDecoder>();
+ if constexpr (TraitsClass::type == FieldType::OLAP_FIELD_TYPE_CHAR) {
+ _data_page_pre_decoder =
std::make_unique<BinaryDictPagePreDecoder<true>>();
+ } else {
+ _data_page_pre_decoder =
std::make_unique<BinaryDictPagePreDecoder<false>>();
+ }
+ } else if (_encoding == PLAIN_ENCODING) {
+ // CHAR plain pages may contain trailing '\0' padding written by older
+ // BEs; strip it once at page load so the cached page is unpadded.
+ if constexpr (TraitsClass::type == FieldType::OLAP_FIELD_TYPE_CHAR) {
+ _data_page_pre_decoder =
std::make_unique<BinaryPlainPageCharStripPreDecoder>();
+ }
} else if (_encoding == PLAIN_ENCODING_V2) {
- // Only binary types (Slice) need the predecoder for PLAIN_ENCODING_V2
- // to convert varint-encoded lengths to offset array format
- if constexpr (std::is_same_v<typename TraitsClass::CppType, Slice>) {
+ if constexpr (TraitsClass::type == FieldType::OLAP_FIELD_TYPE_CHAR) {
+ _data_page_pre_decoder =
std::make_unique<BinaryPlainPageV2CharStripPreDecoder>();
+ } else if constexpr (std::is_same_v<typename TraitsClass::CppType,
Slice>) {
Review Comment:
这里也是,如果我们只是改变了已有的decoder 似乎会简单一些
--
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]