This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new bea66e6a12 [fix](nereids) cannot generate RF on colocate join and 
prune useful RF in RF prune (#14234)
bea66e6a12 is described below

commit bea66e6a12ff16517ee22dfeaff53628b5f61fab
Author: minghong <[email protected]>
AuthorDate: Mon Nov 14 16:36:55 2022 +0800

    [fix](nereids) cannot generate RF on colocate join and prune useful RF in 
RF prune (#14234)
    
    1. when we translate colocated join, we lost RF information attached to the 
right child, and hence BE will not generate those RFs.
    2. when a RF is useless, we prune all RFs on the scan node by mistake
---
 .../nereids/glue/translator/PhysicalPlanTranslator.java     |  2 ++
 .../doris/nereids/processor/post/RuntimeFilterPruner.java   | 13 ++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
index 9de89384b1..31fe935099 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
@@ -1088,6 +1088,8 @@ public class PhysicalPlanTranslator extends 
DefaultPlanVisitor<PlanFragment, Pla
         hashJoinNode.setChild(0, leftFragment.getPlanRoot());
         hashJoinNode.setChild(1, rightFragment.getPlanRoot());
         leftFragment.setPlanRoot(hashJoinNode);
+        
rightFragment.getTargetRuntimeFilterIds().stream().forEach(leftFragment::setTargetRuntimeFilterIds);
+        
rightFragment.getBuilderRuntimeFilterIds().stream().forEach(leftFragment::setBuilderRuntimeFilterIds);
         context.removePlanFragment(rightFragment);
         leftFragment.setHasColocatePlanNode(true);
         return leftFragment;
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
index c44f46b0ae..41047c568d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
@@ -130,9 +130,16 @@ public class RuntimeFilterPruner extends PlanPostProcessor 
{
 
     @Override
     public PhysicalOlapScan visitPhysicalOlapScan(PhysicalOlapScan olapScan, 
CascadesContext context) {
-        List<Slot> slots = 
context.getRuntimeFilterContext().getTargetOnOlapScanNodeMap().get(olapScan.getId());
-        if (slots != null && !slots.isEmpty()) {
-            context.getRuntimeFilterContext().addEffectiveSrcNode(olapScan);
+        RuntimeFilterContext rfCtx = context.getRuntimeFilterContext();
+        List<Slot> slots = 
rfCtx.getTargetOnOlapScanNodeMap().get(olapScan.getId());
+        if (slots != null) {
+            for (Slot slot : slots) {
+                //if this scan node is the target of any effective RF, it is 
effective source
+                if 
(!rfCtx.getTargetExprIdToFilter().get(slot.getExprId()).isEmpty()) {
+                    
context.getRuntimeFilterContext().addEffectiveSrcNode(olapScan);
+                    break;
+                }
+            }
         }
         return olapScan;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to