[Fix](inverted index) fix compound query result error when disable inverted_index_query session variable (#26327)

This commit is contained in:
airborne12
2023-11-02 21:36:08 +08:00
committed by GitHub
parent e307884e57
commit 3f47eb5e89
3 changed files with 13 additions and 3 deletions

View File

@ -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;
@ -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();

View File

@ -68,3 +68,9 @@
-- !sql --
1
-- !sql --
0
-- !sql --
0

View File

@ -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}")
}