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 9fbf30654b5 [Fix](inverted index) fix need read data optimize problem 
#28104 (#28731)
9fbf30654b5 is described below

commit 9fbf30654b5bcb6e06d8ec75c050aa867096d997
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Wed Dec 20 22:26:13 2023 +0800

    [Fix](inverted index) fix need read data optimize problem #28104 (#28731)
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 16 +++++++++++++---
 1 file 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 9eb127264fb..658b30e67fc 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -845,6 +845,7 @@ Status 
SegmentIterator::_apply_index_except_leafnode_of_andnode() {
             if (_downgrade_without_index(res, need_remaining_after_evaluate)) {
                 // downgrade without index query
                 _not_apply_index_pred.insert(pred->column_id());
+                _need_read_data_indices[pred->column_id()] = true;
                 continue;
             }
             LOG(WARNING) << "failed to evaluate index"
@@ -864,7 +865,10 @@ Status 
SegmentIterator::_apply_index_except_leafnode_of_andnode() {
             _check_column_pred_all_push_down(column_name, true,
                                              pred->type() == 
PredicateType::MATCH) &&
             !pred->predicate_params()->marked_by_runtime_filter) {
-            _need_read_data_indices[pred->column_id()] = false;
+            // if column's need_read_data already set true, we can not set it 
to false now.
+            if (_need_read_data_indices.find(pred->column_id()) == 
_need_read_data_indices.end()) {
+                _need_read_data_indices[pred->column_id()] = false;
+            }
         }
     }
 
@@ -950,6 +954,7 @@ Status 
SegmentIterator::_apply_inverted_index_on_column_predicate(
         if (!res.ok()) {
             if (_downgrade_without_index(res, need_remaining_after_evaluate)) {
                 remaining_predicates.emplace_back(pred);
+                _need_read_data_indices[pred->column_id()] = true;
                 return Status::OK();
             }
             LOG(WARNING) << "failed to evaluate index"
@@ -980,7 +985,10 @@ Status 
SegmentIterator::_apply_inverted_index_on_column_predicate(
         if (_check_column_pred_all_push_down(column_name, false,
                                              pred->type() == 
PredicateType::MATCH) &&
             !pred->predicate_params()->marked_by_runtime_filter) {
-            _need_read_data_indices[pred->column_id()] = false;
+            // if column's need_read_data already set true, we can not set it 
to false now.
+            if (_need_read_data_indices.find(pred->column_id()) == 
_need_read_data_indices.end()) {
+                _need_read_data_indices[pred->column_id()] = false;
+            }
         }
     }
     return Status::OK();
@@ -1012,7 +1020,9 @@ Status 
SegmentIterator::_apply_inverted_index_on_block_column_predicate(
         if (res.ok()) {
             if (_check_column_pred_all_push_down(column_name) &&
                 !all_predicates_are_marked_by_runtime_filter(predicate_set)) {
-                _need_read_data_indices[column_id] = false;
+                if (_need_read_data_indices.find(column_id) == 
_need_read_data_indices.end()) {
+                    _need_read_data_indices[column_id] = false;
+                }
             }
             no_need_to_pass_column_predicate_set.insert(predicate_set.begin(), 
predicate_set.end());
             _row_bitmap &= output_result;


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

Reply via email to