From 873e55de1fd16083798850022d2589e62dd75bd1 Mon Sep 17 00:00:00 2001 From: starocean999 <12095047@qq.com> Date: Mon, 18 Mar 2024 19:20:23 +0800 Subject: [PATCH 1/4] [enhancement](nereids)show user friendly error message when item in select list but not in aggregate node's output --- .../rules/analysis/NormalizeAggregate.java | 23 +++++++++ .../nereids_p0/aggregate/agg_error_msg.groovy | 50 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 regression-test/suites/nereids_p0/aggregate/agg_error_msg.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java index 1105fe2da72be1..e8f86ae9615dc7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java @@ -23,6 +23,7 @@ import org.apache.doris.nereids.rules.rewrite.NormalizeToSlot; import org.apache.doris.nereids.rules.rewrite.RewriteRuleFactory; import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.ExprId; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; @@ -49,6 +50,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * normalize aggregate's group keys and AggregateFunction's child to SlotReference @@ -244,6 +246,20 @@ private LogicalPlan normalizeAgg(LogicalAggregate aggregate, Optional project = new LogicalProject<>(upperProjects, newAggregate); + // verify project used slots are all coming from agg's output + List slots = collectAllUsedSlots(upperProjects); + if (!slots.isEmpty()) { + Set aggOutput = normalizedAggOutput.stream() + .map(NamedExpression::getExprId) + .collect(Collectors.toSet()); + slots = slots.stream() + .filter(s -> !aggOutput.contains(s.getExprId())) + .collect(Collectors.toList()); + if (!slots.isEmpty()) { + throw new AnalysisException(String.format("%s not in aggregate's output", slots + .stream().map(NamedExpression::getName).collect(Collectors.joining(", ")))); + } + } if (having.isPresent()) { if (upperProjects.stream().anyMatch(expr -> expr.anyMatch(WindowExpression.class::isInstance))) { // when project contains window functions, in order to get the correct result @@ -287,4 +303,11 @@ private List normalizeOutput(List aggregateOut } return builder.build(); } + + private List collectAllUsedSlots(List expressions) { + return Stream.concat( + ExpressionUtils.collectAll(expressions, SubqueryExpr.class::isInstance).stream() + .flatMap(expr -> ((SubqueryExpr) expr).getCorrelateSlots().stream()), + ExpressionUtils.getInputSlotSet(expressions).stream()).collect(Collectors.toList()); + } } diff --git a/regression-test/suites/nereids_p0/aggregate/agg_error_msg.groovy b/regression-test/suites/nereids_p0/aggregate/agg_error_msg.groovy new file mode 100644 index 00000000000000..0b807be9d3add2 --- /dev/null +++ b/regression-test/suites/nereids_p0/aggregate/agg_error_msg.groovy @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("agg_error_msg") { + sql "SET enable_nereids_planner=true" + sql "SET enable_fallback_to_original_planner=false" + sql "DROP TABLE IF EXISTS table_20_undef_partitions2_keys3_properties4_distributed_by58;" + sql """ + create table table_20_undef_partitions2_keys3_properties4_distributed_by58 ( + pk int, + col_int_undef_signed int , + col_int_undef_signed2 int + ) engine=olap + DUPLICATE KEY(pk, col_int_undef_signed) + distributed by hash(pk) buckets 10 + properties("replication_num" = "1"); + """ + + sql "DROP TABLE IF EXISTS table_20_undef_partitions2_keys3_properties4_distributed_by53;" + sql """ + create table table_20_undef_partitions2_keys3_properties4_distributed_by53 ( + pk int, + col_int_undef_signed int , + col_int_undef_signed2 int + ) engine=olap + DUPLICATE KEY(pk, col_int_undef_signed) + distributed by hash(pk) buckets 10 + properties("replication_num" = "1"); + """ + test { + sql """SELECT col_int_undef_signed2 col_alias1, col_int_undef_signed * (SELECT MAX (col_int_undef_signed) FROM table_20_undef_partitions2_keys3_properties4_distributed_by58 where table_20_undef_partitions2_keys3_properties4_distributed_by53.pk = pk) AS col_alias2 FROM table_20_undef_partitions2_keys3_properties4_distributed_by53 GROUP BY GROUPING SETS ((col_int_undef_signed2),()) ;""" + exception "pk, col_int_undef_signed not in aggregate's output"; + } +} From 2272bb09fe4fdd3816e7955276ab675f95e32386 Mon Sep 17 00:00:00 2001 From: starocean999 <12095047@qq.com> Date: Thu, 21 Mar 2024 18:07:22 +0800 Subject: [PATCH 2/4] update code --- .../rules/analysis/NormalizeAggregate.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java index e8f86ae9615dc7..c9bb4466732485 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java @@ -50,7 +50,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * normalize aggregate's group keys and AggregateFunction's child to SlotReference @@ -249,12 +248,18 @@ private LogicalPlan normalizeAgg(LogicalAggregate aggregate, Optional slots = collectAllUsedSlots(upperProjects); if (!slots.isEmpty()) { - Set aggOutput = normalizedAggOutput.stream() - .map(NamedExpression::getExprId) - .collect(Collectors.toSet()); - slots = slots.stream() - .filter(s -> !aggOutput.contains(s.getExprId())) - .collect(Collectors.toList()); + ImmutableSet.Builder aggOutput = ImmutableSet.builder(); + for (NamedExpression expression : normalizedAggOutput) { + aggOutput.add(expression.getExprId()); + } + ImmutableSet aggOutputExprIds = aggOutput.build(); + ImmutableList.Builder errorSlots = ImmutableList.builder(); + for (Slot slot : slots) { + if (!aggOutputExprIds.contains(slot.getExprId())) { + errorSlots.add(slot); + } + } + slots = errorSlots.build(); if (!slots.isEmpty()) { throw new AnalysisException(String.format("%s not in aggregate's output", slots .stream().map(NamedExpression::getName).collect(Collectors.joining(", ")))); @@ -305,9 +310,12 @@ private List normalizeOutput(List aggregateOut } private List collectAllUsedSlots(List expressions) { - return Stream.concat( - ExpressionUtils.collectAll(expressions, SubqueryExpr.class::isInstance).stream() - .flatMap(expr -> ((SubqueryExpr) expr).getCorrelateSlots().stream()), - ExpressionUtils.getInputSlotSet(expressions).stream()).collect(Collectors.toList()); + List subqueries = ExpressionUtils.collectAll(expressions, SubqueryExpr.class::isInstance); + ImmutableList.Builder slots = ImmutableList.builder(); + for (SubqueryExpr subqueryExpr : subqueries) { + slots.addAll(subqueryExpr.getCorrelateSlots()); + } + slots.addAll(ExpressionUtils.getInputSlotSet(expressions)); + return slots.build(); } } From 216114ad3998622f5002b23f4d0fa7a749bf99ee Mon Sep 17 00:00:00 2001 From: starocean999 <12095047@qq.com> Date: Fri, 22 Mar 2024 18:30:50 +0800 Subject: [PATCH 3/4] fix bug --- .../rules/analysis/NormalizeAggregate.java | 29 +++++++++++-------- .../aggregate/agg_window_project.out | 4 +++ .../aggregate/agg_window_project.groovy | 2 ++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java index c9bb4466732485..6f668611b9c4ba 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java @@ -44,6 +44,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -248,27 +249,30 @@ private LogicalPlan normalizeAgg(LogicalAggregate aggregate, Optional slots = collectAllUsedSlots(upperProjects); if (!slots.isEmpty()) { - ImmutableSet.Builder aggOutput = ImmutableSet.builder(); + Set aggOutputExprIds = new HashSet<>(slots.size()); for (NamedExpression expression : normalizedAggOutput) { - aggOutput.add(expression.getExprId()); + aggOutputExprIds.add(expression.getExprId()); } - ImmutableSet aggOutputExprIds = aggOutput.build(); - ImmutableList.Builder errorSlots = ImmutableList.builder(); + List errorSlots = new ArrayList<>(slots.size()); for (Slot slot : slots) { if (!aggOutputExprIds.contains(slot.getExprId())) { errorSlots.add(slot); } } - slots = errorSlots.build(); - if (!slots.isEmpty()) { - throw new AnalysisException(String.format("%s not in aggregate's output", slots + if (!errorSlots.isEmpty()) { + throw new AnalysisException(String.format("%s not in aggregate's output", errorSlots .stream().map(NamedExpression::getName).collect(Collectors.joining(", ")))); } } if (having.isPresent()) { - if (upperProjects.stream().anyMatch(expr -> expr.anyMatch(WindowExpression.class::isInstance))) { - // when project contains window functions, in order to get the correct result - // push having through project to make it the parent node of logicalAgg + Set havingUsedSlots = ExpressionUtils.getInputSlotSet(having.get().getExpressions()); + Set havingUsedExprIds = new HashSet<>(havingUsedSlots.size()); + for (Slot slot : havingUsedSlots) { + havingUsedExprIds.add(slot.getExprId()); + } + Set aggOutputExprIds = newAggregate.getOutputExprIdSet(); + if (aggOutputExprIds.containsAll(havingUsedExprIds)) { + // when having just use output slots from agg, we push down having as parent of agg return project.withChildren(ImmutableList.of( new LogicalHaving<>( ExpressionUtils.replace(having.get().getConjuncts(), project.getAliasToProducer()), @@ -310,12 +314,13 @@ private List normalizeOutput(List aggregateOut } private List collectAllUsedSlots(List expressions) { + Set inputSlots = ExpressionUtils.getInputSlotSet(expressions); List subqueries = ExpressionUtils.collectAll(expressions, SubqueryExpr.class::isInstance); - ImmutableList.Builder slots = ImmutableList.builder(); + List slots = new ArrayList<>(inputSlots.size() + subqueries.size()); for (SubqueryExpr subqueryExpr : subqueries) { slots.addAll(subqueryExpr.getCorrelateSlots()); } slots.addAll(ExpressionUtils.getInputSlotSet(expressions)); - return slots.build(); + return slots; } } diff --git a/regression-test/data/nereids_p0/aggregate/agg_window_project.out b/regression-test/data/nereids_p0/aggregate/agg_window_project.out index dcdb0f25ecad38..45fde6faa92585 100644 --- a/regression-test/data/nereids_p0/aggregate/agg_window_project.out +++ b/regression-test/data/nereids_p0/aggregate/agg_window_project.out @@ -12,3 +12,7 @@ 2 1 23.0000000000 2 2 23.0000000000 +-- !select5 -- +1 1 3.0000000000 +1 2 3.0000000000 + diff --git a/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy b/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy index 0c9ea9d9fdeb81..48d342b4b02b41 100644 --- a/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy +++ b/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy @@ -96,6 +96,8 @@ suite("agg_window_project") { order_qt_select4 """select a, c, sum(sum(b)) over(partition by c order by c rows between unbounded preceding and current row) from test_window_table2 group by a, c having a > 1;""" + order_qt_select5 """select a, c, sum(sum(b)) over(partition by c order by c rows between unbounded preceding and current row) dd from test_window_table2 group by a, c having dd < 4;""" + explain { sql("select a, c, sum(sum(b)) over(partition by c order by c rows between unbounded preceding and current row) from test_window_table2 group by a, c having a > 1;") contains "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW" From 2935f643f5962578164555a3d1b8caafacaa1e6a Mon Sep 17 00:00:00 2001 From: starocean999 <12095047@qq.com> Date: Fri, 22 Mar 2024 22:27:16 +0800 Subject: [PATCH 4/4] fix case --- .../rules/analysis/AnalyzeCTETest.java | 2 +- .../analysis/FillUpMissingSlotsTest.java | 101 +++++++--------- .../shape/query14.out | 105 ++++++++--------- .../noStatsRfPrune/query14.out | 111 +++++++++--------- .../no_stats_shape/query14.out | 111 +++++++++--------- .../rf_prune/query14.out | 105 ++++++++--------- .../shape/query14.out | 105 ++++++++--------- 7 files changed, 307 insertions(+), 333 deletions(-) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/AnalyzeCTETest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/AnalyzeCTETest.java index ef5a32e2d3bcdb..522f198e3ff774 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/AnalyzeCTETest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/AnalyzeCTETest.java @@ -140,7 +140,7 @@ public void testCTEInHavingAndSubquery() { logicalFilter( logicalProject( logicalJoin( - logicalProject(logicalAggregate()), + logicalAggregate(), logicalProject() ) ) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java index 49793fd18425da..dbf65decef95f5 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java @@ -87,10 +87,9 @@ public void testHavingGroupBySlot() { PlanChecker.from(connectContext).analyze(sql) .matches( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1)))))); + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1))))); sql = "SELECT a1 as value FROM t1 GROUP BY a1 HAVING a1 > 0"; SlotReference value = new SlotReference(new ExprId(3), "value", TinyIntType.INSTANCE, true, @@ -134,10 +133,9 @@ public void testHavingGroupBySlot() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(a1, new TinyIntLiteral((byte) 0))))) ).when(FieldChecker.check("projects", Lists.newArrayList(sumA2.toSlot())))); } @@ -158,10 +156,9 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(sumA2.toSlot(), Literal.of(0L))))) ).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot())))); @@ -171,13 +168,12 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject( - logicalOlapScan() - ) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2)))) - ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(sumA2.toSlot(), Literal.of(0L))))))); + logicalAggregate( + logicalProject( + logicalOlapScan() + ) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2)))) + .when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(sumA2.toSlot(), Literal.of(0L))))))); sql = "SELECT a1, sum(a2) as value FROM t1 GROUP BY a1 HAVING sum(a2) > 0"; a1 = new SlotReference( @@ -193,22 +189,20 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject( - logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, value)))) + logicalAggregate( + logicalProject( + logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, value))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(value.toSlot(), Literal.of(0L))))))); sql = "SELECT a1, sum(a2) as value FROM t1 GROUP BY a1 HAVING value > 0"; PlanChecker.from(connectContext).analyze(sql) .matches( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject( - logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, value)))) + logicalAggregate( + logicalProject( + logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, value))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(value.toSlot(), Literal.of(0L)))))); sql = "SELECT a1, sum(a2) FROM t1 GROUP BY a1 HAVING MIN(pk) > 0"; @@ -230,10 +224,9 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2, minPK)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2, minPK))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(minPK.toSlot(), Literal.of((byte) 0))))) ).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot(), sumA2.toSlot())))); @@ -243,10 +236,9 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA1A2)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA1A2))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(sumA1A2.toSlot(), Literal.of(0L))))))); sql = "SELECT a1, sum(a1 + a2) FROM t1 GROUP BY a1 HAVING sum(a1 + a2 + 3) > 0"; @@ -256,10 +248,9 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA1A2, sumA1A23)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA1A2, sumA1A23))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(sumA1A23.toSlot(), Literal.of(0L))))) ).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot(), sumA1A2.toSlot())))); @@ -269,10 +260,9 @@ public void testHavingAggregateFunction() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject(logicalOlapScan()) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, countStar)))) + logicalAggregate( + logicalProject(logicalOlapScan()) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, countStar))) ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(countStar.toSlot(), Literal.of(0L))))) ).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot())))); } @@ -298,17 +288,16 @@ void testJoinWithHaving() { .matches( logicalProject( logicalFilter( - logicalProject( - logicalAggregate( - logicalProject( - logicalFilter( - logicalJoin( - logicalOlapScan(), - logicalOlapScan() - ) - )) - ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2, sumB1))) - )).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(new Cast(a1, BigIntType.INSTANCE), + logicalAggregate( + logicalProject( + logicalFilter( + logicalJoin( + logicalOlapScan(), + logicalOlapScan() + ) + )) + ).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, sumA2, sumB1))) + ).when(FieldChecker.check("conjuncts", ImmutableSet.of(new GreaterThan(new Cast(a1, BigIntType.INSTANCE), sumB1.toSlot())))) ).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot(), sumA2.toSlot())))); } diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out index a81fb3e5337c57..e1d05ef57f443c 100644 --- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out @@ -98,78 +98,75 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----------------------PhysicalUnion ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk,ss_item_sk] -----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk,ss_item_sk] +--------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF13 +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +--------------------------------------------------PhysicalOlapScan[date_dim] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalProject ---------------------------------------------PhysicalOlapScan[item] +------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF13 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF15 i_item_sk->[cs_item_sk,ss_item_sk] -----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF15 i_item_sk->[cs_item_sk,ss_item_sk] +--------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15 +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +--------------------------------------------------PhysicalOlapScan[date_dim] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalProject ---------------------------------------------PhysicalOlapScan[item] +------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk] -----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF16 d_date_sk->[ws_sold_date_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk] +--------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF16 d_date_sk->[ws_sold_date_sk] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +--------------------------------------------------PhysicalOlapScan[date_dim] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalProject ---------------------------------------------PhysicalOlapScan[item] +------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out index 3fb78e6cc3cf2b..37d24f8831cf74 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out @@ -95,81 +95,78 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----------------------PhysicalUnion ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF13 -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() +------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF13 +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() +------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() +------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out index 1daa8cb5ce185d..d3ae5a3b3045e1 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out @@ -95,81 +95,78 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----------------------PhysicalUnion ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF12 i_item_sk->[ss_item_sk,ss_item_sk] ---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF12 i_item_sk->[ss_item_sk,ss_item_sk] +------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF14 i_item_sk->[cs_item_sk,ss_item_sk] ---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15 -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF14 i_item_sk->[cs_item_sk,ss_item_sk] +------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15 +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] -----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk] ---------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF16 ws_item_sk->[ss_item_sk] -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF16 RF17 -----------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF17 RF18 +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk] +------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF16 ws_item_sk->[ss_item_sk] +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF16 RF17 --------------------------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[item] -----------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF17 RF18 +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +--------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out index a4f70cae0edcf0..281da092c6f533 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out @@ -99,78 +99,75 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----------------------PhysicalUnion ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out index 69a8888f2a7ffe..faa1a93b48f95e 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out @@ -99,78 +99,75 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----------------------PhysicalUnion ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather] ----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) ------------------------PhysicalProject --------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) -----------------------------PhysicalProject -------------------------------hashAgg[GLOBAL] ---------------------------------PhysicalDistribute[DistributionSpecHash] -----------------------------------hashAgg[LOCAL] -------------------------------------PhysicalProject ---------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20 +--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk] ----------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20 -----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk] -------------------------------------------PhysicalDistribute[DistributionSpecHash] ---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] -----------------------------------------------PhysicalProject -------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 RF19 -----------------------------------------------PhysicalDistribute[DistributionSpecReplicated] -------------------------------------------------PhysicalProject ---------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -----------------------------------------------------PhysicalOlapScan[date_dim] -------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk] --------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[item] +----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 RF19 +--------------------------------------------PhysicalDistribute[DistributionSpecReplicated] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute[DistributionSpecReplicated] ------------------------------PhysicalAssertNumRows --------------------------------PhysicalDistribute[DistributionSpecGather]