github-actions[bot] commented on code in PR #64377:
URL: https://github.com/apache/doris/pull/64377#discussion_r3578222188


##########
gensrc/thrift/PaloInternalService.thrift:
##########
@@ -507,6 +507,9 @@ struct TQueryOptions {
   225: optional i64 runtime_filter_tree_publish_max_send_bytes = 268435456
 
   226: optional bool enable_prune_nested_column = false;
+  // Pre-filter column predicates into the ANN candidate bitmap (IDSelector) 
instead of falling
+  // back to a brute-force distance scan when an ANN TopN query carries a 
column predicate.
+  227: optional bool enable_ann_topn_predicate_prefilter = true
   // For cloud, to control if the content would be written into file cache

Review Comment:
   Please do not make the absent thrift field enable this path. During rolling 
upgrade an old FE cannot serialize `enable_ann_topn_predicate_prefilter`, 
include it in SQL/query-cache digests, or forward it to BEs; this new BE code 
treats `!__isset.enable_ann_topn_predicate_prefilter` as true and will run the 
ANN index prefilter path instead of the previous brute-force fallback for 
predicated ANN TopN. That means the same old-FE cache key can represent 
different result semantics depending on which BE version executes it. Preserve 
the old behavior when the field is absent, or disable/gate these caches for 
missing-field requests, and only enable the new result-affecting path when a 
compatible FE explicitly sends the option.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -3493,6 +3494,16 @@ public void setDetailShapePlanNodes(String 
detailShapePlanNodes) {
     })
     public boolean enableAnnIndexResultCache = true;
 
+    @VarAttrDef.VarAttr(name = ENABLE_ANN_TOPN_PREDICATE_PREFILTER, 
needForward = true,
+            affectQueryResultInExecution = true, description = {
+        "开启后,带列谓词的 ANN TopN 查询会先把谓词求值成候选位图喂给 ANN 索引(IDSelector),"

Review Comment:
   Marking this new flag as result-affecting fixes only one cache-key 
dimension. Once it lets predicated ANN TopN stay on the ANN index path, the ANN 
search/fallback knobs that are already forwarded (`hnsw_ef_search`, 
`hnsw_check_relative_distance`, `hnsw_bounded_queue`, `ivf_nprobe`, 
`ann_index_candidate_rows_threshold`, 
`ann_index_candidate_rows_percent_threshold`) can also change results, but they 
remain only `needForward = true`. SQL cache and query-cache digests use 
`readAffectQueryResultVariables()`, so a query can cache an indexed predicated 
ANN result with one `hnsw_ef_search` or candidate-threshold setting and reuse 
it after the setting changes. Please mark those ANN knobs result-affecting as 
well, or disable these caches for ANN TopN shapes that depend on them, and add 
coverage that toggles at least one search parameter and one fallback threshold.



-- 
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]

Reply via email to