github-actions[bot] commented on code in PR #64377:
URL: https://github.com/apache/doris/pull/64377#discussion_r3534067989
##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -971,6 +977,13 @@ Status SegmentIterator::_apply_ann_topn_predicate() {
return Status::OK();
}
+ // Run the pre-filter here: after the metric/direction checks above (so a
query that would
+ // fall back anyway does not pay for it) and before pre_size below (so the
small-candidate
+ // threshold sees the post-predicate count).
+ if (prefilter_column_predicate) {
+ RETURN_IF_ERROR(_eager_filter_predicates_into_bitmap());
Review Comment:
This path also needs to keep condition-cache semantics intact. With
`enable_condition_cache` left at its default, `ScanOperator` only disables the
cache for ordinary TopN filters (`p._topn_filter_source_node_ids`), but ANN
TopN is carried separately in `_ann_topn_runtime`, so a filtered ANN TopN scan
can still populate `_condition_cache`. After this call,
`_apply_ann_topn_predicate()` eventually narrows `_row_bitmap` to the ANN top-K
row ids, and the EOF path inserts cache entries from those final
`_block_rowids`; that records only blocks containing the top-K results, not all
blocks where the column predicate matched. Since the condition-cache key is
based on the predicate/session digest and does not include the ANN ordering
vector or limit, a later query with the same predicate can hit this cache and
incorrectly remove blocks that had matching rows but were not in the previous
top-K. Please either disable condition-cache population/lookup when
`ann_topn_runtime` is active, or pop
ulate it from the predicate survivors before the ANN TopN narrowing.
--
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]