diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp index bce19bad65..a9b5e792b2 100644 --- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp +++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp @@ -972,6 +972,12 @@ Status SegmentIterator::_apply_inverted_index() { */ bool SegmentIterator::_check_all_conditions_passed_inverted_index_for_column(ColumnId cid, bool default_return) { + // If common_expr_pushdown is disabled, we cannot guarantee that all conditions are processed by the inverted index. + // Consider a scenario where there is a column predicate and an expression involving the same column in the SQL query, + // such as 'a < 0' and 'abs(a) > 1'. This could potentially lead to errors. + if (_opts.runtime_state && !_opts.runtime_state->query_options().enable_common_expr_pushdown) { + return false; + } auto pred_it = _column_predicate_inverted_index_status.find(cid); if (pred_it != _column_predicate_inverted_index_status.end()) { const auto& pred_map = pred_it->second; 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 5999e7640a..186138a45a 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 @@ -33,4 +33,3 @@ -- !sql_11 -- 1 -