Skip to content

Commit

Permalink
[Fix](inverted index) fix compound query result error when disable in…
Browse files Browse the repository at this point in the history
…verted_index_query session variable (#26327)
  • Loading branch information
airborne12 authored Nov 2, 2023
1 parent e307884 commit 3f47eb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,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;
Expand Down Expand Up @@ -735,9 +738,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@
-- !sql --
1

-- !sql --
0

-- !sql --
0

Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down

0 comments on commit 3f47eb5

Please sign in to comment.