Tanya-W commented on code in PR #17629: URL: https://github.com/apache/doris/pull/17629#discussion_r1133411199
########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -826,11 +824,12 @@ Status SegmentIterator::_apply_inverted_index_on_block_column_predicate( *continue_apply = false; } return res; + } else if (res.code() == ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND || + res.code() == ErrorCode::INVERTED_INDEX_FILE_HIT_LIMIT) { + //downgrade without index query + remaining_predicates_set.insert(predicate_set.begin(), predicate_set.end()); Review Comment: this else branch may not need, here use `no_need_to_pass_column_predicate_set` is enough, it would judge whether to remaining predicate by call `_apply_inverted_index_on_column_predicate` ########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -856,20 +855,24 @@ Status SegmentIterator::_apply_inverted_index() { size_t input_rows = _row_bitmap.cardinality(); std::vector<ColumnPredicate*> remaining_predicates; std::set<const ColumnPredicate*> no_need_to_pass_column_predicate_set; + std::set<const ColumnPredicate*> remaining_predicates_set; for (const auto& entry : _opts.col_id_to_predicates) { ColumnId column_id = entry.first; auto pred = entry.second; bool continue_apply = true; RETURN_IF_ERROR(_apply_inverted_index_on_block_column_predicate( - column_id, pred.get(), no_need_to_pass_column_predicate_set, &continue_apply)); + column_id, pred.get(), no_need_to_pass_column_predicate_set, + remaining_predicates_set, &continue_apply)); if (!continue_apply) { break; } } for (auto pred : _col_predicates) { - if (no_need_to_pass_column_predicate_set.count(pred) > 0) { + if (remaining_predicates_set.count(pred) > 0) { Review Comment: Is this branch to reduce the repeated predicate's evaluate? ########## be/src/olap/comparison_predicate.h: ########## @@ -65,35 +65,41 @@ class ComparisonPredicateBase : public ColumnPredicate { return Status::OK(); } auto column_desc = schema.column(_column_id); + column_desc->type(); Review Comment: this line can removed ########## be/src/olap/in_list_predicate.h: ########## @@ -206,13 +206,15 @@ class InListPredicateBase : public ColumnPredicate { auto column_desc = schema.column(_column_id); std::string column_name = column_desc->name(); roaring::Roaring indices; - for (auto value : *_values) { - InvertedIndexQueryType query_type = InvertedIndexQueryType::EQUAL_QUERY; - roaring::Roaring index; - RETURN_IF_ERROR(iterator->read_from_inverted_index(column_name, &value, query_type, - num_rows, &index)); - indices |= index; + + InvertedIndexQuery<Type> query(column_desc->type_info()); Review Comment: Can here directly define and use the `std::unique_ptr<InvertedIndexQueryType>` in line 215? -- 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