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

airborne pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 9fe77b335cb [Enhancement](inverted index) apply inverted index when 
has any #41547 (#41584)
9fe77b335cb is described below

commit 9fe77b335cbefacd4d546c28998dce89cb85e948
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Wed Oct 9 14:13:38 2024 +0800

    [Enhancement](inverted index) apply inverted index when has any #41547 
(#41584)
    
    cherry pick from #41547
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 3 ++-
 be/src/olap/rowset/segment_v2/segment_iterator.h   | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index a9b5e792b2a..c16a7d12c8d 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -504,7 +504,8 @@ Status 
SegmentIterator::_get_row_ranges_by_column_conditions() {
     RETURN_IF_ERROR(_apply_bitmap_index());
     {
         if (_opts.runtime_state &&
-            _opts.runtime_state->query_options().enable_inverted_index_query) {
+            _opts.runtime_state->query_options().enable_inverted_index_query &&
+            has_inverted_index_in_iterators()) {
             SCOPED_RAW_TIMER(&_opts.stats->inverted_index_filter_timer);
             size_t input_rows = _row_bitmap.cardinality();
             RETURN_IF_ERROR(_apply_inverted_index());
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.h 
b/be/src/olap/rowset/segment_v2/segment_iterator.h
index 4603cf584a4..1b01fd10d5d 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.h
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.h
@@ -157,6 +157,11 @@ public:
         return _inverted_index_iterators;
     }
 
+    bool has_inverted_index_in_iterators() const {
+        return std::any_of(_inverted_index_iterators.begin(), 
_inverted_index_iterators.end(),
+                           [](const auto& iterator) { return iterator != 
nullptr; });
+    }
+
 private:
     Status _next_batch_internal(vectorized::Block* block);
 


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

Reply via email to