xzj7019 commented on code in PR #29847:
URL: https://github.com/apache/doris/pull/29847#discussion_r1448713223


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java:
##########
@@ -134,22 +134,26 @@ public boolean pushDownRuntimeFilter(CascadesContext 
context, IdGenerator<Runtim
         // currently, we can ensure children in the two side are corresponding 
to the equal_to's.
         // so right maybe an expression and left is a slot
         Slot probeSlot = RuntimeFilterGenerator.checkTargetChild(probeExpr);
-
-        // aliasTransMap doesn't contain the key, means that the path from the 
scan to the join
-        // contains join with denied join type. for example: a left join b on 
a.id = b.id
-        if 
(!RuntimeFilterGenerator.checkPushDownPreconditionsForJoin(builderNode, ctx, 
probeSlot)) {
+        if (probeSlot == null) {
             return false;
         }
-        PhysicalRelation scan = ctx.getAliasTransferPair(probeSlot).first;
-        if 
(!RuntimeFilterGenerator.checkPushDownPreconditionsForRelation(this, scan)) {
-            return false;
+        if 
(RuntimeFilterGenerator.checkPushDownPreconditionsForProjectOrDistribute(ctx, 
probeSlot)) {
+            PhysicalRelation scan = ctx.getAliasTransferPair(probeSlot).first;
+            if 
(!RuntimeFilterGenerator.checkPushDownPreconditionsForRelation(this, scan)) {
+                return false;
+            }
+            // TODO: global rf need merge stage which is heavy
+            // add some rule, such as bc only is allowed for
+            // pushing down through distribute, currently always pushing.
+            AbstractPhysicalPlan childPlan = (AbstractPhysicalPlan) child(0);
+            return childPlan.pushDownRuntimeFilter(context, generator, 
builderNode, src, probeExpr,
+                    type, buildSideNdv, exprOrder);
+        } else {
+            // if probe slot doesn't exist in aliasTransferMap, then try to 
pass it to child

Review Comment:
   it is hard to maintain aliasMap in complicated cases, such as 
project(join(union(xxx))), etc. At that time, push down is possible and during 
some special plan node, such as set operation node, the probe expr will be 
remapped and the new probe expr can be found at aliasMap at that time.



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

Reply via email to