disable OR predicate for bitmap index (#30951)

There is some problem for OR predicate push down using bitmap index, so disable it.
This commit is contained in:
Kang
2024-02-07 20:47:26 +08:00
committed by yiguolei
parent 22cc8342d4
commit abbd1c7ede
2 changed files with 2 additions and 23 deletions

View File

@ -799,7 +799,7 @@ bool SegmentIterator::_can_filter_by_preds_except_leafnode_of_andnode() {
}
for (auto pred : _col_preds_except_leafnode_of_andnode) {
if (_not_apply_index_pred.count(pred->column_id()) ||
(!_check_apply_by_bitmap_index(pred) && !_check_apply_by_inverted_index(pred, true))) {
(!_check_apply_by_inverted_index(pred, true))) {
return false;
}
// all predicates are evaluated by index, then true, else false
@ -811,14 +811,6 @@ bool SegmentIterator::_can_filter_by_preds_except_leafnode_of_andnode() {
return true;
}
bool SegmentIterator::_check_apply_by_bitmap_index(ColumnPredicate* pred) {
if (_bitmap_index_iterators[pred->column_id()] == nullptr) {
// no bitmap index for this column
return false;
}
return true;
}
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;
@ -860,13 +852,6 @@ bool SegmentIterator::_check_apply_by_inverted_index(ColumnPredicate* pred, bool
return true;
}
Status SegmentIterator::_apply_bitmap_index_except_leafnode_of_andnode(
ColumnPredicate* pred, roaring::Roaring* output_result) {
RETURN_IF_ERROR(pred->evaluate(_bitmap_index_iterators[pred->column_id()].get(),
_segment->num_rows(), output_result));
return Status::OK();
}
Status SegmentIterator::_apply_inverted_index_except_leafnode_of_andnode(
ColumnPredicate* pred, roaring::Roaring* output_result) {
RETURN_IF_ERROR(pred->evaluate(_storage_name_and_type[pred->column_id()],
@ -886,13 +871,10 @@ Status SegmentIterator::_apply_index_except_leafnode_of_andnode() {
continue;
}
bool can_apply_by_bitmap_index = _check_apply_by_bitmap_index(pred);
bool can_apply_by_inverted_index = _check_apply_by_inverted_index(pred, true);
roaring::Roaring bitmap = _row_bitmap;
Status res = Status::OK();
if (can_apply_by_bitmap_index) {
res = _apply_bitmap_index_except_leafnode_of_andnode(pred, &bitmap);
} else if (can_apply_by_inverted_index) {
if (can_apply_by_inverted_index) {
res = _apply_inverted_index_except_leafnode_of_andnode(pred, &bitmap);
} else {
continue;

View File

@ -188,8 +188,6 @@ private:
std::set<const ColumnPredicate*>& no_need_to_pass_column_predicate_set,
bool* continue_apply);
[[nodiscard]] Status _apply_index_except_leafnode_of_andnode();
[[nodiscard]] Status _apply_bitmap_index_except_leafnode_of_andnode(
ColumnPredicate* pred, roaring::Roaring* output_result);
[[nodiscard]] Status _apply_inverted_index_except_leafnode_of_andnode(
ColumnPredicate* pred, roaring::Roaring* output_result);
bool _column_has_fulltext_index(int32_t cid);
@ -286,7 +284,6 @@ private:
void _convert_dict_code_for_predicate_if_necessary_impl(ColumnPredicate* predicate);
bool _check_apply_by_bitmap_index(ColumnPredicate* pred);
bool _check_apply_by_inverted_index(ColumnPredicate* pred, bool pred_in_compound = false);
std::string _gen_predicate_result_sign(ColumnPredicate* predicate);