From 911635fac61b56062148a8f24c882505fff01ec4 Mon Sep 17 00:00:00 2001 From: minghong Date: Sat, 6 Jan 2024 17:15:19 +0800 Subject: [PATCH] [feature](nereids) judge if the join is at bottom of join cluster (#29383) --- .../apache/doris/nereids/CascadesContext.java | 3 +- .../processor/post/RuntimeFilterContext.java | 16 +++ .../post/RuntimeFilterGenerator.java | 54 ++++---- .../rules/exploration/join/JoinCommute.java | 10 +- .../doris/nereids/stats/FilterEstimation.java | 2 +- .../doris/nereids/stats/StatsCalculator.java | 38 +++--- .../plans/physical/AbstractPhysicalPlan.java | 11 +- .../plans/physical/PhysicalDistribute.java | 6 +- .../plans/physical/PhysicalHashAggregate.java | 5 +- .../plans/physical/PhysicalHashJoin.java | 5 +- .../trees/plans/physical/PhysicalProject.java | 7 +- .../apache/doris/statistics/Statistics.java | 25 ++-- .../doris/statistics/StatisticsBuilder.java | 10 +- .../push_down_count_through_join.out | 44 +++---- .../push_down_sum_through_join.out | 22 ++-- .../noStatsRfPrune/query10.out | 42 +++--- .../noStatsRfPrune/query35.out | 28 ++-- .../noStatsRfPrune/query44.out | 121 +++++++++--------- .../noStatsRfPrune/query59.out | 37 +++--- .../noStatsRfPrune/query69.out | 75 +++++------ .../noStatsRfPrune/query95.out | 62 ++++----- .../no_stats_shape/query10.out | 42 +++--- .../no_stats_shape/query35.out | 28 ++-- .../no_stats_shape/query44.out | 121 +++++++++--------- .../no_stats_shape/query59.out | 37 +++--- .../no_stats_shape/query69.out | 75 +++++------ .../no_stats_shape/query95.out | 60 ++++----- 27 files changed, 502 insertions(+), 484 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java index 3c6eaa5999..fecdbf650c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java @@ -64,6 +64,7 @@ import org.apache.doris.qe.ConnectContext; import org.apache.doris.qe.SessionVariable; import org.apache.doris.statistics.ColumnStatistic; import org.apache.doris.statistics.Statistics; +import org.apache.doris.statistics.StatisticsBuilder; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -619,7 +620,7 @@ public class CascadesContext implements ScheduleContext { List, Group>> consumerGroups = this.statementContext.getCteIdToConsumerGroup().get(cteId); for (Pair, Group> p : consumerGroups) { Map producerSlotToConsumerSlot = p.first; - Statistics updatedConsumerStats = new Statistics(statistics); + Statistics updatedConsumerStats = new StatisticsBuilder(statistics).build(); for (Entry entry : statistics.columnStatistics().entrySet()) { updatedConsumerStats.addColumnStats(producerSlotToConsumerSlot.get(entry.getKey()), entry.getValue()); } 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 4360e5659c..9fa2346221 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 @@ -238,6 +238,22 @@ public class RuntimeFilterContext { return aliasTransferMap; } + public Pair aliasTransferMapRemove(NamedExpression slot) { + return aliasTransferMap.remove(slot); + } + + public Pair getAliasTransferPair(NamedExpression slot) { + return aliasTransferMap.get(slot); + } + + public Pair aliasTransferMapPut(NamedExpression slot, Pair pair) { + return aliasTransferMap.put(slot, pair); + } + + public boolean aliasTransferMapContains(NamedExpression slot) { + return aliasTransferMap.containsKey(slot); + } + public Map getScanNodeOfLegacyRuntimeFilterTarget() { return scanNodeOfLegacyRuntimeFilterTarget; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java index 12db27793d..0d9471287d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java @@ -122,7 +122,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { join.left().accept(this, context); if (RuntimeFilterGenerator.DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) { join.right().getOutput().forEach(slot -> - context.getRuntimeFilterContext().getAliasTransferMap().remove(slot)); + context.getRuntimeFilterContext().aliasTransferMapRemove(slot)); } collectPushDownCTEInfos(join, context); if (!getPushDownCTECandidates(ctx).isEmpty()) { @@ -136,7 +136,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { @Override public PhysicalCTEConsumer visitPhysicalCTEConsumer(PhysicalCTEConsumer scan, CascadesContext context) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - scan.getOutput().forEach(slot -> ctx.getAliasTransferMap().put(slot, Pair.of(scan, slot))); + scan.getOutput().forEach(slot -> ctx.aliasTransferMapPut(slot, Pair.of(scan, slot))); return scan; } @@ -158,7 +158,6 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (join.getJoinType() != JoinType.LEFT_SEMI_JOIN && join.getJoinType() != JoinType.CROSS_JOIN) { return; } - Map> aliasTransferMap = ctx.getAliasTransferMap(); List leftSlots = join.left().getOutput(); List rightSlots = join.right().getOutput(); List bitmapRuntimeFilterConditions = JoinUtils.extractBitmapRuntimeFilterConditions(leftSlots, @@ -183,15 +182,15 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (!checkPushDownPreconditionsForJoin(join, ctx, targetSlot)) { continue; } - Slot scanSlot = aliasTransferMap.get(targetSlot).second; - PhysicalRelation scan = aliasTransferMap.get(targetSlot).first; + Slot scanSlot = ctx.getAliasTransferPair(targetSlot).second; + PhysicalRelation scan = ctx.getAliasTransferPair(targetSlot).first; RuntimeFilter filter = new RuntimeFilter(generator.getNextId(), bitmapContains.child(0), ImmutableList.of(scanSlot), ImmutableList.of(bitmapContains.child(1)), type, i, join, isNot, -1L); scan.addAppliedRuntimeFilter(filter); ctx.addJoinToTargetMap(join, scanSlot.getExprId()); ctx.setTargetExprIdToFilter(scanSlot.getExprId(), filter); - ctx.setTargetsOnScanNode(aliasTransferMap.get(targetSlot).first, + ctx.setTargetsOnScanNode(ctx.getAliasTransferPair(targetSlot).first, scanSlot); join.addBitmapRuntimeFilterCondition(bitmapRuntimeFilterCondition); } @@ -246,7 +245,6 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { */ private void generateMinMaxRuntimeFilter(AbstractPhysicalJoin join, RuntimeFilterContext ctx) { - Map> aliasTransferMap = ctx.getAliasTransferMap(); int hashCondionSize = join.getHashJoinConjuncts().size(); for (int idx = 0; idx < join.getOtherJoinConjuncts().size(); idx++) { int exprOrder = idx + hashCondionSize; @@ -257,7 +255,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (unwrappedSlot == null) { continue; } - Pair pair = aliasTransferMap.get(unwrappedSlot); + Pair pair = ctx.getAliasTransferPair(unwrappedSlot); if (pair == null) { continue; } @@ -286,7 +284,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (RuntimeFilterGenerator.DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) { join.right().getOutput().forEach(slot -> - context.getRuntimeFilterContext().getAliasTransferMap().remove(slot)); + context.getRuntimeFilterContext().aliasTransferMapRemove(slot)); return join; } RuntimeFilterContext ctx = context.getRuntimeFilterContext(); @@ -310,8 +308,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { @Override public PhysicalPlan visitPhysicalProject(PhysicalProject project, CascadesContext context) { project.child().accept(this, context); - Map> aliasTransferMap - = context.getRuntimeFilterContext().getAliasTransferMap(); + RuntimeFilterContext ctx = context.getRuntimeFilterContext(); // change key when encounter alias. // TODO: same action will be taken for set operation for (Expression expression : project.getProjects()) { @@ -319,10 +316,11 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { continue; } Expression expr = ExpressionUtils.getExpressionCoveredByCast(expression.child(0)); - if (expr instanceof NamedExpression && aliasTransferMap.containsKey((NamedExpression) expr)) { + if (expr instanceof NamedExpression + && ctx.aliasTransferMapContains((NamedExpression) expr)) { if (expression instanceof Alias) { Alias alias = ((Alias) expression); - aliasTransferMap.put(alias.toSlot(), aliasTransferMap.get(expr)); + ctx.aliasTransferMapPut(alias.toSlot(), ctx.getAliasTransferPair((NamedExpression) expr)); } } } @@ -340,7 +338,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { public PhysicalRelation visitPhysicalRelation(PhysicalRelation relation, CascadesContext context) { // add all the slots in map. RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - relation.getOutput().forEach(slot -> ctx.getAliasTransferMap().put(slot, Pair.of(relation, slot))); + relation.getOutput().forEach(slot -> ctx.aliasTransferMapPut(slot, Pair.of(relation, slot))); return relation; } @@ -579,7 +577,6 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { private void doPushDownIntoCTEProducerInternal(PhysicalHashJoin join, RuntimeFilterContext ctx, EqualTo equalTo, TRuntimeFilterType type, PhysicalCTEProducer cteProducer) { - Map> aliasTransferMap = ctx.getAliasTransferMap(); PhysicalPlan inputPlanNode = (PhysicalPlan) cteProducer.child(0); Slot unwrappedSlot = checkTargetChild(equalTo.left()); // aliasTransMap doesn't contain the key, means that the path from the scan to the join @@ -587,8 +584,8 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (!checkPushDownPreconditionsForJoin(join, ctx, unwrappedSlot)) { return; } - Slot cteSlot = aliasTransferMap.get(unwrappedSlot).second; - PhysicalRelation cteNode = aliasTransferMap.get(unwrappedSlot).first; + Slot cteSlot = ctx.getAliasTransferPair(unwrappedSlot).second; + PhysicalRelation cteNode = ctx.getAliasTransferPair(unwrappedSlot).first; long buildSideNdv = getBuildSideNdv(join, equalTo); if (cteNode instanceof PhysicalCTEConsumer && inputPlanNode instanceof PhysicalProject) { PhysicalProject project = (PhysicalProject) inputPlanNode; @@ -608,7 +605,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { return; } else { Map pushDownBasicTableInfos = getPushDownBasicTablesInfos(project, - (SlotReference) targetExpr, aliasTransferMap); + (SlotReference) targetExpr, ctx); if (!pushDownBasicTableInfos.isEmpty()) { List targetList = new ArrayList<>(); List targetNodes = new ArrayList<>(); @@ -642,7 +639,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { topN.child().accept(this, context); PhysicalPlan child = (PhysicalPlan) topN.child(); for (Slot slot : child.getOutput()) { - context.getRuntimeFilterContext().getAliasTransferMap().remove(slot); + context.getRuntimeFilterContext().aliasTransferMapRemove(slot); } return topN; } @@ -652,7 +649,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { window.child().accept(this, context); Set commonPartitionKeys = window.getCommonPartitionKeyFromWindowExpressions(); window.child().getOutput().stream().filter(slot -> !commonPartitionKeys.contains(slot)).forEach( - slot -> context.getRuntimeFilterContext().getAliasTransferMap().remove(slot) + slot -> context.getRuntimeFilterContext().aliasTransferMapRemove(slot) ); return window; } @@ -662,8 +659,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { */ public static boolean checkPushDownPreconditionsForJoin(AbstractPhysicalJoin physicalJoin, RuntimeFilterContext ctx, Slot slot) { - Map> aliasTransferMap = ctx.getAliasTransferMap(); - if (slot == null || !aliasTransferMap.containsKey(slot)) { + if (slot == null || !ctx.aliasTransferMapContains(slot)) { return false; } else if (DENIED_JOIN_TYPES.contains(physicalJoin.getJoinType()) || physicalJoin.isMarkJoin()) { return false; @@ -695,12 +691,12 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { } private Map getPushDownBasicTablesInfos(PhysicalPlan root, SlotReference slot, - Map> aliasTransferMap) { + RuntimeFilterContext ctx) { Map basicTableInfos = new HashMap<>(); Set joins = new HashSet<>(); ExprId exprId = slot.getExprId(); - if (aliasTransferMap.get(slot) != null) { - basicTableInfos.put(slot, aliasTransferMap.get(slot).first); + if (ctx.getAliasTransferPair(slot) != null) { + basicTableInfos.put(slot, ctx.getAliasTransferPair(slot).first); } // try to find propagation condition from join getAllJoinInfo(root, joins); @@ -710,13 +706,13 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { if (equalTo instanceof EqualTo) { SlotReference leftSlot = (SlotReference) ((EqualTo) equalTo).left(); SlotReference rightSlot = (SlotReference) ((EqualTo) equalTo).right(); - if (leftSlot.getExprId() == exprId && aliasTransferMap.get(rightSlot) != null) { - PhysicalRelation rightTable = aliasTransferMap.get(rightSlot).first; + if (leftSlot.getExprId() == exprId && ctx.getAliasTransferPair(rightSlot) != null) { + PhysicalRelation rightTable = ctx.getAliasTransferPair(rightSlot).first; if (rightTable != null) { basicTableInfos.put(rightSlot, rightTable); } - } else if (rightSlot.getExprId() == exprId && aliasTransferMap.get(leftSlot) != null) { - PhysicalRelation leftTable = aliasTransferMap.get(leftSlot).first; + } else if (rightSlot.getExprId() == exprId && ctx.getAliasTransferPair(leftSlot) != null) { + PhysicalRelation leftTable = ctx.getAliasTransferPair(leftSlot).first; if (leftTable != null) { basicTableInfos.put(leftSlot, leftTable); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommute.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommute.java index 0491abd8f8..85ad5a5418 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommute.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommute.java @@ -114,9 +114,13 @@ public class JoinCommute extends OneExplorationRuleFactory { } private static boolean containJoin(GroupPlan groupPlan) { - // TODO: tmp way to judge containJoin - List output = groupPlan.getOutput(); - return !output.stream().map(Slot::getQualifier).allMatch(output.get(0).getQualifier()::equals); + if (groupPlan.getGroup().getStatistics() != null) { + return groupPlan.getGroup().getStatistics().getWidthInJoinCluster() > 1; + } else { + // tmp way to judge containJoin, just used for test case where stats is null + List output = groupPlan.getOutput(); + return !output.stream().map(Slot::getQualifier).allMatch(output.get(0).getQualifier()::equals); + } } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java index c086aaef5c..496a66f745 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java @@ -332,7 +332,7 @@ public class FilterEstimation extends ExpressionVisitor { @Override public Statistics visitLogicalJoin(LogicalJoin join, Void context) { - return JoinEstimation.estimate(groupExpression.childStatistics(0), + Statistics joinStats = JoinEstimation.estimate(groupExpression.childStatistics(0), groupExpression.childStatistics(1), join); + joinStats = new StatisticsBuilder(joinStats).setWidthInJoinCluster( + groupExpression.childStatistics(0).getWidthInJoinCluster() + + groupExpression.childStatistics(1).getWidthInJoinCluster()).build(); + return joinStats; } @Override @@ -555,6 +559,7 @@ public class StatsCalculator extends DefaultPlanVisitor { private Statistics computeAssertNumRows(long desiredNumOfRows) { Statistics statistics = groupExpression.childStatistics(0); statistics.withRowCountAndEnforceValid(Math.min(1, statistics.getRowCount())); + statistics = new StatisticsBuilder(statistics).setWidthInJoinCluster(1).build(); return statistics; } @@ -764,7 +769,7 @@ public class StatsCalculator extends DefaultPlanVisitor { builder.setDataSize(rowCount * outputExpression.getDataType().width()); slotToColumnStats.put(outputExpression.toSlot(), columnStat); } - return new Statistics(rowCount, slotToColumnStats); + return new Statistics(rowCount, 1, slotToColumnStats); // TODO: Update ColumnStats properly, add new mapping from output slot to ColumnStats } @@ -783,7 +788,7 @@ public class StatsCalculator extends DefaultPlanVisitor { .setDataSize(stats.dataSize < 0 ? stats.dataSize : stats.dataSize * groupingSetNum); return Pair.of(kv.getKey(), columnStatisticBuilder.build()); }).collect(Collectors.toMap(Pair::key, Pair::value)); - return new Statistics(rowCount < 0 ? rowCount : rowCount * groupingSetNum, columnStatisticMap); + return new Statistics(rowCount < 0 ? rowCount : rowCount * groupingSetNum, 1, columnStatisticMap); } private Statistics computeProject(Project project) { @@ -793,7 +798,7 @@ public class StatsCalculator extends DefaultPlanVisitor { ColumnStatistic columnStatistic = ExpressionEstimation.estimate(projection, childStats); return new SimpleEntry<>(projection.toSlot(), columnStatistic); }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (item1, item2) -> item1)); - return new Statistics(childStats.getRowCount(), columnsStats); + return new Statistics(childStats.getRowCount(), childStats.getWidthInJoinCluster(), columnsStats); } private Statistics computeOneRowRelation(List projects) { @@ -805,7 +810,7 @@ public class StatsCalculator extends DefaultPlanVisitor { }) .collect(Collectors.toMap(Pair::key, Pair::value)); int rowCount = 1; - return new Statistics(rowCount, columnStatsMap); + return new Statistics(rowCount, 1, columnStatsMap); } private Statistics computeEmptyRelation(EmptyRelation emptyRelation) { @@ -820,7 +825,7 @@ public class StatsCalculator extends DefaultPlanVisitor { }) .collect(Collectors.toMap(Pair::key, Pair::value)); int rowCount = 0; - return new Statistics(rowCount, columnStatsMap); + return new Statistics(rowCount, 1, columnStatsMap); } private Statistics computeUnion(Union union) { @@ -863,7 +868,7 @@ public class StatsCalculator extends DefaultPlanVisitor { statisticsBuilder.setRowCount(leftRowCount); statisticsBuilder.putColumnStatistics(unionOutput.get(i), headStats.findColumnStatistics(headSlot)); } - return statisticsBuilder.build(); + return statisticsBuilder.setWidthInJoinCluster(1).build(); } private Statistics computeExcept(SetOperation setOperation) { @@ -876,7 +881,7 @@ public class StatsCalculator extends DefaultPlanVisitor { statisticsBuilder.putColumnStatistics(operatorOutput.get(i), columnStatistic); } statisticsBuilder.setRowCount(leftStats.getRowCount()); - return statisticsBuilder.build(); + return statisticsBuilder.setWidthInJoinCluster(1).build(); } private Statistics computeIntersect(SetOperation setOperation) { @@ -903,7 +908,8 @@ public class StatsCalculator extends DefaultPlanVisitor { leftChildStats.addColumnStats(outputs.get(i), leftChildStats.findColumnStatistics(leftChildOutputs.get(i))); } - return leftChildStats.withRowCountAndEnforceValid(rowCount); + return new StatisticsBuilder(leftChildStats.withRowCountAndEnforceValid(rowCount)) + .setWidthInJoinCluster(1).build(); } private Statistics computeGenerate(Generate generate) { @@ -925,7 +931,7 @@ public class StatsCalculator extends DefaultPlanVisitor { .build(); columnStatsMap.put(output, columnStatistic); } - return new Statistics(count, columnStatsMap); + return new Statistics(count, 1, columnStatsMap); } private Statistics computeWindow(Window windowOperator) { @@ -994,7 +1000,7 @@ public class StatsCalculator extends DefaultPlanVisitor { return Pair.of(expr.toSlot(), colStatsBuilder.build()); }).collect(Collectors.toMap(Pair::key, Pair::value)); columnStatisticMap.putAll(childColumnStats); - return new Statistics(childStats.getRowCount(), columnStatisticMap); + return new Statistics(childStats.getRowCount(), 1, columnStatisticMap); } private ColumnStatistic unionColumn(ColumnStatistic leftStats, double leftRowCount, ColumnStatistic rightStats, @@ -1033,7 +1039,8 @@ public class StatsCalculator extends DefaultPlanVisitor { @Override public Statistics visitLogicalCTEProducer(LogicalCTEProducer cteProducer, Void context) { - Statistics statistics = groupExpression.childStatistics(0); + StatisticsBuilder builder = new StatisticsBuilder(groupExpression.childStatistics(0)); + Statistics statistics = builder.setWidthInJoinCluster(1).build(); cteIdToStats.put(cteProducer.getCteId(), statistics); return statistics; } @@ -1045,7 +1052,7 @@ public class StatsCalculator extends DefaultPlanVisitor { cteConsumer.getProducerToConsumerOutputMap()); Statistics prodStats = cteIdToStats.get(cteId); Preconditions.checkArgument(prodStats != null, String.format("Stats for CTE: %s not found", cteId)); - Statistics consumerStats = new Statistics(prodStats.getRowCount(), new HashMap<>()); + Statistics consumerStats = new Statistics(prodStats.getRowCount(), 1, new HashMap<>()); for (Slot slot : cteConsumer.getOutput()) { Slot prodSlot = cteConsumer.getProducerSlot(slot); ColumnStatistic colStats = prodStats.columnStatistics().get(prodSlot); @@ -1065,7 +1072,8 @@ public class StatsCalculator extends DefaultPlanVisitor { @Override public Statistics visitPhysicalCTEProducer(PhysicalCTEProducer cteProducer, Void context) { - Statistics statistics = groupExpression.childStatistics(0); + Statistics statistics = new StatisticsBuilder(groupExpression.childStatistics(0)) + .setWidthInJoinCluster(1).build(); cteIdToStats.put(cteProducer.getCteId(), statistics); cascadesContext.updateConsumerStats(cteProducer.getCteId(), statistics); return statistics; @@ -1081,7 +1089,7 @@ public class StatsCalculator extends DefaultPlanVisitor { prodStats = groupExpression.getOwnerGroup().getStatistics(); } Preconditions.checkArgument(prodStats != null, String.format("Stats for CTE: %s not found", cteId)); - Statistics consumerStats = new Statistics(prodStats.getRowCount(), new HashMap<>()); + Statistics consumerStats = new Statistics(prodStats.getRowCount(), 1, new HashMap<>()); for (Slot slot : cteConsumer.getOutput()) { Slot prodSlot = cteConsumer.getProducerSlot(slot); ColumnStatistic colStats = prodStats.columnStatistics().get(prodSlot); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java index 14aa44e794..5b668c0135 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java @@ -18,7 +18,6 @@ package org.apache.doris.nereids.trees.plans.physical; import org.apache.doris.common.IdGenerator; -import org.apache.doris.common.Pair; import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.memo.GroupExpression; import org.apache.doris.nereids.processor.post.RuntimeFilterContext; @@ -43,7 +42,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import java.util.List; -import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; @@ -85,7 +83,6 @@ public abstract class AbstractPhysicalPlan extends AbstractPlan implements Physi Expression src, Expression probeExpr, TRuntimeFilterType type, long buildSideNdv, int exprOrder) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map> aliasTransferMap = ctx.getAliasTransferMap(); // 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); @@ -106,8 +103,8 @@ public abstract class AbstractPhysicalPlan extends AbstractPlan implements Physi return true; } - Slot scanSlot = aliasTransferMap.get(probeSlot).second; - PhysicalRelation scan = aliasTransferMap.get(probeSlot).first; + Slot scanSlot = ctx.getAliasTransferPair(probeSlot).second; + PhysicalRelation scan = ctx.getAliasTransferPair(probeSlot).first; if (!RuntimeFilterGenerator.checkPushDownPreconditionsForRelation(this, scan)) { return false; } @@ -127,14 +124,14 @@ public abstract class AbstractPhysicalPlan extends AbstractPlan implements Physi filter.addTargetExpression(scanSlot); ctx.addJoinToTargetMap(builderNode, scanSlot.getExprId()); ctx.setTargetExprIdToFilter(scanSlot.getExprId(), filter); - ctx.setTargetsOnScanNode(aliasTransferMap.get(probeExpr).first, scanSlot); + ctx.setTargetsOnScanNode(ctx.getAliasTransferPair((NamedExpression) probeExpr).first, scanSlot); } else { filter = new RuntimeFilter(generator.getNextId(), src, ImmutableList.of(scanSlot), type, exprOrder, builderNode, buildSideNdv); this.addAppliedRuntimeFilter(filter); ctx.addJoinToTargetMap(builderNode, scanSlot.getExprId()); ctx.setTargetExprIdToFilter(scanSlot.getExprId(), filter); - ctx.setTargetsOnScanNode(aliasTransferMap.get(probeExpr).first, scanSlot); + ctx.setTargetsOnScanNode(ctx.getAliasTransferPair((NamedExpression) probeExpr).first, scanSlot); ctx.setRuntimeFilterIdentityToFilter(src, type, builderNode, filter); } return true; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java index 21833aa3c0..0a9955feb2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java @@ -18,7 +18,6 @@ package org.apache.doris.nereids.trees.plans.physical; import org.apache.doris.common.IdGenerator; -import org.apache.doris.common.Pair; import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.memo.GroupExpression; import org.apache.doris.nereids.processor.post.RuntimeFilterContext; @@ -27,7 +26,6 @@ import org.apache.doris.nereids.properties.DistributionSpec; import org.apache.doris.nereids.properties.LogicalProperties; import org.apache.doris.nereids.properties.PhysicalProperties; import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.PlanType; @@ -42,7 +40,6 @@ import com.google.common.collect.ImmutableList; import org.json.JSONObject; import java.util.List; -import java.util.Map; import java.util.Optional; /** @@ -134,7 +131,6 @@ public class PhysicalDistribute extends PhysicalUnary builderNode, Expression src, Expression probeExpr, TRuntimeFilterType type, long buildSideNdv, int exprOrder) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map> aliasTransferMap = ctx.getAliasTransferMap(); // 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); @@ -144,7 +140,7 @@ public class PhysicalDistribute extends PhysicalUnary extends PhysicalUnar AbstractPhysicalJoin builderNode, Expression src, Expression probeExpr, TRuntimeFilterType type, long buildSideNdv, int exprOrder) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map> aliasTransferMap = ctx.getAliasTransferMap(); // 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); @@ -308,7 +305,7 @@ public class PhysicalHashAggregate extends PhysicalUnar if (!RuntimeFilterGenerator.checkPushDownPreconditionsForJoin(builderNode, ctx, probeSlot)) { return false; } - PhysicalRelation scan = aliasTransferMap.get(probeSlot).first; + PhysicalRelation scan = ctx.getAliasTransferPair(probeSlot).first; if (!RuntimeFilterGenerator.checkPushDownPreconditionsForRelation(this, scan)) { return false; } 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 b62f0ff759..b1dd9a329c 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 @@ -30,7 +30,6 @@ import org.apache.doris.nereids.trees.expressions.EqualPredicate; import org.apache.doris.nereids.trees.expressions.ExprId; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.MarkJoinSlotReference; -import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.plans.JoinType; import org.apache.doris.nereids.trees.plans.Plan; @@ -47,7 +46,6 @@ import com.google.common.collect.Sets; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -188,7 +186,6 @@ public class PhysicalHashJoin< } } RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map> aliasTransferMap = ctx.getAliasTransferMap(); // if rf built between plan nodes containing cte both, for example both src slot and target slot are from cte, // or two sub-queries both containing cte, disable this rf since this kind of cross-cte rf will make one side @@ -239,7 +236,7 @@ public class PhysicalHashJoin< if (!RuntimeFilterGenerator.checkPushDownPreconditionsForJoin(builderNode, ctx, probeSlot)) { return false; } - PhysicalRelation scan = aliasTransferMap.get(probeSlot).first; + PhysicalRelation scan = ctx.getAliasTransferPair(probeSlot).first; if (!RuntimeFilterGenerator.checkPushDownPreconditionsForRelation(this, scan)) { return false; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java index 5066d2ad91..663bc26595 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java @@ -18,7 +18,6 @@ package org.apache.doris.nereids.trees.plans.physical; import org.apache.doris.common.IdGenerator; -import org.apache.doris.common.Pair; import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.memo.GroupExpression; import org.apache.doris.nereids.processor.post.RuntimeFilterContext; @@ -42,7 +41,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -162,7 +160,6 @@ public class PhysicalProject extends PhysicalUnary builderNode, Expression src, Expression probeExpr, TRuntimeFilterType type, long buildSideNdv, int exprOrder) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map> aliasTransferMap = ctx.getAliasTransferMap(); // 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); @@ -172,7 +169,7 @@ public class PhysicalProject extends PhysicalUnary extends PhysicalUnary expressionToColumnStats; + private final int widthInJoinCluster; // the byte size of one tuple private double tupleSize; - public Statistics(Statistics another) { - this.rowCount = another.rowCount; - this.expressionToColumnStats = new HashMap<>(another.expressionToColumnStats); - this.tupleSize = another.tupleSize; + public Statistics(double rowCount, Map expressionToColumnStats) { + this(rowCount, 1, expressionToColumnStats); } - public Statistics(double rowCount, Map expressionToColumnStats) { + public Statistics(double rowCount, int widthInJoinCluster, + Map expressionToColumnStats) { this.rowCount = rowCount; + this.widthInJoinCluster = widthInJoinCluster; this.expressionToColumnStats = expressionToColumnStats; } @@ -61,14 +62,14 @@ public class Statistics { } public Statistics withRowCount(double rowCount) { - return new Statistics(rowCount, new HashMap<>(expressionToColumnStats)); + return new Statistics(rowCount, widthInJoinCluster, new HashMap<>(expressionToColumnStats)); } /** * Update by count. */ public Statistics withRowCountAndEnforceValid(double rowCount) { - Statistics statistics = new Statistics(rowCount, expressionToColumnStats); + Statistics statistics = new Statistics(rowCount, widthInJoinCluster, expressionToColumnStats); statistics.enforceValid(); return statistics; } @@ -99,7 +100,7 @@ public class Statistics { return this; } double newCount = rowCount * sel; - return new Statistics(newCount, new HashMap<>(expressionToColumnStats)); + return new Statistics(newCount, widthInJoinCluster, new HashMap<>(expressionToColumnStats)); } public Statistics addColumnStats(Expression expression, ColumnStatistic columnStatistic) { @@ -146,7 +147,7 @@ public class Statistics { return "-Infinite"; } DecimalFormat format = new DecimalFormat("#,###.##"); - return format.format(rowCount); + return format.format(rowCount) + " " + widthInJoinCluster; } public int getBENumber() { @@ -181,10 +182,14 @@ public class Statistics { StringBuilder builder = new StringBuilder(); builder.append(prefix).append("rows=").append(rowCount).append("\n"); builder.append(prefix).append("tupleSize=").append(computeTupleSize()).append("\n"); - + builder.append(prefix).append("width=").append(widthInJoinCluster).append("\n"); for (Entry entry : expressionToColumnStats.entrySet()) { builder.append(prefix).append(entry.getKey()).append(" -> ").append(entry.getValue()).append("\n"); } return builder.toString(); } + + public int getWidthInJoinCluster() { + return widthInJoinCluster; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsBuilder.java index a0e75f7df3..53d8f49cb1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsBuilder.java @@ -25,7 +25,7 @@ import java.util.Map; public class StatisticsBuilder { private double rowCount; - + private int widthInJoinCluster; private final Map expressionToColumnStats; public StatisticsBuilder() { @@ -34,6 +34,7 @@ public class StatisticsBuilder { public StatisticsBuilder(Statistics statistics) { this.rowCount = statistics.getRowCount(); + this.widthInJoinCluster = statistics.getWidthInJoinCluster(); expressionToColumnStats = new HashMap<>(); expressionToColumnStats.putAll(statistics.columnStatistics()); } @@ -43,6 +44,11 @@ public class StatisticsBuilder { return this; } + public StatisticsBuilder setWidthInJoinCluster(int widthInJoinCluster) { + this.widthInJoinCluster = widthInJoinCluster; + return this; + } + public StatisticsBuilder putColumnStatistics( Map expressionToColumnStats) { this.expressionToColumnStats.putAll(expressionToColumnStats); @@ -55,6 +61,6 @@ public class StatisticsBuilder { } public Statistics build() { - return new Statistics(rowCount, expressionToColumnStats); + return new Statistics(rowCount, widthInJoinCluster, expressionToColumnStats); } } diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out index dcec484dfd..135190f5ce 100644 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out +++ b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out @@ -89,12 +89,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((count_t.score > 10)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_outer_join -- PhysicalResultSink @@ -112,12 +112,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((count_t.score > 10)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_having -- PhysicalResultSink @@ -226,12 +226,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((t1.score > 50)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_varied_aggregates -- PhysicalResultSink @@ -297,10 +297,10 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] ------------hashAgg[LOCAL] ---------------filter((count_t.score > 20) and (t1.id < 100)) +--------------filter((count_t.id < 100)) ----------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] ---------------filter((count_t.id < 100)) +--------------filter((count_t.score > 20) and (t1.id < 100)) ----------------PhysicalOlapScan[count_t] -- !groupby_pushdown_basic -- @@ -395,12 +395,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((count_t.score > 10)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_outer_join -- PhysicalResultSink @@ -418,12 +418,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((count_t.score > 10)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_having -- PhysicalResultSink @@ -500,12 +500,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((t1.score > 50)) ----------------PhysicalOlapScan[count_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[count_t] -- !groupby_pushdown_varied_aggregates -- PhysicalResultSink @@ -549,9 +549,9 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] ------------hashAgg[LOCAL] ---------------filter((count_t.score > 20) and (t1.id < 100)) +--------------filter((count_t.id < 100)) ----------------PhysicalOlapScan[count_t] apply RFs: RF0 ------------hashAgg[LOCAL] ---------------filter((count_t.id < 100)) +--------------filter((count_t.score > 20) and (t1.id < 100)) ----------------PhysicalOlapScan[count_t] diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out index d74b311df9..1e497ebd80 100644 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out +++ b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out @@ -89,12 +89,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[sum_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((sum_t.score > 10)) ----------------PhysicalOlapScan[sum_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[sum_t] -- !groupby_pushdown_outer_join -- PhysicalResultSink @@ -112,12 +112,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[sum_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((sum_t.score > 10)) ----------------PhysicalOlapScan[sum_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[sum_t] -- !groupby_pushdown_having -- PhysicalResultSink @@ -224,12 +224,12 @@ PhysicalResultSink ----hashAgg[GLOBAL] ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] +------------hashAgg[LOCAL] +--------------PhysicalOlapScan[sum_t] apply RFs: RF0 ------------hashAgg[LOCAL] --------------filter((t1.score > 50)) ----------------PhysicalOlapScan[sum_t] -------------hashAgg[LOCAL] ---------------PhysicalOlapScan[sum_t] -- !groupby_pushdown_varied_aggregates -- PhysicalResultSink @@ -295,9 +295,9 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] ------------hashAgg[LOCAL] ---------------filter((sum_t.score > 20) and (t1.id < 100)) +--------------filter((sum_t.id < 100)) ----------------PhysicalOlapScan[sum_t] apply RFs: RF0 ------------hashAgg[LOCAL] ---------------filter((sum_t.id < 100)) +--------------filter((sum_t.score > 20) and (t1.id < 100)) ----------------PhysicalOlapScan[sum_t] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query10.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query10.out index 73add01541..49d24a004d 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query10.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query10.out @@ -13,28 +13,28 @@ PhysicalResultSink --------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() ----------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() ------------------------PhysicalProject ---------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk] -----------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[c_current_addr_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalDistribute[DistributionSpecReplicated] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2001)) +----------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF5 +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------PhysicalOlapScan[customer_demographics] +----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2001)) -----------------------------------------PhysicalOlapScan[date_dim] -----------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk] -------------------------------------PhysicalProject ---------------------------------------PhysicalOlapScan[customer] apply RFs: RF2 -------------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------------PhysicalProject -----------------------------------------filter(ca_county IN ('Cochran County', 'Kandiyohi County', 'Marquette County', 'Storey County', 'Warren County')) -------------------------------------------PhysicalOlapScan[customer_address] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------------filter(ca_county IN ('Cochran County', 'Kandiyohi County', 'Marquette County', 'Storey County', 'Warren County')) +----------------------------------PhysicalOlapScan[customer_address] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query35.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query35.out index b6c9c4373e..a849eb675a 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query35.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query35.out @@ -13,29 +13,29 @@ PhysicalResultSink --------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() ----------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() ------------------------PhysicalProject ---------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() -----------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) -----------------------------------------PhysicalOlapScan[date_dim] +--------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() ----------------------------PhysicalDistribute[DistributionSpecHash] ------------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() --------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() +----------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() +------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalProject +----------------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) +------------------------------------------------PhysicalOlapScan[date_dim] ------------------------------------PhysicalDistribute[DistributionSpecHash] --------------------------------------PhysicalProject ----------------------------------------PhysicalOlapScan[customer] -------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[customer_address] --------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------PhysicalProject ------------------------------------PhysicalOlapScan[customer_demographics] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer_address] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query44.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query44.out index 3f377d4f21..069f7230ce 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query44.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query44.out @@ -5,71 +5,68 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] +------------PhysicalProject +--------------PhysicalOlapScan[item] apply RFs: RF1 ------------PhysicalDistribute[DistributionSpecHash] --------------PhysicalProject -----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() +----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] ---------------------PhysicalProject -----------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------filter((rnk < 11)) -------------------------------PhysicalWindow ---------------------------------PhysicalQuickSort[MERGE_SORT] -----------------------------------PhysicalDistribute[DistributionSpecGather] -------------------------------------PhysicalQuickSort[LOCAL_SORT] ---------------------------------------PhysicalPartitionTopN -----------------------------------------PhysicalProject -------------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) ---------------------------------------------PhysicalProject -----------------------------------------------hashAgg[GLOBAL] -------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------PhysicalProject -------------------------------------------------------filter((ss1.ss_store_sk = 146)) ---------------------------------------------------------PhysicalOlapScan[store_sales] ---------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------------------PhysicalAssertNumRows -------------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter((rnk < 11)) +----------------------------PhysicalWindow +------------------------------PhysicalQuickSort[MERGE_SORT] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalQuickSort[LOCAL_SORT] +------------------------------------PhysicalPartitionTopN +--------------------------------------PhysicalProject +----------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +------------------------------------------PhysicalProject +--------------------------------------------hashAgg[GLOBAL] +----------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------hashAgg[LOCAL] --------------------------------------------------PhysicalProject -----------------------------------------------------hashAgg[GLOBAL] -------------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------------PhysicalProject -------------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) ---------------------------------------------------------------PhysicalOlapScan[store_sales] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------filter((rnk < 11)) -------------------------------PhysicalWindow ---------------------------------PhysicalQuickSort[MERGE_SORT] -----------------------------------PhysicalDistribute[DistributionSpecGather] -------------------------------------PhysicalQuickSort[LOCAL_SORT] ---------------------------------------PhysicalPartitionTopN -----------------------------------------PhysicalProject -------------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) ---------------------------------------------PhysicalProject -----------------------------------------------hashAgg[GLOBAL] -------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------PhysicalProject -------------------------------------------------------filter((ss1.ss_store_sk = 146)) ---------------------------------------------------------PhysicalOlapScan[store_sales] ---------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------------------PhysicalAssertNumRows -------------------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------------------filter((ss1.ss_store_sk = 146)) +------------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalAssertNumRows +----------------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------------PhysicalProject +--------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +------------------------------------------------------------PhysicalOlapScan[store_sales] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter((rnk < 11)) +----------------------------PhysicalWindow +------------------------------PhysicalQuickSort[MERGE_SORT] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalQuickSort[LOCAL_SORT] +------------------------------------PhysicalPartitionTopN +--------------------------------------PhysicalProject +----------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +------------------------------------------PhysicalProject +--------------------------------------------hashAgg[GLOBAL] +----------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------hashAgg[LOCAL] --------------------------------------------------PhysicalProject -----------------------------------------------------hashAgg[GLOBAL] -------------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------------PhysicalProject -------------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) ---------------------------------------------------------------PhysicalOlapScan[store_sales] -------------------PhysicalDistribute[DistributionSpecHash] ---------------------PhysicalProject -----------------------PhysicalOlapScan[item] -------------PhysicalDistribute[DistributionSpecHash] ---------------PhysicalProject -----------------PhysicalOlapScan[item] +----------------------------------------------------filter((ss1.ss_store_sk = 146)) +------------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalAssertNumRows +----------------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------------PhysicalProject +--------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +------------------------------------------------------------PhysicalOlapScan[store_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out index d90709a513..12c4bec36a 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out @@ -19,30 +19,31 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------PhysicalDistribute[DistributionSpecGather] ----------PhysicalTopN[LOCAL_SORT] ------------PhysicalProject ---------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF4 s_store_id2->[s_store_id];RF5 s_store_sk->[ss_store_sk] +--------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] ---------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq] -----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq] -------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=() ---------------------------PhysicalDistribute[DistributionSpecHash] +------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF3 s_store_id1->[s_store_id];RF4 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq] +--------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=() +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208)) +--------------------------------PhysicalOlapScan[date_dim] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject -----------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208)) -------------------------------PhysicalOlapScan[date_dim] -----------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------PhysicalProject ---------------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196)) -----------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalOlapScan[store] apply RFs: RF3 --------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------PhysicalProject -------------------------PhysicalOlapScan[store] apply RFs: RF4 +------------------------PhysicalOlapScan[store] ----------------PhysicalDistribute[DistributionSpecReplicated] ------------------PhysicalProject ---------------------PhysicalOlapScan[store] +--------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196)) +----------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query69.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query69.out index 778ab2fd4e..449d29bf0c 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query69.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query69.out @@ -9,48 +9,49 @@ PhysicalResultSink ------------PhysicalDistribute[DistributionSpecHash] --------------hashAgg[LOCAL] ----------------PhysicalProject -------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] +------------------hashJoin[LEFT_ANTI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() --------------------PhysicalDistribute[DistributionSpecHash] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[c_current_addr_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashJoin[LEFT_ANTI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +--------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalDistribute[DistributionSpecReplicated] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) +----------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF5 +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------PhysicalProject +------------------------------filter(ca_state IN ('MI', 'TX', 'VA')) +--------------------------------PhysicalOlapScan[customer_address] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] --------------------------PhysicalProject -----------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 --------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------PhysicalProject ------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) --------------------------------PhysicalOlapScan[date_dim] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[cs_ship_customer_sk] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 -------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------PhysicalProject -----------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) -------------------------------------PhysicalOlapScan[date_dim] -------------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ws_bill_customer_sk] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] ---------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 ---------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) ---------------------------------------PhysicalOlapScan[date_dim] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() -------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter(ca_state IN ('MI', 'TX', 'VA')) -----------------------------------------PhysicalOlapScan[customer_address] -------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[customer_demographics] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out index b54e3c5c0e..4c4fbb34f6 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out @@ -3,13 +3,13 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalCteProducer ( cteId=CTEId#0 ) ----PhysicalProject -------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number] +------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) --------PhysicalDistribute[DistributionSpecHash] ----------PhysicalProject -------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF6 RF7 +------------PhysicalOlapScan[web_sales] --------PhysicalDistribute[DistributionSpecHash] ----------PhysicalProject -------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 +------------PhysicalOlapScan[web_sales] --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] @@ -19,35 +19,35 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------hashAgg[GLOBAL] ----------------hashAgg[LOCAL] ------------------PhysicalProject ---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF7 wr_order_number->[ws_order_number,ws_order_number] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalOlapScan[web_returns] -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF6 ws_order_number->[ws_order_number,ws_order_number] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF5 web_site_sk->[ws_web_site_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[ws_ship_addr_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_ship_date_sk] +----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF2 ws_order_number->[wr_order_number] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF1 wr_order_number->[ws_order_number] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF2 +------------------------------PhysicalDistribute[DistributionSpecHash] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 ---------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) ---------------------------------------PhysicalOlapScan[date_dim] -------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------PhysicalProject -----------------------------------filter((customer_address.ca_state = 'NC')) -------------------------------------PhysicalOlapScan[customer_address] +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 RF4 RF5 ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalProject ---------------------------------filter((web_site.web_company_name = 'pri')) -----------------------------------PhysicalOlapScan[web_site] +--------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_state = 'NC')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------PhysicalProject +----------------------------filter((web_site.web_company_name = 'pri')) +------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query10.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query10.out index 6a46828f0a..9e185b3a54 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query10.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query10.out @@ -13,28 +13,28 @@ PhysicalResultSink --------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() ----------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() ------------------------PhysicalProject ---------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk] -----------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[c_current_addr_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[c_current_cdemo_sk] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalDistribute[DistributionSpecReplicated] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2001)) +----------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------PhysicalOlapScan[customer_demographics] +----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2001)) -----------------------------------------PhysicalOlapScan[date_dim] -----------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF3 cd_demo_sk->[c_current_cdemo_sk] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk] -------------------------------------PhysicalProject ---------------------------------------PhysicalOlapScan[customer] apply RFs: RF2 RF3 -------------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------------PhysicalProject -----------------------------------------filter(ca_county IN ('Cochran County', 'Kandiyohi County', 'Marquette County', 'Storey County', 'Warren County')) -------------------------------------------PhysicalOlapScan[customer_address] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------------filter(ca_county IN ('Cochran County', 'Kandiyohi County', 'Marquette County', 'Storey County', 'Warren County')) +----------------------------------PhysicalOlapScan[customer_address] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query35.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query35.out index c967d42e5e..03410c1b28 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query35.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query35.out @@ -13,29 +13,29 @@ PhysicalResultSink --------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() ----------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() ------------------------PhysicalProject ---------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[c_current_addr_sk] ----------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) -----------------------------------------PhysicalOlapScan[date_dim] -----------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF3 cd_demo_sk->[c_current_cdemo_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[c_current_cdemo_sk] --------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk] +----------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] ------------------------------------PhysicalDistribute[DistributionSpecHash] --------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[customer] apply RFs: RF2 RF3 +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalProject +----------------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) +------------------------------------------------PhysicalOlapScan[date_dim] ------------------------------------PhysicalDistribute[DistributionSpecHash] --------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[customer_address] +----------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 --------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------PhysicalProject ------------------------------------PhysicalOlapScan[customer_demographics] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer_address] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query44.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query44.out index 3f377d4f21..069f7230ce 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query44.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query44.out @@ -5,71 +5,68 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] +------------PhysicalProject +--------------PhysicalOlapScan[item] apply RFs: RF1 ------------PhysicalDistribute[DistributionSpecHash] --------------PhysicalProject -----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() +----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] ---------------------PhysicalProject -----------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------filter((rnk < 11)) -------------------------------PhysicalWindow ---------------------------------PhysicalQuickSort[MERGE_SORT] -----------------------------------PhysicalDistribute[DistributionSpecGather] -------------------------------------PhysicalQuickSort[LOCAL_SORT] ---------------------------------------PhysicalPartitionTopN -----------------------------------------PhysicalProject -------------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) ---------------------------------------------PhysicalProject -----------------------------------------------hashAgg[GLOBAL] -------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------PhysicalProject -------------------------------------------------------filter((ss1.ss_store_sk = 146)) ---------------------------------------------------------PhysicalOlapScan[store_sales] ---------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------------------PhysicalAssertNumRows -------------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter((rnk < 11)) +----------------------------PhysicalWindow +------------------------------PhysicalQuickSort[MERGE_SORT] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalQuickSort[LOCAL_SORT] +------------------------------------PhysicalPartitionTopN +--------------------------------------PhysicalProject +----------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +------------------------------------------PhysicalProject +--------------------------------------------hashAgg[GLOBAL] +----------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------hashAgg[LOCAL] --------------------------------------------------PhysicalProject -----------------------------------------------------hashAgg[GLOBAL] -------------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------------PhysicalProject -------------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) ---------------------------------------------------------------PhysicalOlapScan[store_sales] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------filter((rnk < 11)) -------------------------------PhysicalWindow ---------------------------------PhysicalQuickSort[MERGE_SORT] -----------------------------------PhysicalDistribute[DistributionSpecGather] -------------------------------------PhysicalQuickSort[LOCAL_SORT] ---------------------------------------PhysicalPartitionTopN -----------------------------------------PhysicalProject -------------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) ---------------------------------------------PhysicalProject -----------------------------------------------hashAgg[GLOBAL] -------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------PhysicalProject -------------------------------------------------------filter((ss1.ss_store_sk = 146)) ---------------------------------------------------------PhysicalOlapScan[store_sales] ---------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------------------PhysicalAssertNumRows -------------------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------------------filter((ss1.ss_store_sk = 146)) +------------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalAssertNumRows +----------------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------------PhysicalProject +--------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +------------------------------------------------------------PhysicalOlapScan[store_sales] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter((rnk < 11)) +----------------------------PhysicalWindow +------------------------------PhysicalQuickSort[MERGE_SORT] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalQuickSort[LOCAL_SORT] +------------------------------------PhysicalPartitionTopN +--------------------------------------PhysicalProject +----------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +------------------------------------------PhysicalProject +--------------------------------------------hashAgg[GLOBAL] +----------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------hashAgg[LOCAL] --------------------------------------------------PhysicalProject -----------------------------------------------------hashAgg[GLOBAL] -------------------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------------------hashAgg[LOCAL] -----------------------------------------------------------PhysicalProject -------------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) ---------------------------------------------------------------PhysicalOlapScan[store_sales] -------------------PhysicalDistribute[DistributionSpecHash] ---------------------PhysicalProject -----------------------PhysicalOlapScan[item] -------------PhysicalDistribute[DistributionSpecHash] ---------------PhysicalProject -----------------PhysicalOlapScan[item] +----------------------------------------------------filter((ss1.ss_store_sk = 146)) +------------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------------------------PhysicalAssertNumRows +----------------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------------PhysicalProject +--------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +------------------------------------------------------------PhysicalOlapScan[store_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out index 19678a1f4d..24bd0aea7b 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out @@ -19,30 +19,31 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------PhysicalDistribute[DistributionSpecGather] ----------PhysicalTopN[LOCAL_SORT] ------------PhysicalProject ---------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF4 s_store_id2->[s_store_id];RF5 s_store_sk->[ss_store_sk] +--------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] ---------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq] -----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq] -------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=() ---------------------------PhysicalDistribute[DistributionSpecHash] +------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF3 s_store_id1->[s_store_id];RF4 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq] +--------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=() +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208)) +--------------------------------PhysicalOlapScan[date_dim] ------------------------PhysicalDistribute[DistributionSpecReplicated] --------------------------PhysicalProject -----------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208)) -------------------------------PhysicalOlapScan[date_dim] -----------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------PhysicalProject ---------------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196)) -----------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalOlapScan[store] apply RFs: RF3 --------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------PhysicalProject -------------------------PhysicalOlapScan[store] apply RFs: RF4 +------------------------PhysicalOlapScan[store] ----------------PhysicalDistribute[DistributionSpecReplicated] ------------------PhysicalProject ---------------------PhysicalOlapScan[store] +--------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196)) +----------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query69.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query69.out index 3ab0b1efc3..a87c023aa6 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query69.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query69.out @@ -9,48 +9,49 @@ PhysicalResultSink ------------PhysicalDistribute[DistributionSpecHash] --------------hashAgg[LOCAL] ----------------PhysicalProject -------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] +------------------hashJoin[LEFT_ANTI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() --------------------PhysicalDistribute[DistributionSpecHash] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[c_current_addr_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[c_current_cdemo_sk] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashJoin[LEFT_ANTI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +--------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalDistribute[DistributionSpecReplicated] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) +----------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------PhysicalProject +------------------------------filter(ca_state IN ('MI', 'TX', 'VA')) +--------------------------------PhysicalOlapScan[customer_address] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] --------------------------PhysicalProject -----------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 --------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------PhysicalProject ------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) --------------------------------PhysicalOlapScan[date_dim] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[cs_ship_customer_sk] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 -------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------PhysicalProject -----------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) -------------------------------------PhysicalOlapScan[date_dim] -------------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ws_bill_customer_sk] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] ---------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 ---------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2000)) ---------------------------------------PhysicalOlapScan[date_dim] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------hashJoin[INNER_JOIN] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[c_current_cdemo_sk] -------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 RF1 -----------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------PhysicalProject ---------------------------------------filter(ca_state IN ('MI', 'TX', 'VA')) -----------------------------------------PhysicalOlapScan[customer_address] -------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[customer_demographics] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out index b54e3c5c0e..1ce11a6c98 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out @@ -6,10 +6,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number] --------PhysicalDistribute[DistributionSpecHash] ----------PhysicalProject -------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF6 RF7 +------------PhysicalOlapScan[web_sales] apply RFs: RF0 --------PhysicalDistribute[DistributionSpecHash] ----------PhysicalProject -------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 +------------PhysicalOlapScan[web_sales] --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] @@ -19,35 +19,35 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------hashAgg[GLOBAL] ----------------hashAgg[LOCAL] ------------------PhysicalProject ---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF7 wr_order_number->[ws_order_number,ws_order_number] ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ---------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------PhysicalProject -------------------------------PhysicalOlapScan[web_returns] -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF6 ws_order_number->[ws_order_number,ws_order_number] -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------PhysicalProject -----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF5 web_site_sk->[ws_web_site_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[ws_ship_addr_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_ship_date_sk] +----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF2 ws_order_number->[wr_order_number] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF1 wr_order_number->[ws_order_number] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF2 +------------------------------PhysicalDistribute[DistributionSpecHash] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 ---------------------------------PhysicalDistribute[DistributionSpecReplicated] -----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) ---------------------------------------PhysicalOlapScan[date_dim] -------------------------------PhysicalDistribute[DistributionSpecReplicated] ---------------------------------PhysicalProject -----------------------------------filter((customer_address.ca_state = 'NC')) -------------------------------------PhysicalOlapScan[customer_address] +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 RF4 RF5 ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalProject ---------------------------------filter((web_site.web_company_name = 'pri')) -----------------------------------PhysicalOlapScan[web_site] +--------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_state = 'NC')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalDistribute[DistributionSpecReplicated] +--------------------------PhysicalProject +----------------------------filter((web_site.web_company_name = 'pri')) +------------------------------PhysicalOlapScan[web_site]