Skip to content

Commit 5bffb86

Browse files
airborne12xiaokang
authored andcommitted
[Fix](inverted index) fix need read data optimize problem (#28104)
1 parent 680d621 commit 5bffb86

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

be/src/olap/rowset/segment_v2/segment_iterator.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ Status SegmentIterator::_apply_index_except_leafnode_of_andnode() {
774774
if (_downgrade_without_index(res, need_remaining_after_evaluate)) {
775775
// downgrade without index query
776776
_not_apply_index_pred.insert(pred->column_id());
777+
_need_read_data_indices[pred->column_id()] = true;
777778
continue;
778779
}
779780
LOG(WARNING) << "failed to evaluate index"
@@ -793,7 +794,10 @@ Status SegmentIterator::_apply_index_except_leafnode_of_andnode() {
793794
_check_column_pred_all_push_down(column_name, true,
794795
pred->type() == PredicateType::MATCH) &&
795796
!pred->predicate_params()->marked_by_runtime_filter) {
796-
_need_read_data_indices[pred->column_id()] = false;
797+
// if column's need_read_data already set true, we can not set it to false now.
798+
if (_need_read_data_indices.find(pred->column_id()) == _need_read_data_indices.end()) {
799+
_need_read_data_indices[pred->column_id()] = false;
800+
}
797801
}
798802
}
799803

@@ -879,6 +883,7 @@ Status SegmentIterator::_apply_inverted_index_on_column_predicate(
879883
if (!res.ok()) {
880884
if (_downgrade_without_index(res, need_remaining_after_evaluate)) {
881885
remaining_predicates.emplace_back(pred);
886+
_need_read_data_indices[pred->column_id()] = true;
882887
return Status::OK();
883888
}
884889
LOG(WARNING) << "failed to evaluate index"
@@ -909,7 +914,10 @@ Status SegmentIterator::_apply_inverted_index_on_column_predicate(
909914
if (_check_column_pred_all_push_down(column_name, false,
910915
pred->type() == PredicateType::MATCH) &&
911916
!pred->predicate_params()->marked_by_runtime_filter) {
912-
_need_read_data_indices[pred->column_id()] = false;
917+
// if column's need_read_data already set true, we can not set it to false now.
918+
if (_need_read_data_indices.find(pred->column_id()) == _need_read_data_indices.end()) {
919+
_need_read_data_indices[pred->column_id()] = false;
920+
}
913921
}
914922
}
915923
return Status::OK();
@@ -941,7 +949,9 @@ Status SegmentIterator::_apply_inverted_index_on_block_column_predicate(
941949
if (res.ok()) {
942950
if (_check_column_pred_all_push_down(column_name) &&
943951
!all_predicates_are_marked_by_runtime_filter(predicate_set)) {
944-
_need_read_data_indices[column_id] = false;
952+
if (_need_read_data_indices.find(column_id) == _need_read_data_indices.end()) {
953+
_need_read_data_indices[column_id] = false;
954+
}
945955
}
946956
no_need_to_pass_column_predicate_set.insert(predicate_set.begin(), predicate_set.end());
947957
_row_bitmap &= output_result;

0 commit comments

Comments
 (0)