You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/11/07 09:40:29 UTC

[incubator-doris] branch master updated: [Bug] Fix some return logic error in init BE encoding_map (#6936)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b1a801  [Bug] Fix some return logic error in init BE encoding_map (#6936)
9b1a801 is described below

commit 9b1a80114eb977e348bd176480b0eb5d245e95fd
Author: Zhikai Zuo <nj...@163.com>
AuthorDate: Sun Nov 7 17:40:18 2021 +0800

    [Bug] Fix some return logic error in init BE encoding_map (#6936)
    
    Checking _encoding_map in the original code to return in advance will cause some encoding methods cannot be pushed to default_encoding_type_map_ or value_seek_encoding_map_ in EncodingInfoResolver constructor.
    E.g:
    EncodingInfoResolver::EncodingInfoResolver() {
    ....
        _add_map<OLAP_FIELD_TYPE_BOOL, PLAIN_ENCODING>();
        _add_map<OLAP_FIELD_TYPE_BOOL, PLAIN_ENCODING, true>();
    ...
    }
    The second line code is invilid.
---
 be/src/olap/rowset/segment_v2/encoding_info.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/encoding_info.cpp b/be/src/olap/rowset/segment_v2/encoding_info.cpp
index e4ce43c..bcad01f 100644
--- a/be/src/olap/rowset/segment_v2/encoding_info.cpp
+++ b/be/src/olap/rowset/segment_v2/encoding_info.cpp
@@ -189,12 +189,6 @@ private:
     // Not thread-safe
     template <FieldType type, EncodingTypePB encoding_type, bool optimize_value_seek = false>
     void _add_map() {
-        auto key = std::make_pair(type, encoding_type);
-        auto it = _encoding_map.find(key);
-        if (it != _encoding_map.end()) {
-            return;
-        }
-
         EncodingTraits<type, encoding_type> traits;
         std::unique_ptr<EncodingInfo> encoding(new EncodingInfo(traits));
         if (_default_encoding_type_map.find(type) == std::end(_default_encoding_type_map)) {
@@ -204,6 +198,11 @@ private:
             _value_seek_encoding_map.find(type) == _value_seek_encoding_map.end()) {
             _value_seek_encoding_map[type] = encoding_type;
         }
+        auto key = std::make_pair(type, encoding_type);
+        auto it = _encoding_map.find(key);
+        if (it != _encoding_map.end()) {
+            return;
+        }
         _encoding_map.emplace(key, encoding.release());
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org