[enhancement](nereids) only push having as agg's parent if having just use slots from agg's output (#32414)

1. only push having as agg's parent if having just use slots from agg's output
2. show user friendly error message when item in select list but not in aggregate node's output
This commit is contained in:
starocean999
2024-03-26 17:12:15 +08:00
committed by yiguolei
parent 60c3372d8e
commit 0655d49a21
11 changed files with 405 additions and 339 deletions

View File

@ -23,6 +23,7 @@ import org.apache.doris.nereids.rules.RuleType;
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;
@ -43,6 +44,7 @@ import com.google.common.collect.ImmutableList.Builder;
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;
@ -244,10 +246,33 @@ public class NormalizeAggregate implements RewriteRuleFactory, NormalizeToSlot {
// create a parent project node
LogicalProject<Plan> project = new LogicalProject<>(upperProjects, newAggregate);
// verify project used slots are all coming from agg's output
List<Slot> slots = collectAllUsedSlots(upperProjects);
if (!slots.isEmpty()) {
Set<ExprId> aggOutputExprIds = new HashSet<>(slots.size());
for (NamedExpression expression : normalizedAggOutput) {
aggOutputExprIds.add(expression.getExprId());
}
List<Slot> errorSlots = new ArrayList<>(slots.size());
for (Slot slot : slots) {
if (!aggOutputExprIds.contains(slot.getExprId())) {
errorSlots.add(slot);
}
}
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<Slot> havingUsedSlots = ExpressionUtils.getInputSlotSet(having.get().getExpressions());
Set<ExprId> havingUsedExprIds = new HashSet<>(havingUsedSlots.size());
for (Slot slot : havingUsedSlots) {
havingUsedExprIds.add(slot.getExprId());
}
Set<ExprId> 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()),
@ -287,4 +312,15 @@ public class NormalizeAggregate implements RewriteRuleFactory, NormalizeToSlot {
}
return builder.build();
}
private List<Slot> collectAllUsedSlots(List<NamedExpression> expressions) {
Set<Slot> inputSlots = ExpressionUtils.getInputSlotSet(expressions);
List<SubqueryExpr> subqueries = ExpressionUtils.collectAll(expressions, SubqueryExpr.class::isInstance);
List<Slot> slots = new ArrayList<>(inputSlots.size() + subqueries.size());
for (SubqueryExpr subqueryExpr : subqueries) {
slots.addAll(subqueryExpr.getCorrelateSlots());
}
slots.addAll(ExpressionUtils.getInputSlotSet(expressions));
return slots;
}
}

View File

@ -140,7 +140,7 @@ public class AnalyzeCTETest extends TestWithFeService implements MemoPatternMatc
logicalFilter(
logicalProject(
logicalJoin(
logicalProject(logicalAggregate()),
logicalAggregate(),
logicalProject()
)
)

View File

@ -87,10 +87,9 @@ public class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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 @@ public class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
.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()))));
}

View File

@ -12,3 +12,7 @@
2 1 23.0000000000
2 2 23.0000000000
-- !select5 --
1 1 3.0000000000
1 2 3.0000000000

View File

@ -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]
----------------------------------------------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
----------------------------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]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
------------------------------------------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 = 2001))
--------------------------------------------------PhysicalOlapScan[date_dim]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------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]
----------------------------------------------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
----------------------------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]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
------------------------------------------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
------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001))
--------------------------------------------------PhysicalOlapScan[date_dim]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------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]
----------------------------------------------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
----------------------------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]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
------------------------------------------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
------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001))
--------------------------------------------------PhysicalOlapScan[date_dim]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17
--------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------PhysicalProject
------------------------------------------PhysicalOlapScan[item]
----------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------PhysicalAssertNumRows
--------------------------------PhysicalDistribute[DistributionSpecGather]

View File

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

View File

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

View File

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

View File

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

View File

@ -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";
}
}

View File

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