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

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


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

commit ba825ef139ebf91d16e8107a36beefcac559694b
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Wed Oct 9 15:55:40 2024 +0800

    [Enhancement](inverted index) apply inverted index when has any #41547 
(#41585)
    
    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 dfed07277d8..3d8e06bbc00 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -505,7 +505,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 50876cd7c55..c2e2139e8ad 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.h
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.h
@@ -156,6 +156,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