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 7730aa21703 [Fix](inverted index) fix wrong no need read data when 
same column in inverted index and like function #36687 (#38581)
7730aa21703 is described below

commit 7730aa217038acc62e6fc4bf1e19d0978075bcd1
Author: airborne12 <[email protected]>
AuthorDate: Wed Jul 31 19:41:39 2024 +0800

    [Fix](inverted index) fix wrong no need read data when same column in 
inverted index and like function #36687 (#38581)
    
    cherry pick from #36687
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp                  | 6 ++++++
 regression-test/data/inverted_index_p0/test_need_read_data.out      | 6 ++++++
 regression-test/suites/inverted_index_p0/test_need_read_data.groovy | 2 ++
 3 files changed, 14 insertions(+)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 57754705cfa..e2ce44d4d5b 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -365,12 +365,18 @@ Status SegmentIterator::_init_impl(const 
StorageReadOptions& opts) {
         std::set<std::string> push_down_preds;
         for (auto* pred : _col_predicates) {
             if (!_check_apply_by_inverted_index(pred)) {
+                //column predicate, like column predicate etc. always need 
read data
+                auto cid = pred->column_id();
+                _need_read_data_indices[cid] = true;
                 continue;
             }
             push_down_preds.insert(_gen_predicate_result_sign(pred));
         }
         for (auto* pred : _col_preds_except_leafnode_of_andnode) {
             if (!_check_apply_by_inverted_index(pred)) {
+                //column predicate, like column predicate etc. always need 
read data
+                auto cid = pred->column_id();
+                _need_read_data_indices[cid] = true;
                 continue;
             }
             push_down_preds.insert(_gen_predicate_result_sign(pred));
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 fdfe790afdb..7298254f838 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
@@ -19,3 +19,9 @@
 -- !sql2 --
 2024-06-17T15:16:49    tengxun2
 
+-- !sql3 --
+1
+
+-- !sql4 --
+2024-06-17T15:16:49    tengxun2
+
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 694b7856be7..321c95fe32f 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
@@ -110,4 +110,6 @@ suite("test_need_read_data", "p0"){
 
     qt_sql1 """ select  COUNT(1)  from  ${indexTbName2}  WHERE  a  >=  
'2024-06-15  00:00:00'  AND  b  =  'tengxun2'  and    `b`  match  'tengxun2'  ; 
"""
     qt_sql2 """ select  *  from  ${indexTbName2}  WHERE  a  >=  '2024-06-15  
00:00:00'  AND  b  =  'tengxun2'  and    `b`  match  'tengxun2'  ; """
+    qt_sql3 """ select  COUNT(1)  from  ${indexTbName2}  WHERE  a  >=  
'2024-06-15  00:00:00'  AND  b  like  '%tengxun%'  and    `b`  match  
'tengxun2'  ; """
+    qt_sql4 """ select  *  from  ${indexTbName2}  WHERE  a  >=  '2024-06-15  
00:00:00'  AND  b  like  '%tengxun%'  and    `b`  match  'tengxun2'  ; """
 }


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

Reply via email to