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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 2ef5f06538d [Pick-2.0](inverted index) fix compound query result error 
when disable inverted_index_query session variable #26327 (#26375)
2ef5f06538d is described below

commit 2ef5f06538d2ee614a1d1af0b7360a6ea5b2e9a2
Author: airborne12 <[email protected]>
AuthorDate: Fri Nov 3 16:28:08 2023 +0800

    [Pick-2.0](inverted index) fix compound query result error when disable 
inverted_index_query session variable #26327 (#26375)
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp                  | 6 +++---
 regression-test/data/inverted_index_p0/test_count_on_index.out      | 6 ++++++
 regression-test/suites/inverted_index_p0/test_count_on_index.groovy | 4 ++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index fbbcbe232e0..33ad390ea83 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -693,6 +693,9 @@ bool 
SegmentIterator::_check_apply_by_bitmap_index(ColumnPredicate* pred) {
 }
 
 bool SegmentIterator::_check_apply_by_inverted_index(ColumnPredicate* pred, 
bool pred_in_compound) {
+    if (_opts.runtime_state && 
!_opts.runtime_state->query_options().enable_inverted_index_query) {
+        return false;
+    }
     if (_inverted_index_iterators[pred->column_id()] == nullptr) {
         //this column without inverted index
         return false;
@@ -737,9 +740,6 @@ Status 
SegmentIterator::_apply_bitmap_index_except_leafnode_of_andnode(
 
 Status SegmentIterator::_apply_inverted_index_except_leafnode_of_andnode(
         ColumnPredicate* pred, roaring::Roaring* output_result) {
-    if (_opts.runtime_state && 
!_opts.runtime_state->query_options().enable_inverted_index_query) {
-        return Status::OK();
-    }
     RETURN_IF_ERROR(pred->evaluate(*_schema, 
_inverted_index_iterators[pred->column_id()].get(),
                                    num_rows(), output_result));
     return Status::OK();
diff --git a/regression-test/data/inverted_index_p0/test_count_on_index.out 
b/regression-test/data/inverted_index_p0/test_count_on_index.out
index d863928131a..59910b7fb5d 100644
--- a/regression-test/data/inverted_index_p0/test_count_on_index.out
+++ b/regression-test/data/inverted_index_p0/test_count_on_index.out
@@ -68,3 +68,9 @@
 -- !sql --
 1
 
+-- !sql --
+0
+
+-- !sql --
+0
+
diff --git 
a/regression-test/suites/inverted_index_p0/test_count_on_index.groovy 
b/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
index 7e4ff8e4038..8fb98221ef5 100644
--- a/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
+++ b/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
@@ -268,6 +268,10 @@ suite("test_count_on_index_httplogs", "p0") {
             contains "pushAggOp=COUNT_ON_INDEX"
         }
         qt_sql "select COUNT() from ${tableName} where key_id match 'bjn002'"
+
+        // case4: test compound query when inverted_index_query disable
+        qt_sql "SELECT  COUNT() from ${testTable_dup} where request = 'images' 
 or (size = 0 and status > 400)"
+        qt_sql "SELECT /*+SET_VAR(enable_inverted_index_query=false) */ 
COUNT() from ${testTable_dup} where request = 'images'  or (size = 0 and status 
> 400)"
     } finally {
         //try_sql("DROP TABLE IF EXISTS ${testTable}")
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to