github-actions[bot] commented on code in PR #67171:
URL: https://github.com/apache/doris/pull/67171#discussion_r3863443963
##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -1237,7 +1237,21 @@ Status SegmentIterator::_apply_index_expr() {
!_opts.runtime_state->query_options().__isset.enable_ann_index_result_cache ||
_opts.runtime_state->query_options().enable_ann_index_result_cache;
+ // Intersect each consumed index result into _row_bitmap right away so a
+ // selective conjunct short-circuits the remaining (potentially expensive,
+ // e.g. MATCH_PHRASE_PREFIX) ones. A skipped conjunct stays pushed down and
+ // keeps its semantics on the row-level path, which then sees zero rows.
+ // Consumed conjuncts are erased only after the ANN pass below, which
+ // iterates the same list.
+ std::vector<const VExprContext*> consumed_by_index;
+ size_t considered_conjuncts = 0;
for (const auto& expr_ctx : _common_expr_ctxs_push_down) {
+ if (_row_bitmap.isEmpty()) {
Review Comment:
**[P2] Avoid ANN work after the candidate set is empty**
The short-circuit stops only the ordinary inverted-index loop; the same
remaining contexts still enter the unconditional ANN range-search loop below.
With both supported small-candidate thresholds set to `0`,
`should_fallback_ann_index_by_small_candidate(0, ...)` is false, so an
already-empty bitmap still reaches `try_load_index()` and FAISS `range_search`
through an empty selector. A query combining an empty cheap MATCH with an ANN
range conjunct can therefore keep paying ANN load/search cost while this
counter reports the context as short-circuited. Please bypass zero-candidate
ANN fallback accounting, loading, cache lookup, and search (including after an
earlier ANN conjunct empties the bitmap), while preserving the existing
metric/dimension validation, and cover the thresholds-disabled case.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]