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


##########
be/src/exec/runtime_filter/runtime_filter_producer_helper.cpp:
##########
@@ -65,12 +66,20 @@ Status RuntimeFilterProducerHelper::_init(
         RuntimeState* state, const VExprContextSPtrs& build_expr_ctxs,
         const std::vector<TRuntimeFilterDesc>& runtime_filter_descs,
         const RowDescriptor* row_desc) {
-    _producers.resize(runtime_filter_descs.size());
-    for (size_t i = 0; i < runtime_filter_descs.size(); i++) {
-        RETURN_IF_ERROR(
-                
state->register_producer_runtime_filter(runtime_filter_descs[i], 
&_producers[i]));
+    std::vector<TRuntimeFilterDesc> producer_runtime_filter_descs;
+    producer_runtime_filter_descs.reserve(runtime_filter_descs.size());
+    for (const auto& desc : runtime_filter_descs) {
+        if 
(state->global_runtime_filter_mgr()->should_build_runtime_filter_producer(desc))
 {
+            producer_runtime_filter_descs.push_back(desc);
+        }
+    }
+
+    _producers.resize(producer_runtime_filter_descs.size());
+    for (size_t i = 0; i < producer_runtime_filter_descs.size(); i++) {
+        
RETURN_IF_ERROR(state->register_producer_runtime_filter(producer_runtime_filter_descs[i],
+                                                                
&_producers[i]));
     }
-    RETURN_IF_ERROR(_init_expr(build_expr_ctxs, runtime_filter_descs));
+    RETURN_IF_ERROR(_init_expr(build_expr_ctxs, 
producer_runtime_filter_descs));

Review Comment:
   This pruning keeps producers and expression contexts aligned for the base 
hash-join helper, but not for `RuntimeFilterProducerHelperCross`. That subclass 
ignores the filtered descriptor list in `_init_expr()` and keeps the original 
`build_expr_ctxs`, while `_insert()` still pairs `_producers[i]` with 
`_filter_expr_contexts[i]`. For a nested-loop join that has a remote broadcast 
RF followed by a local-only RF, a non-selected BE drops the remote descriptor 
here but keeps the local one, so `_producers` becomes `[local RF]` while 
`_filter_expr_contexts[0]` still evaluates the remote RF source expression. The 
local RF can then publish values from the wrong build expression and filter 
valid rows. Please filter the cross/nested-loop expression contexts in the same 
order as `producer_runtime_filter_descs`, or rebuild them from the filtered 
descriptors.



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