github-actions[bot] commented on code in PR #27820:
URL: https://github.com/apache/doris/pull/27820#discussion_r1410378362


##########
be/src/olap/rowset/segment_v2/inverted_index_cache.cpp:
##########
@@ -99,13 +123,18 @@ 
InvertedIndexSearcherCache::InvertedIndexSearcherCache(size_t capacity, uint32_t
     }
 }
 
-Status InvertedIndexSearcherCache::get_index_searcher(const 
io::FileSystemSPtr& fs,
-                                                      const std::string& 
index_dir,
-                                                      const std::string& 
file_name,
-                                                      
InvertedIndexCacheHandle* cache_handle,
-                                                      OlapReaderStatistics* 
stats, bool use_cache) {
+Status InvertedIndexSearcherCache::get_index_searcher(

Review Comment:
   warning: function 'get_index_searcher' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status InvertedIndexSearcherCache::get_index_searcher(
                                      ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/rowset/segment_v2/inverted_index_cache.cpp:125:** 82 lines 
including whitespace and comments (threshold 80)
   ```cpp
   Status InvertedIndexSearcherCache::get_index_searcher(
                                      ^
   ```
   
   </details>
   



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -479,7 +466,7 @@ Status FullTextIndexReader::match_all_index_search(
     return Status::OK();
 }
 
-void FullTextIndexReader::check_null_bitmap(const IndexSearcherPtr& 
index_searcher,
+void FullTextIndexReader::check_null_bitmap(const FulltextIndexSearcherPtr& 
index_searcher,

Review Comment:
   warning: method 'check_null_bitmap' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/olap/rowset/segment_v2/inverted_index_reader.h:168:
   ```diff
   -     void check_null_bitmap(const FulltextIndexSearcherPtr& index_searcher,
   +     static void check_null_bitmap(const FulltextIndexSearcherPtr& 
index_searcher,
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_cache.h:
##########
@@ -54,26 +56,54 @@ namespace lucene {
 namespace search {
 class IndexSearcher;
 } // namespace search
+namespace util {
+namespace bkd {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace util::bkd {
   ```
   
   be/src/olap/rowset/segment_v2/inverted_index_cache.h:61:
   ```diff
   - }
   - } // namespace util
   + } // namespace util
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -754,176 +818,193 @@
                              InvertedIndexQueryType query_type, 
roaring::Roaring* bit_map) {
     SCOPED_RAW_TIMER(&stats->inverted_index_query_timer);
 
-    auto visitor = std::make_unique<InvertedIndexVisitor>(bit_map, query_type);
-    std::shared_ptr<lucene::util::bkd::bkd_reader> r;
-    RETURN_IF_ERROR(get_bkd_reader(&r));
-
-    std::string query_str;
-    _value_key_coder->full_encode_ascending(query_value, &query_str);
-
-    InvertedIndexQueryCache::CacheKey cache_key {_file_full_path, column_name, 
query_type,
-                                                 query_str};
-    auto cache = InvertedIndexQueryCache::instance();
-    InvertedIndexQueryCacheHandle cache_handler;
-    auto cache_status = handle_cache(cache, cache_key, &cache_handler, stats, 
bit_map);
-    if (cache_status.ok()) {
-        return Status::OK();
-    }
-
     try {
-        auto st = bkd_query(stats, column_name, query_value, query_type, r, 
visitor.get());
+        std::shared_ptr<lucene::util::bkd::bkd_reader> r;
+        auto st = get_bkd_reader(r, stats);
         if (!st.ok()) {
-            if (st.code() == ErrorCode::END_OF_FILE) {
-                return Status::OK();
-            }
-            LOG(WARNING) << "bkd_query for column " << column_name << " 
failed: " << st;
+            LOG(WARNING) << "get bkd reader for  " << _index_dir / 
_index_file_name
+                         << " failed: " << st;
             return st;
         }
-        r->intersect(visitor.get());
+        std::string query_str;
+        _value_key_coder->full_encode_ascending(query_value, &query_str);
+
+        InvertedIndexQueryCache::CacheKey cache_key {_index_dir / 
_index_file_name, column_name,
+                                                     query_type, query_str};
+        auto cache = InvertedIndexQueryCache::instance();

Review Comment:
   warning: 'auto cache' can be declared as 'auto *cache' 
[readability-qualified-auto]
   
   ```suggestion
           auto *cache = InvertedIndexQueryCache::instance();
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -580,151 +567,228 @@
 
     roaring::Roaring result;
     InvertedIndexCacheHandle inverted_index_cache_handle;
-    
static_cast<void>(InvertedIndexSearcherCache::instance()->get_index_searcher(
-            _fs, index_dir.c_str(), index_file_name, 
&inverted_index_cache_handle, stats));
-    auto index_searcher = inverted_index_cache_handle.get_index_searcher();
-
-    // try to reuse index_searcher's directory to read null_bitmap to cache
-    // to avoid open directory additionally for null_bitmap
-    InvertedIndexQueryCacheHandle null_bitmap_cache_handle;
-    static_cast<void>(
-            read_null_bitmap(&null_bitmap_cache_handle, 
index_searcher->getReader()->directory()));
-
-    try {
-        if (query_type == InvertedIndexQueryType::MATCH_ANY_QUERY ||
-            query_type == InvertedIndexQueryType::MATCH_ALL_QUERY ||
-            query_type == InvertedIndexQueryType::EQUAL_QUERY) {
-            SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
-            index_searcher->_search(query.get(), [&result](DocRange* 
doc_range) {
-                if (doc_range->type_ == DocRangeType::kMany) {
-                    result.addMany(doc_range->doc_many_size_, 
doc_range->doc_many->data());
-                } else {
-                    result.addRange(doc_range->doc_range.first, 
doc_range->doc_range.second);
-                }
-            });
-        } else {
-            SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
-            index_searcher->_search(query.get(),
-                                    [&result](const int32_t docid, const 
float_t /*score*/) {
-                                        // docid equal to rowid in segment
-                                        result.add(docid);
-                                    });
-        }
-    } catch (const CLuceneError& e) {
-        if (_is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
-            return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
-                    "range query term exceeds limits, try to downgrade from 
inverted index, column "
-                    "name:{}, search_str:{}",
-                    column_name, search_str);
-        } else {
-            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                    "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
-                    e.what(), column_name, search_str);
+    RETURN_IF_ERROR(InvertedIndexSearcherCache::instance()->get_index_searcher(
+            _fs, _index_dir.c_str(), _index_file_name, 
&inverted_index_cache_handle, stats, type(),
+            _has_null));
+    auto searcher_variant = inverted_index_cache_handle.get_index_searcher();
+    if (FulltextIndexSearcherPtr* index_searcher =
+                std::get_if<FulltextIndexSearcherPtr>(&searcher_variant)) {
+        // try to reuse index_searcher's directory to read null_bitmap to cache
+        // to avoid open directory additionally for null_bitmap
+        InvertedIndexQueryCacheHandle null_bitmap_cache_handle;
+        static_cast<void>(read_null_bitmap(&null_bitmap_cache_handle,
+                                           
(*index_searcher)->getReader()->directory()));
+
+        try {
+            if (query_type == InvertedIndexQueryType::MATCH_ANY_QUERY ||
+                query_type == InvertedIndexQueryType::MATCH_ALL_QUERY ||
+                query_type == InvertedIndexQueryType::EQUAL_QUERY) {
+                SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
+                (*index_searcher)->_search(query.get(), [&result](DocRange* 
doc_range) {
+                    if (doc_range->type_ == DocRangeType::kMany) {
+                        result.addMany(doc_range->doc_many_size_, 
doc_range->doc_many->data());
+                    } else {
+                        result.addRange(doc_range->doc_range.first, 
doc_range->doc_range.second);
+                    }
+                });
+            } else {
+                SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
+                (*index_searcher)
+                        ->_search(query.get(),
+                                  [&result](const int32_t docid, const float_t 
/*score*/) {
+                                      // docid equal to rowid in segment
+                                      result.add(docid);
+                                  });
+            }
+        } catch (const CLuceneError& e) {
+            if (_is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
+                return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
+                        "range query term exceeds limits, try to downgrade 
from inverted index, "
+                        "column "
+                        "name:{}, search_str:{}",
+                        column_name, search_str);
+            } else {
+                return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
+                        "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
+                        e.what(), column_name, search_str);
+            }
         }
-    }
 
-    // add to cache
-    std::shared_ptr<roaring::Roaring> term_match_bitmap =
-            std::make_shared<roaring::Roaring>(result);
-    term_match_bitmap->runOptimize();
-    cache->insert(cache_key, term_match_bitmap, &cache_handle);
+        // add to cache
+        std::shared_ptr<roaring::Roaring> term_match_bitmap =
+                std::make_shared<roaring::Roaring>(result);
+        term_match_bitmap->runOptimize();
+        cache->insert(cache_key, term_match_bitmap, &cache_handle);
 
-    bit_map->swap(result);
+        bit_map->swap(result);
+    }
     return Status::OK();
 }
 
 InvertedIndexReaderType StringTypeInvertedIndexReader::type() {
     return InvertedIndexReaderType::STRING_TYPE;
 }
 
-BkdIndexReader::BkdIndexReader(io::FileSystemSPtr fs, const std::string& path,
-                               const TabletIndex* index_meta)
-        : InvertedIndexReader(fs, path, index_meta), _compoundReader(nullptr) {
-    io::Path io_path(_path);
-    auto index_dir = io_path.parent_path();
-    auto index_file_name = InvertedIndexDescriptor::get_index_file_name(
-            io_path.filename(), index_meta->index_id(), 
index_meta->get_index_suffix());
-
-    // check index file existence
-    auto index_file = index_dir / index_file_name;
-    if (!indexExists(index_file)) {
-        LOG(WARNING) << "bkd index: " << index_file.string() << " not exist.";
-        return;
-    }
-    _file_full_path = index_file;
-    _compoundReader = std::make_unique<DorisCompoundReader>(
-            DorisCompoundDirectory::getDirectory(fs, index_dir.c_str()), 
index_file_name.c_str(),
-            config::inverted_index_read_buffer_size);
-}
-
 Status BkdIndexReader::new_iterator(OlapReaderStatistics* stats, RuntimeState* 
runtime_state,
                                     std::unique_ptr<InvertedIndexIterator>* 
iterator) {
     *iterator = InvertedIndexIterator::create_unique(stats, runtime_state, 
shared_from_this());
     return Status::OK();
 }
 
+template <InvertedIndexQueryType QT>
 Status BkdIndexReader::bkd_query(OlapReaderStatistics* stats, const 
std::string& column_name,
-                                 const void* query_value, 
InvertedIndexQueryType query_type,
+                                 const void* query_value,
                                  
std::shared_ptr<lucene::util::bkd::bkd_reader> r,
-                                 InvertedIndexVisitor* visitor) {
+                                 InvertedIndexVisitor<QT>* visitor) {
     char tmp[r->bytes_per_dim_];
-    switch (query_type) {
-    case InvertedIndexQueryType::EQUAL_QUERY: {
+    if constexpr (QT == InvertedIndexQueryType::EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_max);
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_min);
-        break;
-    }
-    case InvertedIndexQueryType::LESS_THAN_QUERY:
-    case InvertedIndexQueryType::LESS_EQUAL_QUERY: {
+    } else if constexpr (QT == InvertedIndexQueryType::LESS_THAN_QUERY ||
+                         QT == InvertedIndexQueryType::LESS_EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_max);
         _type_info->set_to_min(tmp);
         _value_key_coder->full_encode_ascending(tmp, &visitor->query_min);
-        break;
-    }
-    case InvertedIndexQueryType::GREATER_THAN_QUERY:
-    case InvertedIndexQueryType::GREATER_EQUAL_QUERY: {
+    } else if constexpr (QT == InvertedIndexQueryType::GREATER_THAN_QUERY ||
+                         QT == InvertedIndexQueryType::GREATER_EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_min);
         _type_info->set_to_max(tmp);
         _value_key_coder->full_encode_ascending(tmp, &visitor->query_max);
-        break;
-    }
-    default:
+    } else {
         return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>(
                 "invalid query type when query bkd index");
     }
     visitor->set_reader(r.get());
     return Status::OK();
 }
 
+Status BkdIndexReader::invoke_bkd_try_query(OlapReaderStatistics* stats,
+                                            const std::string& column_name, 
const void* query_value,
+                                            InvertedIndexQueryType query_type,
+                                            
std::shared_ptr<lucene::util::bkd::bkd_reader> r,
+                                            uint32_t* count) {
+    switch (query_type) {
+    case InvertedIndexQueryType::LESS_THAN_QUERY: {
+        auto visitor =
+                
std::make_unique<InvertedIndexVisitor<InvertedIndexQueryType::LESS_THAN_QUERY>>(
+                        nullptr, true);
+        RETURN_IF_ERROR(bkd_query(stats, column_name, query_value, r, 
visitor.get()));
+        *count = r->estimate_point_count(visitor.get());
+        break;
+    }
+    case InvertedIndexQueryType::LESS_EQUAL_QUERY: {
+        auto visitor =
+                
std::make_unique<InvertedIndexVisitor<InvertedIndexQueryType::LESS_EQUAL_QUERY>>(
+                        nullptr, true);
+        RETURN_IF_ERROR(bkd_query(stats, column_name, query_value, r, 
visitor.get()));
+        *count = r->estimate_point_count(visitor.get());
+        break;
+    }
+    case InvertedIndexQueryType::GREATER_THAN_QUERY: {
+        auto visitor =
+                
std::make_unique<InvertedIndexVisitor<InvertedIndexQueryType::GREATER_THAN_QUERY>>(
+                        nullptr, true);
+        RETURN_IF_ERROR(bkd_query(stats, column_name, query_value, r, 
visitor.get()));
+        *count = r->estimate_point_count(visitor.get());
+        break;
+    }
+    case InvertedIndexQueryType::GREATER_EQUAL_QUERY: {
+        auto visitor =
+                
std::make_unique<InvertedIndexVisitor<InvertedIndexQueryType::GREATER_EQUAL_QUERY>>(
+                        nullptr, true);
+        RETURN_IF_ERROR(bkd_query(stats, column_name, query_value, r, 
visitor.get()));
+        *count = r->estimate_point_count(visitor.get());
+        break;
+    }
+    case InvertedIndexQueryType::EQUAL_QUERY: {
+        auto visitor = 
std::make_unique<InvertedIndexVisitor<InvertedIndexQueryType::EQUAL_QUERY>>(
+                nullptr, true);
+        RETURN_IF_ERROR(bkd_query(stats, column_name, query_value, r, 
visitor.get()));
+        *count = r->estimate_point_count(visitor.get());
+        break;
+    }
+    default:
+        return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>("Invalid 
query type");
+    }
+    return Status::OK();
+}
+
+Status BkdIndexReader::invoke_bkd_query(OlapReaderStatistics* stats, const 
std::string& column_name,

Review Comment:
   warning: method 'invoke_bkd_query' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static Status BkdIndexReader::invoke_bkd_query(OlapReaderStatistics* stats, 
const std::string& column_name,
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -580,151 +567,228 @@
 
     roaring::Roaring result;
     InvertedIndexCacheHandle inverted_index_cache_handle;
-    
static_cast<void>(InvertedIndexSearcherCache::instance()->get_index_searcher(
-            _fs, index_dir.c_str(), index_file_name, 
&inverted_index_cache_handle, stats));
-    auto index_searcher = inverted_index_cache_handle.get_index_searcher();
-
-    // try to reuse index_searcher's directory to read null_bitmap to cache
-    // to avoid open directory additionally for null_bitmap
-    InvertedIndexQueryCacheHandle null_bitmap_cache_handle;
-    static_cast<void>(
-            read_null_bitmap(&null_bitmap_cache_handle, 
index_searcher->getReader()->directory()));
-
-    try {
-        if (query_type == InvertedIndexQueryType::MATCH_ANY_QUERY ||
-            query_type == InvertedIndexQueryType::MATCH_ALL_QUERY ||
-            query_type == InvertedIndexQueryType::EQUAL_QUERY) {
-            SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
-            index_searcher->_search(query.get(), [&result](DocRange* 
doc_range) {
-                if (doc_range->type_ == DocRangeType::kMany) {
-                    result.addMany(doc_range->doc_many_size_, 
doc_range->doc_many->data());
-                } else {
-                    result.addRange(doc_range->doc_range.first, 
doc_range->doc_range.second);
-                }
-            });
-        } else {
-            SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
-            index_searcher->_search(query.get(),
-                                    [&result](const int32_t docid, const 
float_t /*score*/) {
-                                        // docid equal to rowid in segment
-                                        result.add(docid);
-                                    });
-        }
-    } catch (const CLuceneError& e) {
-        if (_is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
-            return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
-                    "range query term exceeds limits, try to downgrade from 
inverted index, column "
-                    "name:{}, search_str:{}",
-                    column_name, search_str);
-        } else {
-            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                    "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
-                    e.what(), column_name, search_str);
+    RETURN_IF_ERROR(InvertedIndexSearcherCache::instance()->get_index_searcher(
+            _fs, _index_dir.c_str(), _index_file_name, 
&inverted_index_cache_handle, stats, type(),
+            _has_null));
+    auto searcher_variant = inverted_index_cache_handle.get_index_searcher();
+    if (FulltextIndexSearcherPtr* index_searcher =
+                std::get_if<FulltextIndexSearcherPtr>(&searcher_variant)) {
+        // try to reuse index_searcher's directory to read null_bitmap to cache
+        // to avoid open directory additionally for null_bitmap
+        InvertedIndexQueryCacheHandle null_bitmap_cache_handle;
+        static_cast<void>(read_null_bitmap(&null_bitmap_cache_handle,
+                                           
(*index_searcher)->getReader()->directory()));
+
+        try {
+            if (query_type == InvertedIndexQueryType::MATCH_ANY_QUERY ||
+                query_type == InvertedIndexQueryType::MATCH_ALL_QUERY ||
+                query_type == InvertedIndexQueryType::EQUAL_QUERY) {
+                SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
+                (*index_searcher)->_search(query.get(), [&result](DocRange* 
doc_range) {
+                    if (doc_range->type_ == DocRangeType::kMany) {
+                        result.addMany(doc_range->doc_many_size_, 
doc_range->doc_many->data());
+                    } else {
+                        result.addRange(doc_range->doc_range.first, 
doc_range->doc_range.second);
+                    }
+                });
+            } else {
+                SCOPED_RAW_TIMER(&stats->inverted_index_searcher_search_timer);
+                (*index_searcher)
+                        ->_search(query.get(),
+                                  [&result](const int32_t docid, const float_t 
/*score*/) {
+                                      // docid equal to rowid in segment
+                                      result.add(docid);
+                                  });
+            }
+        } catch (const CLuceneError& e) {
+            if (_is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
+                return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
+                        "range query term exceeds limits, try to downgrade 
from inverted index, "
+                        "column "
+                        "name:{}, search_str:{}",
+                        column_name, search_str);
+            } else {
+                return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
+                        "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
+                        e.what(), column_name, search_str);
+            }
         }
-    }
 
-    // add to cache
-    std::shared_ptr<roaring::Roaring> term_match_bitmap =
-            std::make_shared<roaring::Roaring>(result);
-    term_match_bitmap->runOptimize();
-    cache->insert(cache_key, term_match_bitmap, &cache_handle);
+        // add to cache
+        std::shared_ptr<roaring::Roaring> term_match_bitmap =
+                std::make_shared<roaring::Roaring>(result);
+        term_match_bitmap->runOptimize();
+        cache->insert(cache_key, term_match_bitmap, &cache_handle);
 
-    bit_map->swap(result);
+        bit_map->swap(result);
+    }
     return Status::OK();
 }
 
 InvertedIndexReaderType StringTypeInvertedIndexReader::type() {
     return InvertedIndexReaderType::STRING_TYPE;
 }
 
-BkdIndexReader::BkdIndexReader(io::FileSystemSPtr fs, const std::string& path,
-                               const TabletIndex* index_meta)
-        : InvertedIndexReader(fs, path, index_meta), _compoundReader(nullptr) {
-    io::Path io_path(_path);
-    auto index_dir = io_path.parent_path();
-    auto index_file_name = InvertedIndexDescriptor::get_index_file_name(
-            io_path.filename(), index_meta->index_id(), 
index_meta->get_index_suffix());
-
-    // check index file existence
-    auto index_file = index_dir / index_file_name;
-    if (!indexExists(index_file)) {
-        LOG(WARNING) << "bkd index: " << index_file.string() << " not exist.";
-        return;
-    }
-    _file_full_path = index_file;
-    _compoundReader = std::make_unique<DorisCompoundReader>(
-            DorisCompoundDirectory::getDirectory(fs, index_dir.c_str()), 
index_file_name.c_str(),
-            config::inverted_index_read_buffer_size);
-}
-
 Status BkdIndexReader::new_iterator(OlapReaderStatistics* stats, RuntimeState* 
runtime_state,
                                     std::unique_ptr<InvertedIndexIterator>* 
iterator) {
     *iterator = InvertedIndexIterator::create_unique(stats, runtime_state, 
shared_from_this());
     return Status::OK();
 }
 
+template <InvertedIndexQueryType QT>
 Status BkdIndexReader::bkd_query(OlapReaderStatistics* stats, const 
std::string& column_name,
-                                 const void* query_value, 
InvertedIndexQueryType query_type,
+                                 const void* query_value,
                                  
std::shared_ptr<lucene::util::bkd::bkd_reader> r,
-                                 InvertedIndexVisitor* visitor) {
+                                 InvertedIndexVisitor<QT>* visitor) {
     char tmp[r->bytes_per_dim_];
-    switch (query_type) {
-    case InvertedIndexQueryType::EQUAL_QUERY: {
+    if constexpr (QT == InvertedIndexQueryType::EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_max);
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_min);
-        break;
-    }
-    case InvertedIndexQueryType::LESS_THAN_QUERY:
-    case InvertedIndexQueryType::LESS_EQUAL_QUERY: {
+    } else if constexpr (QT == InvertedIndexQueryType::LESS_THAN_QUERY ||
+                         QT == InvertedIndexQueryType::LESS_EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_max);
         _type_info->set_to_min(tmp);
         _value_key_coder->full_encode_ascending(tmp, &visitor->query_min);
-        break;
-    }
-    case InvertedIndexQueryType::GREATER_THAN_QUERY:
-    case InvertedIndexQueryType::GREATER_EQUAL_QUERY: {
+    } else if constexpr (QT == InvertedIndexQueryType::GREATER_THAN_QUERY ||
+                         QT == InvertedIndexQueryType::GREATER_EQUAL_QUERY) {
         _value_key_coder->full_encode_ascending(query_value, 
&visitor->query_min);
         _type_info->set_to_max(tmp);
         _value_key_coder->full_encode_ascending(tmp, &visitor->query_max);
-        break;
-    }
-    default:
+    } else {
         return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>(
                 "invalid query type when query bkd index");
     }
     visitor->set_reader(r.get());
     return Status::OK();
 }
 
+Status BkdIndexReader::invoke_bkd_try_query(OlapReaderStatistics* stats,

Review Comment:
   warning: method 'invoke_bkd_try_query' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static Status BkdIndexReader::invoke_bkd_try_query(OlapReaderStatistics* 
stats,
   ```
   



-- 
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]

Reply via email to