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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit f67a00ffbb9901f9a22cab21c7d1d522f0959e0a
Author: minghong <engle...@gmail.com>
AuthorDate: Thu Jan 11 16:08:19 2024 +0800

    [opt](nereids) prune runtime redundant filters (#29828)
    
    1. expand_runtime_filter_by_inner_join will create some redundant rfs,e.g., 
tpch q5 and q9, we need to remove one
    2. hive: prune rf if target only used as probe
---
 .../processor/post/RuntimeFilterContext.java       | 62 +++++++++++++++++++--
 .../processor/post/RuntimeFilterPruner.java        | 64 +++++++++++++++++-----
 .../post/RuntimeFilterPrunerForExternalTable.java  | 27 +++++----
 .../trees/plans/physical/PhysicalHashJoin.java     | 15 ++++-
 .../noStatsRfPrune/query17.out                     |  4 +-
 .../noStatsRfPrune/query25.out                     |  4 +-
 .../noStatsRfPrune/query29.out                     |  4 +-
 .../noStatsRfPrune/query64.out                     |  4 +-
 .../noStatsRfPrune/query65.out                     |  4 +-
 .../noStatsRfPrune/query72.out                     |  4 +-
 .../nostats_rf_prune/q5.out                        |  4 +-
 11 files changed, 152 insertions(+), 44 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
index b4326499039..5e412f61ca3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
@@ -21,6 +21,7 @@ import org.apache.doris.analysis.SlotRef;
 import org.apache.doris.common.IdGenerator;
 import org.apache.doris.common.Pair;
 import org.apache.doris.nereids.trees.expressions.CTEId;
+import org.apache.doris.nereids.trees.expressions.EqualPredicate;
 import org.apache.doris.nereids.trees.expressions.EqualTo;
 import org.apache.doris.nereids.trees.expressions.ExprId;
 import org.apache.doris.nereids.trees.expressions.Expression;
@@ -125,7 +126,7 @@ public class RuntimeFilterContext {
 
     private final Map<Slot, ScanNode> scanNodeOfLegacyRuntimeFilterTarget = 
Maps.newLinkedHashMap();
 
-    private final Set<Plan> effectiveSrcNodes = Sets.newHashSet();
+    private final Map<Plan, EffectiveSrcType> effectiveSrcNodes = 
Maps.newHashMap();
 
     // cte to related joins map which can extract common runtime filter to cte 
inside
     private final Map<CTEId, Set<PhysicalHashJoin>> cteToJoinsMap = 
Maps.newLinkedHashMap();
@@ -147,6 +148,30 @@ public class RuntimeFilterContext {
 
     private int targetNullCount = 0;
 
+    private final List<ExpandRF> expandedRF = Lists.newArrayList();
+
+    /**
+     * info about expand rf by inner join
+     */
+    public static class ExpandRF {
+        public AbstractPhysicalJoin buildNode;
+
+        public PhysicalRelation srcNode;
+        public PhysicalRelation target1;
+
+        public PhysicalRelation target2;
+
+        public EqualPredicate equal;
+
+        public ExpandRF(AbstractPhysicalJoin buildNode, PhysicalRelation 
srcNode,
+                        PhysicalRelation target1, PhysicalRelation target2, 
EqualPredicate equal) {
+            this.buildNode = buildNode;
+            this.srcNode = srcNode;
+            this.target1 = target1;
+            this.target2 = target2;
+        }
+    }
+
     public RuntimeFilterContext(SessionVariable sessionVariable) {
         this.sessionVariable = sessionVariable;
         this.limits = new FilterSizeLimits(sessionVariable);
@@ -307,12 +332,23 @@ public class RuntimeFilterContext {
         targetNullCount++;
     }
 
-    public void addEffectiveSrcNode(Plan node) {
-        effectiveSrcNodes.add(node);
+    /**
+     * the selectivity produced by predicate or rf
+     */
+    public enum EffectiveSrcType {
+        NATIVE, REF
+    }
+
+    public void addEffectiveSrcNode(Plan node, EffectiveSrcType type) {
+        effectiveSrcNodes.put(node, type);
     }
 
     public boolean isEffectiveSrcNode(Plan node) {
-        return effectiveSrcNodes.contains(node);
+        return effectiveSrcNodes.keySet().contains(node);
+    }
+
+    public EffectiveSrcType getEffectiveSrcType(Plan plan) {
+        return effectiveSrcNodes.get(plan);
     }
 
     @VisibleForTesting
@@ -335,4 +371,22 @@ public class RuntimeFilterContext {
         }
         return olapSlot;
     }
+
+    /**
+     * return the info about expand_runtime_filter_by_inner_join
+     */
+    public ExpandRF getExpandRfByJoin(AbstractPhysicalJoin join) {
+        if (join instanceof PhysicalHashJoin) {
+            for (ExpandRF expand : expandedRF) {
+                if (expand.buildNode.equals(join)) {
+                    return expand;
+                }
+            }
+        }
+        return null;
+    }
+
+    public List<ExpandRF> getExpandedRF() {
+        return expandedRF;
+    }
 }
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 210ed4f6f32..5005da2a1cf 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
@@ -32,9 +32,12 @@ import 
org.apache.doris.nereids.trees.plans.physical.PhysicalHashJoin;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalLimit;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalRelation;
 import org.apache.doris.nereids.trees.plans.physical.PhysicalTopN;
+import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.statistics.ColumnStatistic;
 import org.apache.doris.statistics.Statistics;
 
+import com.google.common.collect.Sets;
+
 import java.util.List;
 import java.util.Set;
 
@@ -57,7 +60,9 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
         if (!plan.children().isEmpty()) {
             plan.child(0).accept(this, context);
             if 
(context.getRuntimeFilterContext().isEffectiveSrcNode(plan.child(0))) {
-                context.getRuntimeFilterContext().addEffectiveSrcNode(plan);
+                RuntimeFilterContext.EffectiveSrcType childType = 
context.getRuntimeFilterContext()
+                        .getEffectiveSrcType(plan.child(0));
+                context.getRuntimeFilterContext().addEffectiveSrcNode(plan, 
childType);
             }
         }
         return plan;
@@ -66,13 +71,13 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
     @Override
     public PhysicalTopN visitPhysicalTopN(PhysicalTopN<? extends Plan> topN, 
CascadesContext context) {
         topN.child().accept(this, context);
-        context.getRuntimeFilterContext().addEffectiveSrcNode(topN);
+        context.getRuntimeFilterContext().addEffectiveSrcNode(topN, 
RuntimeFilterContext.EffectiveSrcType.NATIVE);
         return topN;
     }
 
     public PhysicalLimit visitPhysicalLimit(PhysicalLimit<? extends Plan> 
limit, CascadesContext context) {
         limit.child().accept(this, context);
-        context.getRuntimeFilterContext().addEffectiveSrcNode(limit);
+        context.getRuntimeFilterContext().addEffectiveSrcNode(limit, 
RuntimeFilterContext.EffectiveSrcType.NATIVE);
         return limit;
     }
 
@@ -80,11 +85,29 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
     public PhysicalHashJoin visitPhysicalHashJoin(PhysicalHashJoin<? extends 
Plan, ? extends Plan> join,
             CascadesContext context) {
         join.right().accept(this, context);
-        if 
(context.getRuntimeFilterContext().isEffectiveSrcNode(join.right())) {
-            context.getRuntimeFilterContext().addEffectiveSrcNode(join);
+        RuntimeFilterContext rfContext = context.getRuntimeFilterContext();
+        if (rfContext.isEffectiveSrcNode(join.right())) {
+            boolean enableExpand = false;
+            if (ConnectContext.get() != null) {
+                enableExpand = 
ConnectContext.get().getSessionVariable().expandRuntimeFilterByInnerJoin;
+            }
+            if (enableExpand && rfContext.getEffectiveSrcType(join.right())
+                    == RuntimeFilterContext.EffectiveSrcType.REF) {
+                RuntimeFilterContext.ExpandRF expand = 
rfContext.getExpandRfByJoin(join);
+                if (expand != null) {
+                    Set<ExprId> outputExprIdOfExpandTargets = 
Sets.newHashSet();
+                    
outputExprIdOfExpandTargets.addAll(expand.target1.getOutputExprIds());
+                    
outputExprIdOfExpandTargets.addAll(expand.target2.getOutputExprIds());
+                    rfContext.getTargetExprIdByFilterJoin(join)
+                            .stream().filter(exprId -> 
outputExprIdOfExpandTargets.contains(exprId))
+                            .forEach(exprId -> rfContext.removeFilter(exprId, 
join));
+                }
+            }
+            RuntimeFilterContext.EffectiveSrcType childType =
+                    rfContext.getEffectiveSrcType(join.right());
+            context.getRuntimeFilterContext().addEffectiveSrcNode(join, 
childType);
         } else {
-            RuntimeFilterContext ctx = context.getRuntimeFilterContext();
-            List<ExprId> exprIds = ctx.getTargetExprIdByFilterJoin(join);
+            List<ExprId> exprIds = rfContext.getTargetExprIdByFilterJoin(join);
             if (exprIds != null && !exprIds.isEmpty()) {
                 boolean isEffective = false;
                 for (Expression expr : join.getEqualToConjuncts()) {
@@ -93,13 +116,21 @@ public class RuntimeFilterPruner extends PlanPostProcessor 
{
                     }
                 }
                 if (!isEffective) {
-                    exprIds.stream().forEach(exprId -> 
context.getRuntimeFilterContext().removeFilter(exprId, join));
+                    exprIds.stream().forEach(exprId -> 
rfContext.removeFilter(exprId, join));
                 }
             }
         }
         join.left().accept(this, context);
-        if (context.getRuntimeFilterContext().isEffectiveSrcNode(join.left())) 
{
-            context.getRuntimeFilterContext().addEffectiveSrcNode(join);
+        if (rfContext.isEffectiveSrcNode(join.left())) {
+            RuntimeFilterContext.EffectiveSrcType leftType =
+                    rfContext.getEffectiveSrcType(join.left());
+            RuntimeFilterContext.EffectiveSrcType rightType =
+                    rfContext.getEffectiveSrcType(join.right());
+            if (rightType == null
+                    || (rightType == RuntimeFilterContext.EffectiveSrcType.REF
+                        && leftType == 
RuntimeFilterContext.EffectiveSrcType.NATIVE)) {
+                rfContext.addEffectiveSrcNode(join, leftType);
+            }
         }
         return join;
     }
@@ -122,7 +153,7 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
                 .anyMatch(slot -> isVisibleColumn(slot));
         if (visibleFilter) {
             // skip filters like: __DORIS_DELETE_SIGN__ = 0
-            context.getRuntimeFilterContext().addEffectiveSrcNode(filter);
+            context.getRuntimeFilterContext().addEffectiveSrcNode(filter, 
RuntimeFilterContext.EffectiveSrcType.NATIVE);
         }
         return filter;
     }
@@ -134,7 +165,7 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
         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(scan);
+                context.getRuntimeFilterContext().addEffectiveSrcNode(scan, 
RuntimeFilterContext.EffectiveSrcType.REF);
                 break;
             }
         }
@@ -145,20 +176,23 @@ public class RuntimeFilterPruner extends 
PlanPostProcessor {
     public PhysicalAssertNumRows 
visitPhysicalAssertNumRows(PhysicalAssertNumRows<? extends Plan> assertNumRows,
             CascadesContext context) {
         assertNumRows.child().accept(this, context);
-        context.getRuntimeFilterContext().addEffectiveSrcNode(assertNumRows);
+        context.getRuntimeFilterContext().addEffectiveSrcNode(assertNumRows,
+                RuntimeFilterContext.EffectiveSrcType.NATIVE);
         return assertNumRows;
     }
 
     @Override
     public PhysicalHashAggregate 
visitPhysicalHashAggregate(PhysicalHashAggregate<? extends Plan> aggregate,
                                                             CascadesContext 
context) {
+        RuntimeFilterContext ctx = context.getRuntimeFilterContext();
         aggregate.child().accept(this, context);
         // q1: A join (select x, sum(y) as z from B group by x) T on A.a = T.x
         // q2: A join (select x, sum(y) as z from B group by x) T on A.a = T.z
         // RF on q1 is not effective, but RF on q2 is. But q1 is a more 
generous pattern, and hence agg is not
         // regarded as an effective source. Let this RF judge by ndv.
-        if 
(context.getRuntimeFilterContext().isEffectiveSrcNode(aggregate.child(0))) {
-            context.getRuntimeFilterContext().addEffectiveSrcNode(aggregate);
+        if (ctx.isEffectiveSrcNode(aggregate.child(0))) {
+            RuntimeFilterContext.EffectiveSrcType childType = 
ctx.getEffectiveSrcType(aggregate.child());
+            ctx.addEffectiveSrcNode(aggregate, childType);
         }
         return aggregate;
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPrunerForExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPrunerForExternalTable.java
index dd104173b21..0a0cfe04ec6 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPrunerForExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPrunerForExternalTable.java
@@ -97,7 +97,8 @@ public class RuntimeFilterPrunerForExternalTable extends 
PlanPostProcessor {
                                                   CascadesContext context) {
         join.right().accept(this, context);
         join.right().setMutableState(MutableState.KEY_PARENT, join);
-        join.setMutableState(MutableState.KEY_RF_JUMP, 
join.right().getMutableState(MutableState.KEY_RF_JUMP).get());
+        join.setMutableState(MutableState.KEY_RF_JUMP,
+                join.right().getMutableState(MutableState.KEY_RF_JUMP).get());
         join.left().accept(this, context);
         join.left().setMutableState(MutableState.KEY_PARENT, join);
         return join;
@@ -121,15 +122,18 @@ public class RuntimeFilterPrunerForExternalTable extends 
PlanPostProcessor {
         Plan cursor = scan;
         Optional<Plan> parent = 
cursor.getMutableState(MutableState.KEY_PARENT);
         while (parent.isPresent()) {
-            if (joinAndAncestors.contains(parent.get())) {
-                Optional oi = 
parent.get().getMutableState(MutableState.KEY_RF_JUMP);
-                if (oi.isPresent() && ConnectContext.get() != null
-                        && (int) (oi.get()) > 
ConnectContext.get().getSessionVariable().runtimeFilterJumpThreshold) {
-                    return true;
-                }
-            } else {
-                if (isBuildSide(parent.get(), cursor)) {
-                    return false;
+            if (parent.get() instanceof Join) {
+                if (joinAndAncestors.contains(parent.get())) {
+                    Optional oi = 
parent.get().getMutableState(MutableState.KEY_RF_JUMP);
+                    if (oi.isPresent() && ConnectContext.get() != null
+                            && (int) (oi.get())
+                            > 
ConnectContext.get().getSessionVariable().runtimeFilterJumpThreshold) {
+                        return true;
+                    }
+                } else {
+                    if (isBuildSide(parent.get(), cursor)) {
+                        return false;
+                    }
                 }
             }
             cursor = parent.get();
@@ -148,6 +152,9 @@ public class RuntimeFilterPrunerForExternalTable extends 
PlanPostProcessor {
             Optional oi = child.getMutableState(MutableState.KEY_RF_JUMP);
             if (oi.isPresent()) {
                 int jump = (Integer) (oi.get());
+                if (child instanceof Join) {
+                    jump++;
+                }
                 if (jump > maxJump) {
                     maxJump = jump;
                 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
index cf1ff7fdf53..5d00257b9ca 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
@@ -207,17 +207,31 @@ public class PhysicalHashJoin<
                 "join child node is null");
 
         Set<Expression> probExprList = Sets.newHashSet(probeExpr);
+        Pair<PhysicalRelation, Slot> pair = 
ctx.getAliasTransferMap().get(probeExpr);
+        PhysicalRelation target1 = (pair == null) ? null : pair.first;
+        PhysicalRelation target2 = null;
+        pair = ctx.getAliasTransferMap().get(srcExpr);
+        PhysicalRelation srcNode = (pair == null) ? null : pair.first;
         if (ConnectContext.get() != null && 
ConnectContext.get().getSessionVariable().expandRuntimeFilterByInnerJoin) {
             if (!this.equals(builderNode) && this.getJoinType() == 
JoinType.INNER_JOIN) {
                 for (Expression expr : this.getHashJoinConjuncts()) {
                     EqualPredicate equalTo = (EqualPredicate) expr;
                     if (probeExpr.equals(equalTo.left())) {
                         probExprList.add(equalTo.right());
+                        pair = ctx.getAliasTransferMap().get(equalTo.right());
+                        target2 = (pair == null) ? null : pair.first;
                     } else if (probeExpr.equals(equalTo.right())) {
                         probExprList.add(equalTo.left());
+                        pair = ctx.getAliasTransferMap().get(equalTo.left());
+                        target2 = (pair == null) ? null : pair.first;
+                    }
+                    if (target2 != null) {
+                        ctx.getExpandedRF().add(
+                            new RuntimeFilterContext.ExpandRF(this, srcNode, 
target1, target2, equalTo));
                     }
                 }
                 probExprList.remove(srcExpr);
+
             }
         }
         for (Expression prob : probExprList) {
@@ -257,7 +271,6 @@ public class PhysicalHashJoin<
             builder.append(" build RFs:").append(runtimeFilters.stream()
                     .map(rf -> 
rf.shapeInfo()).collect(Collectors.joining(";")));
         }
-        // builder.append("jump: 
").append(getMutableState(MutableState.KEY_RF_JUMP));
         return builder.toString();
     }
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query17.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query17.out
index bdd8ac1f16a..97bfabfa402 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query17.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query17.out
@@ -21,9 +21,9 @@ PhysicalResultSink
 ------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_returns.sr_customer_sk = 
catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = 
catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 
cs_bill_customer_sk->[ss_customer_sk,sr_customer_sk];RF4 
cs_item_sk->[ss_item_sk,sr_item_sk]
 --------------------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 
sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number]
+------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=()
 --------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[store_sales] 
apply RFs: RF0 RF1 RF2 RF3 RF4 RF5
+----------------------------------------------PhysicalOlapScan[store_sales] 
apply RFs: RF3 RF4 RF5
 --------------------------------------------PhysicalProject
 ----------------------------------------------PhysicalOlapScan[store_returns] 
apply RFs: RF3 RF4 RF6
 --------------------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query25.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query25.out
index 3b9cc675c0c..2cbe6131465 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query25.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query25.out
@@ -20,9 +20,9 @@ PhysicalResultSink
 ----------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_returns.sr_customer_sk = 
catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = 
catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 
cs_bill_customer_sk->[ss_customer_sk,sr_customer_sk];RF4 
cs_item_sk->[ss_item_sk,sr_item_sk]
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
-----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 
sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number]
+----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=()
 ------------------------------------------PhysicalProject
---------------------------------------------PhysicalOlapScan[store_sales] 
apply RFs: RF0 RF1 RF2 RF3 RF4 RF5
+--------------------------------------------PhysicalOlapScan[store_sales] 
apply RFs: RF3 RF4 RF5
 ------------------------------------------PhysicalProject
 --------------------------------------------PhysicalOlapScan[store_returns] 
apply RFs: RF3 RF4 RF6
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query29.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query29.out
index 63f23267f04..812e5126e88 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query29.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query29.out
@@ -19,9 +19,9 @@ PhysicalResultSink
 --------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_returns.sr_customer_sk = 
catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = 
catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 
cs_bill_customer_sk->[ss_customer_sk,sr_customer_sk];RF4 
cs_item_sk->[ss_item_sk,sr_item_sk]
 ----------------------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 
sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number]
+--------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and 
(store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=()
 ----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[store_sales] apply 
RFs: RF0 RF1 RF2 RF3 RF4 RF5
+------------------------------------------PhysicalOlapScan[store_sales] apply 
RFs: RF3 RF4 RF5
 ----------------------------------------PhysicalProject
 ------------------------------------------PhysicalOlapScan[store_returns] 
apply RFs: RF3 RF4 RF7
 ----------------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query64.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query64.out
index 2703f5aba8b..1494aa9d683 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query64.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query64.out
@@ -23,7 +23,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
 ----------------------------------------PhysicalProject
 ------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=()
 --------------------------------------------PhysicalProject
-----------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=() build RFs:RF9 sr_item_sk->[ss_item_sk,i_item_sk];RF10 
sr_ticket_number->[ss_ticket_number]
+----------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and 
(store_sales.ss_ticket_number = store_returns.sr_ticket_number)) 
otherCondition=()
 ------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF8 i_item_sk->[ss_item_sk]
 
--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------------------------------PhysicalProject
@@ -39,7 +39,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
 
------------------------------------------------------------------------hashJoin[INNER_JOIN]
 hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) 
otherCondition=()
 
--------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
 
----------------------------------------------------------------------------PhysicalProject
-------------------------------------------------------------------------------PhysicalOlapScan[store_sales]
 apply RFs: RF8 RF9 RF10 RF17 RF19
+------------------------------------------------------------------------------PhysicalOlapScan[store_sales]
 apply RFs: RF8 RF17 RF19
 
--------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
 
----------------------------------------------------------------------------PhysicalProject
 
------------------------------------------------------------------------------hashJoin[INNER_JOIN]
 hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) 
otherCondition=()
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query65.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query65.out
index 0efb98d242f..0b84e050b6e 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query65.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query65.out
@@ -7,7 +7,7 @@ PhysicalResultSink
 --------PhysicalProject
 ----------hashJoin[INNER_JOIN] hashCondition=((sb.ss_store_sk = 
sc.ss_store_sk)) otherCondition=((cast(revenue as DOUBLE) <= cast((0.1 * ave) 
as DOUBLE))) build RFs:RF4 ss_store_sk->[s_store_sk,ss_store_sk]
 ------------PhysicalProject
---------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = 
sc.ss_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk]
+--------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = 
sc.ss_store_sk)) otherCondition=()
 ----------------PhysicalDistribute[DistributionSpecHash]
 ------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = 
sc.ss_item_sk)) otherCondition=()
 --------------------hashAgg[GLOBAL]
@@ -16,7 +16,7 @@ PhysicalResultSink
 --------------------------PhysicalProject
 ----------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk]
 ------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 
RF3 RF4
+--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 
RF4
 ------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------PhysicalProject
 ----------------------------------filter((date_dim.d_month_seq <= 1232) and 
(date_dim.d_month_seq >= 1221))
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query72.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query72.out
index 9c2e78f8228..9b5c04410e9 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query72.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query72.out
@@ -21,9 +21,9 @@ PhysicalResultSink
 ------------------------------------PhysicalProject
 --------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_bill_cdemo_sk = 
customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF1 
cd_demo_sk->[cs_bill_cdemo_sk]
 ----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk)) 
otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity)) 
build RFs:RF0 cs_item_sk->[inv_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk)) 
otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity))
 
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------------PhysicalOlapScan[inventory] 
apply RFs: RF0 RF3
+----------------------------------------------PhysicalOlapScan[inventory] 
apply RFs: RF3
 
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------------------------hashJoin[LEFT_OUTER_JOIN] 
hashCondition=((catalog_returns.cr_item_sk = catalog_sales.cs_item_sk) and 
(catalog_returns.cr_order_number = catalog_sales.cs_order_number)) 
otherCondition=()
 ------------------------------------------------hashJoin[LEFT_OUTER_JOIN] 
hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) 
otherCondition=()
diff --git 
a/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q5.out 
b/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q5.out
index f3053b41c70..24795e1beac 100644
--- a/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q5.out
+++ b/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q5.out
@@ -12,7 +12,7 @@ PhysicalResultSink
 ------------------PhysicalProject
 --------------------hashJoin[INNER_JOIN] hashCondition=((supplier.s_nationkey 
= nation.n_nationkey)) otherCondition=() build RFs:RF4 
n_nationkey->[s_nationkey,c_nationkey]
 ----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer.c_nationkey = supplier.s_nationkey) and 
(lineitem.l_suppkey = supplier.s_suppkey)) otherCondition=() build RFs:RF2 
s_suppkey->[l_suppkey];RF3 s_nationkey->[c_nationkey]
+------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer.c_nationkey = supplier.s_nationkey) and 
(lineitem.l_suppkey = supplier.s_suppkey)) otherCondition=() build RFs:RF2 
s_suppkey->[l_suppkey]
 --------------------------PhysicalProject
 ----------------------------hashJoin[INNER_JOIN] 
hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() 
build RFs:RF1 o_orderkey->[l_orderkey]
 ------------------------------PhysicalProject
@@ -26,7 +26,7 @@ PhysicalResultSink
 ------------------------------------------PhysicalOlapScan[orders] apply RFs: 
RF0
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[customer] apply RFs: 
RF3 RF4
+----------------------------------------PhysicalOlapScan[customer] apply RFs: 
RF4
 --------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------PhysicalProject
 ------------------------------PhysicalOlapScan[supplier] apply RFs: RF4


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to