eldenmoon commented on code in PR #32620: URL: https://github.com/apache/doris/pull/32620#discussion_r1582003180
########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -1210,6 +1241,46 @@ Status SegmentIterator::_apply_inverted_index() { } } + // add a switch for inverted index filter + if (_opts.runtime_state && + _opts.runtime_state->enable_common_expr_pushdown_for_inverted_index()) { + // support expr to evaluate inverted index + std::unordered_map<ColumnId, std::pair<vectorized::NameAndTypePair, InvertedIndexIterator*>> + iter_map; + for (auto col_id : _common_expr_columns_for_index) { + auto tablet_col_id = _schema->column_id(col_id); + if (_check_apply_by_inverted_index(tablet_col_id)) { + iter_map[col_id] = std::make_pair(_storage_name_and_type[tablet_col_id], + _inverted_index_iterators[tablet_col_id].get()); + } + } + for (auto expr_ctx : _common_expr_ctxs_push_down) { + // _inverted_index_iterators has all column ids which has inverted index + // _common_expr_columns has all column ids from _common_expr_ctxs_push_down + // if current bitmap is already empty just return + if (_row_bitmap.isEmpty()) { + break; + } + std::shared_ptr<roaring::Roaring> result_bitmap = std::make_shared<roaring::Roaring>(); + if (Status st = + expr_ctx->eval_inverted_index(iter_map, num_rows(), result_bitmap.get()); + !st.ok()) { + if (_downgrade_without_index(st) || st.code() == ErrorCode::NOT_IMPLEMENTED_ERROR) { + continue; + } else { + // other code is not to be handled, we should just break + LOG(WARNING) << "failed to evaluate inverted index for expr_ctx: " + << expr_ctx->root()->debug_string() + << ", error msg: " << st.to_string(); + break; Review Comment: why not return status? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org