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 8bb57bcc3e1 [fix] (inverted index) fix the error in the query result 
when using count on index (#41200)
8bb57bcc3e1 is described below

commit 8bb57bcc3e100e129dcd8c986238c13b4a96ad4c
Author: Sun Chenyang <[email protected]>
AuthorDate: Tue Sep 24 19:47:18 2024 +0800

    [fix] (inverted index) fix the error in the query result when using count 
on index (#41200)
    
    ## Proposed changes
    
    Introduced by  #39473
    
    <!--Describe your changes.-->
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp |  2 +-
 .../data/inverted_index_p0/test_need_read_data.out |  3 +++
 .../inverted_index_p0/test_need_read_data.groovy   | 22 ++++++++++++++++++++++
 3 files changed, 26 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 fdabcea194f..bfd85384416 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -2935,7 +2935,7 @@ bool SegmentIterator::_no_need_read_key_data(ColumnId 
cid, vectorized::MutableCo
         return false;
     }
 
-    if (!_check_all_predicates_passed_inverted_index_for_column(cid, true)) {
+    if (!_check_all_predicates_passed_inverted_index_for_column(cid)) {
         return false;
     }
 
diff --git a/regression-test/data/inverted_index_p0/test_need_read_data.out 
b/regression-test/data/inverted_index_p0/test_need_read_data.out
index 782d5e5ab0b..5999e7640ad 100644
--- a/regression-test/data/inverted_index_p0/test_need_read_data.out
+++ b/regression-test/data/inverted_index_p0/test_need_read_data.out
@@ -31,3 +31,6 @@
 -- !sql --
 1
 
+-- !sql_11 --
+1
+
diff --git 
a/regression-test/suites/inverted_index_p0/test_need_read_data.groovy 
b/regression-test/suites/inverted_index_p0/test_need_read_data.groovy
index 2e8294d4cfd..0e4f0bf9a48 100644
--- a/regression-test/suites/inverted_index_p0/test_need_read_data.groovy
+++ b/regression-test/suites/inverted_index_p0/test_need_read_data.groovy
@@ -137,4 +137,26 @@ suite("test_need_read_data", "p0"){
     sql "INSERT INTO ${indexTblName3} VALUES (1, 1),(1, -2),(1, -1);"
     qt_sql "SELECT /*+SET_VAR(enable_common_expr_pushdown=false) */ id FROM 
${indexTblName3} WHERE value<0 and abs(value)>1;"
     qt_sql "SELECT /*+SET_VAR(enable_common_expr_pushdown=true) */ id FROM 
${indexTblName3} WHERE value<0 and abs(value)>1;"
+
+    sql "DROP TABLE IF EXISTS tt"
+    sql """
+        CREATE TABLE `tt` (
+            `a` int NULL,
+            `b` varchar(20) NULL,
+            `c` int NULL,
+            INDEX idx_source (`b`) USING INVERTED,
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`a`, `b`)
+        COMMENT 'OLAP'
+        DISTRIBUTED BY RANDOM BUCKETS 1
+        PROPERTIES (
+        "replication_num" = "1"
+        );
+    """
+    sql """ insert into tt values (20, 'aa', 30); """
+    sql """ insert into tt values (20, null, 30); """
+
+    qt_sql_11 """ select /*+SET_VAR(enable_count_on_index_pushdown=true) */  
count(b) from tt where c = 30; """
+    sql """ DROP TABLE IF EXISTS tt """
+
 }


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

Reply via email to