From 8a56229098b77b29e03196e3c5a1dfe3e02f0443 Mon Sep 17 00:00:00 2001 From: minghong Date: Wed, 24 Dec 2025 15:02:13 +0800 Subject: [PATCH 01/10] eager agg from tpc_preview3 1224 --- .../doris/nereids/jobs/executor/Rewriter.java | 29 +- .../rules/analysis/NormalizeAggregate.java | 51 +-- .../nereids/rules/rewrite/AdjustNullable.java | 16 +- .../eageraggregation/EagerAggRewriter.java | 405 ++++++++++++++++++ .../eageraggregation/PushDownAggContext.java | 130 ++++++ .../eageraggregation/PushDownAggregation.java | 243 +++++++++++ .../PushdownSumIfAggregation.java | 152 +++++++ .../eageraggregation/SumAggContext.java | 56 +++ .../eageraggregation/SumAggWriter.java | 323 ++++++++++++++ .../nereids/stats/ExpressionEstimation.java | 2 +- .../plans/logical/LogicalSetOperation.java | 42 ++ .../trees/plans/logical/LogicalUnion.java | 8 + .../org/apache/doris/qe/SessionVariable.java | 9 + .../shape_check/tpcds_sf1000/shape/query2.out | 24 +- .../tpcds_sf1000/shape/query23.out | 12 +- .../shape_check/tpcds_sf1000/shape/query3.out | 19 +- .../tpcds_sf1000/shape/query31.out | 18 +- .../tpcds_sf1000/shape/query42.out | 9 +- .../tpcds_sf1000/shape/query52.out | 9 +- .../tpcds_sf1000/shape/query55.out | 9 +- .../tpcds_sf1000/shape/query59.out | 9 +- 21 files changed, 1492 insertions(+), 83 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java index a39a3c0a9ff1b5..1615f3b6712f76 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java @@ -128,7 +128,6 @@ import org.apache.doris.nereids.rules.rewrite.PullUpProjectUnderLimit; import org.apache.doris.nereids.rules.rewrite.PullUpProjectUnderTopN; import org.apache.doris.nereids.rules.rewrite.PushCountIntoUnionAll; -import org.apache.doris.nereids.rules.rewrite.PushDownAggThroughJoin; import org.apache.doris.nereids.rules.rewrite.PushDownAggThroughJoinOnPkFk; import org.apache.doris.nereids.rules.rewrite.PushDownAggThroughJoinOneSide; import org.apache.doris.nereids.rules.rewrite.PushDownAggWithDistinctThroughJoinOneSide; @@ -173,6 +172,8 @@ import org.apache.doris.nereids.rules.rewrite.batch.ApplyToJoin; import org.apache.doris.nereids.rules.rewrite.batch.CorrelateApplyToUnCorrelateApply; import org.apache.doris.nereids.rules.rewrite.batch.EliminateUselessPlanUnderApply; +import org.apache.doris.nereids.rules.rewrite.eageraggregation.PushDownAggregation; +import org.apache.doris.nereids.rules.rewrite.eageraggregation.PushdownSumIfAggregation; import org.apache.doris.nereids.trees.plans.algebra.SetOperation; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; import org.apache.doris.nereids.trees.plans.logical.LogicalApply; @@ -657,19 +658,6 @@ public class Rewriter extends AbstractBatchJobExecutor { new MergeAggregate() ) ), - topic("Eager aggregation", - cascadesContext -> cascadesContext.rewritePlanContainsTypes( - LogicalAggregate.class, LogicalJoin.class - ), - costBased(topDown( - new PushDownAggWithDistinctThroughJoinOneSide(), - new PushDownAggThroughJoinOneSide(), - new PushDownAggThroughJoin() - )), - costBased(custom(RuleType.PUSH_DOWN_DISTINCT_THROUGH_JOIN, PushDownDistinctThroughJoin::new)), - topDown(new PushCountIntoUnionAll()) - ), - // this rule should invoke after infer predicate and push down distinct, and before push down limit topic("eliminate join according unique or foreign key", cascadesContext -> cascadesContext.rewritePlanContainsTypes(LogicalJoin.class), @@ -686,7 +674,20 @@ public class Rewriter extends AbstractBatchJobExecutor { topDown(new PushDownAggThroughJoinOnPkFk()), topDown(new PullUpJoinFromUnionAll()) ), + topic("Eager aggregation", + cascadesContext -> cascadesContext.rewritePlanContainsTypes( + LogicalAggregate.class, LogicalJoin.class + ), + costBased(topDown( + new PushDownAggWithDistinctThroughJoinOneSide(), + new PushDownAggThroughJoinOneSide() + )), + costBased(custom(RuleType.PUSH_DOWN_DISTINCT_THROUGH_JOIN, PushDownDistinctThroughJoin::new)), + custom(RuleType.PUSH_DOWN_AGG_THROUGH_JOIN, PushdownSumIfAggregation::new), + custom(RuleType.PUSH_DOWN_AGG_THROUGH_JOIN, PushDownAggregation::new), + topDown(new PushCountIntoUnionAll()) + ), topic("Limit optimization", cascadesContext -> cascadesContext.rewritePlanContainsTypes(LogicalLimit.class) || cascadesContext.rewritePlanContainsTypes(LogicalTopN.class) 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 4a64403dafb253..0db8339239a7e1 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 @@ -130,33 +130,34 @@ public List buildRules() { .toRule(RuleType.NORMALIZE_AGGREGATE)); } + /** + * The LogicalAggregate node may contain window agg functions and usual agg functions + * we call window agg functions as window-agg and usual agg functions as trivial-agg for short + * This rule simplify LogicalAggregate node by: + * 1. Push down some exprs from old LogicalAggregate node to a new child LogicalProject Node, + * 2. create a new LogicalAggregate with normalized group by exprs and trivial-aggs + * 3. Pull up normalized old LogicalAggregate's output exprs to a new parent LogicalProject Node + * Push down exprs: + * 1. all group by exprs + * 2. child contains subquery expr in trivial-agg + * 3. child contains window expr in trivial-agg + * 4. all input slots of trivial-agg + * 5. expr(including subquery) in distinct trivial-agg + * Normalize LogicalAggregate's output. + * 1. normalize group by exprs by outputs of bottom LogicalProject + * 2. normalize trivial-aggs by outputs of bottom LogicalProject + * 3. build normalized agg outputs + * Pull up exprs: + * normalize all output exprs in old LogicalAggregate to build a parent project node, typically includes: + * 1. simple slots + * 2. aliases + * a. alias with no aggs child + * b. alias with trivial-agg child + * c. alias with window-agg + */ @SuppressWarnings("checkstyle:UnusedLocalVariable") - private LogicalPlan normalizeAgg(LogicalAggregate aggregate, Optional> having, + public LogicalPlan normalizeAgg(LogicalAggregate aggregate, Optional> having, CascadesContext ctx) { - // The LogicalAggregate node may contain window agg functions and usual agg functions - // we call window agg functions as window-agg and usual agg functions as trivial-agg for short - // This rule simplify LogicalAggregate node by: - // 1. Push down some exprs from old LogicalAggregate node to a new child LogicalProject Node, - // 2. create a new LogicalAggregate with normalized group by exprs and trivial-aggs - // 3. Pull up normalized old LogicalAggregate's output exprs to a new parent LogicalProject Node - // Push down exprs: - // 1. all group by exprs - // 2. child contains subquery expr in trivial-agg - // 3. child contains window expr in trivial-agg - // 4. all input slots of trivial-agg - // 5. expr(including subquery) in distinct trivial-agg - // Normalize LogicalAggregate's output. - // 1. normalize group by exprs by outputs of bottom LogicalProject - // 2. normalize trivial-aggs by outputs of bottom LogicalProject - // 3. build normalized agg outputs - // Pull up exprs: - // normalize all output exprs in old LogicalAggregate to build a parent project node, typically includes: - // 1. simple slots - // 2. aliases - // a. alias with no aggs child - // b. alias with trivial-agg child - // c. alias with window-agg - // Push down exprs: // collect group by exprs Set groupingByExprs = Utils.fastToImmutableSet(aggregate.getGroupByExpressions()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java index 8592d3f22a0294..d2a12e82f59148 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java @@ -79,8 +79,20 @@ public class AdjustNullable extends DefaultPlanRewriter> imple private final boolean isAnalyzedPhase; - public AdjustNullable(boolean isAnalyzedPhase) { + /** + * When check is true, if we find a slot that is non-nullable in the plan, + * but we infer it should be nullable from the plan's subtree, and fe_debug is true, + * then throw an exception. + */ + private final boolean check; + + public AdjustNullable(boolean isAnalyzedPhase, boolean check) { this.isAnalyzedPhase = isAnalyzedPhase; + this.check = check; + } + + public AdjustNullable(boolean isAnalyzedPhase) { + this(isAnalyzedPhase, !isAnalyzedPhase); } @Override @@ -448,7 +460,7 @@ private Optional updateExpression(Optional input, private Optional updateExpression(T input, Map replaceMap, boolean debugCheck) { AtomicBoolean changed = new AtomicBoolean(false); - Expression replaced = doUpdateExpression(changed, input, replaceMap, !isAnalyzedPhase && debugCheck); + Expression replaced = doUpdateExpression(changed, input, replaceMap, check && debugCheck); return changed.get() ? Optional.of((T) replaced) : Optional.empty(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java new file mode 100644 index 00000000000000..f7ed45777f4e6c --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -0,0 +1,405 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.rules.analysis.NormalizeAggregate; +import org.apache.doris.nereids.rules.rewrite.StatsDerive; +import org.apache.doris.nereids.stats.ExpressionEstimation; +// import org.apache.doris.nereids.stats.StatsCalculator; +import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.Slot; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; +import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; +import org.apache.doris.nereids.trees.plans.logical.LogicalCatalogRelation; +import org.apache.doris.nereids.trees.plans.logical.LogicalFilter; +import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; +import org.apache.doris.nereids.trees.plans.logical.LogicalProject; +import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; +import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; +import org.apache.doris.nereids.util.ExpressionUtils; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.qe.SessionVariable; +import org.apache.doris.statistics.ColumnStatistic; +import org.apache.doris.statistics.Statistics; + +import com.google.common.collect.Lists; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * eager aggregation + * agg[sum(t1.A) group by t1.B] + * ->join(t1.C=t2.D) + * ->T1(A, B, C) + * ->T2(D) + * + * => + * agg[sum(x) group by t1.B] + * ->join(t1.C=t2.D) + * ->agg[sum(A) as x, group by B] + * ->T1(A, B, C) + * ->T2(D) + */ +public class EagerAggRewriter extends DefaultPlanRewriter { + private static final double LOWER_AGGREGATE_EFFECT_COEFFICIENT = 10000; + private static final double LOW_AGGREGATE_EFFECT_COEFFICIENT = 1000; + private static final double MEDIUM_AGGREGATE_EFFECT_COEFFICIENT = 100; + private final StatsDerive derive = new StatsDerive(true); + + @Override + public Plan visitLogicalJoin(LogicalJoin join, PushDownAggContext context) { + List pushToLeft = new ArrayList<>(); + List pushToRight = new ArrayList<>(); + boolean toLeft = true; + boolean toRight = true; + for (AggregateFunction aggFunc : context.getAggFunctions()) { + if (join.left().getOutputSet().containsAll(aggFunc.getInputSlots())) { + pushToLeft.add(aggFunc); + toRight = false; + } else if (join.right().getOutputSet().containsAll(aggFunc.getInputSlots())) { + pushToRight.add(aggFunc); + toLeft = false; + } + if (toLeft == toRight) { + return join; + } + } + + List joinConditionSlots; + List childGroupByKeys = new ArrayList<>(); + if (toLeft) { + joinConditionSlots = getJoinConditionsInputSlotsFromOneSide(join, join.left()); + for (NamedExpression key : context.getGroupKeys()) { + if (join.left().getOutputSet().containsAll(key.getInputSlots())) { + childGroupByKeys.add(key); + } + } + } else { + joinConditionSlots = getJoinConditionsInputSlotsFromOneSide(join, join.right()); + for (NamedExpression key : context.getGroupKeys()) { + if (join.right().getOutputSet().containsAll(key.getInputSlots())) { + childGroupByKeys.add(key); + } + } + } + + for (SlotReference slot : joinConditionSlots) { + if (!childGroupByKeys.contains(slot)) { + childGroupByKeys.add(slot); + } + } + + PushDownAggContext childContext = context.withGroupKeys(childGroupByKeys); + Statistics stats = join.right().getStats(); + if (stats == null) { + stats = join.right().accept(derive, new StatsDerive.DeriveContext()); + } + if (stats.getRowCount() > PushDownAggContext.BIG_JOIN_BUILD_SIZE) { + childContext = childContext.passThroughBigJoin(); + } + if (toLeft) { + Plan newLeft = join.left().accept(this, childContext); + if (newLeft != join.left()) { + context.getFinalGroupKeys().addAll(childContext.getFinalGroupKeys()); + return join.withChildren(newLeft, join.right()); + } + } else { + Plan newRight = join.right().accept(this, childContext); + if (newRight != join.right()) { + context.getFinalGroupKeys().addAll(childContext.getFinalGroupKeys()); + return join.withChildren(join.left(), newRight); + } + } + return join; + } + + private List getJoinConditionsInputSlotsFromOneSide(LogicalJoin join, + Plan side) { + List oneSideSlots = new ArrayList<>(); + for (Expression condition : join.getHashJoinConjuncts()) { + for (Slot slot : condition.getInputSlots()) { + if (side.getOutputSet().contains(slot)) { + oneSideSlots.add((SlotReference) slot); + } + } + } + for (Expression condition : join.getOtherJoinConjuncts()) { + for (Slot slot : condition.getInputSlots()) { + if (side.getOutputSet().contains(slot)) { + oneSideSlots.add((SlotReference) slot); + } + } + } + return oneSideSlots; + } + + private PushDownAggContext createContextFromProject(LogicalProject project, + PushDownAggContext context) { + HashMap replaceMapAliasBody = new HashMap<>(); + HashMap replaceMapAlias = new HashMap<>(); + for (NamedExpression ne : project.getProjects()) { + if (ne instanceof Alias) { + replaceMapAliasBody.put(ne.toSlot(), ((Alias) ne).child()); + replaceMapAlias.put(ne.toSlot(), ne); + } + } + + /* + * context: sum(a) groupBy(y+z as x, l) + * proj: b+c as a, u+v as y, m+n as l + * newContext: sum(b+c), groupBy((u+v)+z as x, m+n as l) + */ + + List groupKeys = new ArrayList<>(); + for (NamedExpression key : context.getGroupKeys()) { + NamedExpression newKey; + if (key instanceof Alias) { + newKey = (Alias) ExpressionUtils.replace(key, replaceMapAliasBody); + } else { + // key is slot + newKey = (NamedExpression) replaceMapAlias.getOrDefault(key, key); + } + groupKeys.add(newKey); + } + + List aggFunctions = new ArrayList<>(); + Map aliasMap = new HashMap<>(); + for (AggregateFunction aggFunc : context.getAggFunctions()) { + AggregateFunction newAggFunc = (AggregateFunction) ExpressionUtils.replace(aggFunc, replaceMapAliasBody); + Alias alias = context.getAliasMap().get(aggFunc); + aliasMap.put(newAggFunc, (Alias) alias.withChildren(newAggFunc)); + aggFunctions.add(newAggFunc); + } + return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, + context.getCascadesContext(), context.isPassThroughBigJoin()); + } + + @Override + public Plan visitLogicalProject(LogicalProject project, PushDownAggContext context) { + if (project.child() instanceof LogicalCatalogRelation + || (project.child() instanceof LogicalFilter + && project.child().child(0) instanceof LogicalCatalogRelation)) { + // project + // --> scan + // => + // aggregate + // --> project + // --> scan + return genAggregate(project, context); + } + + // check validation + // all slots in context are projected + List slotsInContext = context.getGroupKeys().stream() + .flatMap(e -> e.getInputSlots().stream()).collect(Collectors.toList()); + slotsInContext.addAll(context.getAggFunctionsInputSlots()); + for (Slot slot : slotsInContext) { + if (!project.getOutputSet().contains(slot)) { + if (SessionVariable.isFeDebug()) { + throw new RuntimeException("push down failed: " + slot + " is not in project \n" + + project.treeString()); + } else { + return project; + } + } + } + + PushDownAggContext newContext = createContextFromProject(project, context); + Plan newChild = project.child().accept(this, newContext); + if (newChild != project.child()) { + context.getFinalGroupKeys().addAll(newContext.getFinalGroupKeys()); + /* + * agg[sum(a), groupBy(b)] + * -> proj(a, b1+b2 as b) + * -> join(c = d) + * -> any(a, b1, b2, c,...) + * -> any(d, ...) + * => + * agg[sum(x), groupBy(b)] + * -> proj(x, b) + * -> join(c=d) + * ->agg[sum(a) as x, groupBy(b, c)] + * ->proj(a, b1+b2 as b, c, ...) + * -> any(a, b1, b2, c) + * -> any(d, ...) + */ + Set aggFuncInputSlots = context.getAggFunctionsInputSlots(); + List newProjections = new ArrayList<>(); + for (NamedExpression ne : project.getProjects()) { + if (aggFuncInputSlots.contains(ne.toSlot())) { + // ne (a) is replaced by alias slot (x) + continue; + } else if (context.getFinalGroupKeys().contains(ne.toSlot())) { + newProjections.add(ne.toSlot()); + } else { + newProjections.add(ne); + } + } + for (Alias alias : context.getAliasMap().values()) { + newProjections.add(alias.toSlot()); + } + for (SlotReference key : context.getFinalGroupKeys()) { + if (!newProjections.contains(key)) { + newProjections.add(key); + } + } + + return project.withProjectsAndChild(newProjections, newChild); + } + + return project; + } + + @Override + public Plan visitLogicalAggregate(LogicalAggregate agg, PushDownAggContext context) { + return agg; + } + + @Override + public Plan visitLogicalFilter(LogicalFilter filter, PushDownAggContext context) { + return genAggregate(filter, context); + } + + @Override + public Plan visitLogicalRelation(LogicalRelation relation, PushDownAggContext context) { + return genAggregate(relation, context); + } + + private Plan genAggregate(Plan child, PushDownAggContext context) { + if (checkStats(child, context)) { + List aggOutputExpressions = new ArrayList<>(); + aggOutputExpressions.addAll(context.getAliasMap().values()); + aggOutputExpressions.addAll(context.getGroupKeys()); + for (NamedExpression key : context.getGroupKeys()) { + context.addFinalGroupKey((SlotReference) key.toSlot()); + } + LogicalAggregate genAgg = new LogicalAggregate(context.getGroupKeys(), aggOutputExpressions, child); + NormalizeAggregate normalizeAggregate = new NormalizeAggregate(); + return normalizeAggregate.normalizeAgg(genAgg, Optional.empty(), + context.getCascadesContext()); + } else { + return child; + } + } + + private boolean checkStats(Plan plan, PushDownAggContext context) { + if (!context.isPassThroughBigJoin()) { + return false; + } + if (ConnectContext.get() == null) { + return false; + } + int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; + if (mode < 0) { + return false; + } + if (mode > 0) { + return true; + } + Statistics stats = plan.getStats(); + if (stats == null) { + stats = plan.accept(derive, new StatsDerive.DeriveContext()); + } + if (stats.getRowCount() == 0) { + return false; + } + + List groupKeysStats = new ArrayList<>(); + + List lower = Lists.newArrayList(); + List medium = Lists.newArrayList(); + List high = Lists.newArrayList(); + + List[] cards = new List[] {lower, medium, high}; + + for (NamedExpression key : context.getGroupKeys()) { + ColumnStatistic colStats = ExpressionEstimation.INSTANCE.estimate(key, stats); + if (colStats.isUnKnown) { + return false; + } + groupKeysStats.add(colStats); + cards[groupByCardinality(colStats, stats.getRowCount())].add(colStats); + } + + double lowerCartesian = 1.0; + for (ColumnStatistic colStats : lower) { + lowerCartesian = lowerCartesian * colStats.ndv; + } + + // pow(row_count/20, a half of lower column size) + double lowerUpper = Math.max(stats.getRowCount() / 20, 1); + lowerUpper = Math.pow(lowerUpper, Math.max(lower.size() / 2, 1)); + + if (high.isEmpty() && (lower.size() + medium.size()) <= 2) { + return true; + } + + if (high.isEmpty() && medium.isEmpty()) { + if (lower.size() == 1 && lowerCartesian * 20 <= stats.getRowCount()) { + return true; + } else if (lower.size() == 2 && lowerCartesian * 7 <= stats.getRowCount()) { + return true; + } else if (lower.size() <= 3 && lowerCartesian * 20 <= stats.getRowCount() && lowerCartesian < lowerUpper) { + return true; + } else { + return false; + } + } + + if (high.size() >= 2 || medium.size() > 2 || (high.size() == 1 && !medium.isEmpty())) { + return false; + } + + // 3. Extremely low cardinality for lower with at most one medium or high. + double lowerCartesianLowerBound = + stats.getRowCount() / LOWER_AGGREGATE_EFFECT_COEFFICIENT; + if (high.size() + medium.size() == 1 && lower.size() <= 2 && lowerCartesian <= lowerCartesianLowerBound) { + return true; + // StatsCalculator statsCalculator = new StatsCalculator(null); + // double estAggRowCount = statsCalculator.estimateGroupByRowCount(context.getGroupKeys(), stats); + // return estAggRowCount < lowerCartesianLowerBound; + } + + return false; + } + + // high(2): row_count / cardinality < MEDIUM_AGGREGATE_EFFECT_COEFFICIENT + // medium(1): row_count / cardinality >= MEDIUM_AGGREGATE_EFFECT_COEFFICIENT and < LOW_AGGREGATE_EFFECT_COEFFICIENT + // lower(0): row_count / cardinality >= LOW_AGGREGATE_EFFECT_COEFFICIENT + private int groupByCardinality(ColumnStatistic colStats, double rowCount) { + if (rowCount == 0 || colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { + return 2; + } else if (colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT <= rowCount + && colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { + return 1; + } else if (colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT <= rowCount) { + return 0; + } + return 2; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java new file mode 100644 index 00000000000000..e9475bf7ac1d4c --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java @@ -0,0 +1,130 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.CascadesContext; +import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.Slot; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * PushDownAggContext + */ +public class PushDownAggContext { + public static final int BIG_JOIN_BUILD_SIZE = 400_000; + private final List aggFunctions; + private final List groupKeys; + private final Map aliasMap; + private final Set aggFunctionsInputSlots; + + // the group keys that eventually used to generate aggregation node + private final LinkedHashSet finalGroupKeys = new LinkedHashSet<>(); + + // cascadesContext is used for normalizeAgg + private final CascadesContext cascadesContext; + + private final boolean passThroughBigJoin; + + /** + * constructor + */ + public PushDownAggContext(List aggFunctions, + List groupKeys, + CascadesContext cascadesContext) { + this(aggFunctions, groupKeys, null, cascadesContext, false); + } + + /** + * constructor + */ + public PushDownAggContext(List aggFunctions, + List groupKeys, Map aliasMap, CascadesContext cascadesContext, + boolean passThroughBigJoin) { + this.groupKeys = groupKeys; + this.aggFunctions = ImmutableList.copyOf(aggFunctions); + this.cascadesContext = cascadesContext; + + if (aliasMap == null) { + ImmutableMap.Builder aliasMapBuilder = ImmutableMap.builder(); + for (AggregateFunction aggFunction : this.aggFunctions) { + Alias alias = new Alias(aggFunction, aggFunction.getName()); + aliasMapBuilder.put(aggFunction, alias); + } + this.aliasMap = aliasMapBuilder.build(); + } else { + this.aliasMap = aliasMap; + } + + this.aggFunctionsInputSlots = aggFunctions.stream() + .flatMap(aggFunction -> aggFunction.getInputSlots().stream()) + .filter(Slot.class::isInstance) + .collect(ImmutableSet.toImmutableSet()); + this.passThroughBigJoin = passThroughBigJoin; + } + + public PushDownAggContext passThroughBigJoin() { + return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, true); + } + + public Map getAliasMap() { + return aliasMap; + } + + public List getAggFunctions() { + return aggFunctions; + } + + public List getGroupKeys() { + return groupKeys; + } + + public PushDownAggContext withGroupKeys(List groupKeys) { + return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, passThroughBigJoin); + } + + public Set getAggFunctionsInputSlots() { + return aggFunctionsInputSlots; + } + + public LinkedHashSet getFinalGroupKeys() { + return finalGroupKeys; + } + + public void addFinalGroupKey(SlotReference key) { + this.finalGroupKeys.add(key); + } + + public CascadesContext getCascadesContext() { + return cascadesContext; + } + + public boolean isPassThroughBigJoin() { + return passThroughBigJoin; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java new file mode 100644 index 00000000000000..221b234117ac4a --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -0,0 +1,243 @@ +// 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. + +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.jobs.JobContext; +import org.apache.doris.nereids.rules.analysis.NormalizeAggregate; +import org.apache.doris.nereids.rules.rewrite.AdjustNullable; +import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.Cast; +import org.apache.doris.nereids.trees.expressions.Divide; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; +import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; +import org.apache.doris.nereids.trees.expressions.functions.agg.Count; +import org.apache.doris.nereids.trees.expressions.functions.agg.Max; +import org.apache.doris.nereids.trees.expressions.functions.agg.Min; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; +import org.apache.doris.nereids.trees.plans.logical.LogicalFilter; +import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; +import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; +import org.apache.doris.nereids.trees.plans.logical.LogicalProject; +import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; +import org.apache.doris.nereids.trees.plans.visitor.CustomRewriter; +import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; +import org.apache.doris.nereids.types.DataType; +import org.apache.doris.nereids.util.ExpressionUtils; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.qe.SessionVariable; + +import com.google.common.collect.Sets; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * push down aggregation + */ +public class PushDownAggregation extends DefaultPlanRewriter implements CustomRewriter { + private static final Logger LOG = LoggerFactory.getLogger(PushDownAggregation.class); + + public final EagerAggRewriter writer = new EagerAggRewriter(); + + private final Set pushDownAggFunctionSet = Sets.newHashSet( + Sum.class, + Count.class, + Avg.class, + Max.class, + Min.class); + + private final Set acceptNodeType = Sets.newHashSet( + LogicalProject.class, + LogicalFilter.class, + LogicalRelation.class, + LogicalJoin.class); + + @Override + public Plan rewriteRoot(Plan plan, JobContext jobContext) { + int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; + if (mode < 0) { + return plan; + } else { + return plan.accept(this, jobContext); + } + } + + @Override + public Plan visitLogicalAggregate(LogicalAggregate agg, JobContext context) { + Plan newChild = agg.child().accept(this, context); + if (newChild != agg.child()) { + // TODO : push down upper aggregations + return agg.withChildren(newChild); + } + + if (agg.getSourceRepeat().isPresent()) { + return agg; + } + + List aggFunctions = new ArrayList<>(); + + Map avgToSumCountMap = new HashMap<>(); + for (AggregateFunction aggFunction : agg.getAggregateFunctions()) { + if (pushDownAggFunctionSet.contains(aggFunction.getClass()) + && !aggFunction.isDistinct() + && (!(aggFunction instanceof Count) || (!((Count) aggFunction).isCountStar()))) { + if (aggFunction instanceof Avg) { + DataType targetType = aggFunction.getDataType(); + Sum sum = new Sum(aggFunction.child(0)); + Count count = new Count(aggFunction.child(0)); + if (!aggFunctions.contains(sum)) { + aggFunctions.add(sum); + } + if (!aggFunctions.contains(count)) { + aggFunctions.add(count); + } + Expression castSum = targetType.equals(sum.getDataType()) ? sum : new Cast(sum, targetType); + Expression castCount = targetType.equals(count.getDataType()) ? count : new Cast(count, targetType); + avgToSumCountMap.put((Avg) aggFunction, + new Divide(castSum, castCount)); + } else { + aggFunctions.add(aggFunction); + } + } else { + return agg; + } + } + + if (!checkSubTreePattern(agg.child())) { + return agg; + } + + List groupKeys = new ArrayList<>(); + for (Expression groupKey : agg.getGroupByExpressions()) { + if (groupKey instanceof SlotReference) { + groupKeys.add((SlotReference) groupKey); + } else { + if (SessionVariable.isFeDebug()) { + throw new RuntimeException("PushDownAggregation failed: agg is not normalized\n " + + agg.treeString()); + } else { + return agg; + } + } + } + + PushDownAggContext pushDownContext = new PushDownAggContext(new ArrayList<>(aggFunctions), + groupKeys, context.getCascadesContext()); + try { + Plan child = agg.child().accept(writer, pushDownContext); + if (child != agg.child()) { + // agg has been pushed down, rewrite agg output expressions + // before: agg[sum(A), by (B)] + // ->join(C=D) + // ->scan(T1[A...]) + // ->scan(T2) + // after: agg[sum(x), by(B)] + // ->join(C=D) + // ->agg[sum(A) as x, by(B,C)] + // ->scan(T1[A...]) + // ->scan(T2) + List newOutputExpressions = new ArrayList<>(); + for (NamedExpression ne : agg.getOutputExpressions()) { + if (ne instanceof SlotReference) { + newOutputExpressions.add(ne); + } else { + Expression rewriteAvgExpr = ExpressionUtils.replace(ne, avgToSumCountMap); + NamedExpression replaceAliasExpr = (NamedExpression) rewriteAvgExpr + .rewriteDownShortCircuit(e -> { + Alias alias = pushDownContext.getAliasMap().get(e); + if (alias != null) { + AggregateFunction aggFunction = (AggregateFunction) e; + return aggFunction.withChildren(alias.toSlot()); + } else { + return e; + } + }); + newOutputExpressions.add(replaceAliasExpr); + } + } + LogicalAggregate eagerAgg = + agg.withAggOutputChild(newOutputExpressions, child); + NormalizeAggregate normalizeAggregate = new NormalizeAggregate(); + LogicalPlan normalized = normalizeAggregate.normalizeAgg(eagerAgg, Optional.empty(), + context.getCascadesContext()); + AdjustNullable adjustNullable = new AdjustNullable(false, false); + return adjustNullable.rewriteRoot(normalized, null); + } + } catch (RuntimeException e) { + LOG.info("PushDownAggregation failed: " + e.getMessage() + "\n" + agg.treeString()); + } + return agg; + } + + private boolean checkSubTreePattern(Plan root) { + return containsPushDownJoin(root) + && isSPJ(root); + } + + private boolean containsPushDownJoin(Plan root) { + if (root instanceof LogicalJoin && !((LogicalJoin) root).isMarkJoin()) { + return true; + } + if (root.children().isEmpty()) { + return false; + } + return root.children().stream().anyMatch(this::containsPushDownJoin); + } + + private boolean isSPJ(Plan root) { + boolean accepted = acceptNodeType.stream() + .anyMatch(clazz -> clazz.isAssignableFrom(root.getClass())); + if (!accepted) { + return false; + } + for (Plan child : root.children()) { + if (!isSPJ(child)) { + return false; + } + } + return true; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java new file mode 100644 index 00000000000000..292caf230d0ca2 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java @@ -0,0 +1,152 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.jobs.JobContext; +import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.EqualTo; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.Slot; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.scalar.If; +import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; +import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; +import org.apache.doris.nereids.trees.plans.visitor.CustomRewriter; +import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; +import org.apache.doris.qe.SessionVariable; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + * sum(if t1.a then t2.b) + */ +public class PushdownSumIfAggregation extends DefaultPlanRewriter implements CustomRewriter { + + @Override + public Plan rewriteRoot(Plan plan, JobContext jobContext) { + return plan.accept(this, jobContext); + } + + @Override + public Plan visitLogicalAggregate(LogicalAggregate agg, JobContext context) { + Plan newChild = agg.child().accept(this, context); + if (newChild != agg.child()) { + // TODO : push down upper aggregations + return agg.withChildren(newChild); + } + + if (agg.getSourceRepeat().isPresent()) { + return agg; + } + + List aliasToBePushDown = Lists.newArrayList(); + List ifConditions = Lists.newArrayList(); + List ifThenSlots = Lists.newArrayList(); + boolean patternMatch = true; + for (NamedExpression aggOutput : agg.getOutputExpressions()) { + if (aggOutput instanceof Alias) { + Expression body = aggOutput.child(0); + if (body instanceof Sum) { + Expression sumBody = ((Sum) body).child(); + if (sumBody instanceof If) { + If ifBody = (If) sumBody; + if (ifBody.child(0) instanceof EqualTo + && ifBody.child(1) instanceof SlotReference + && ifBody.child(2) instanceof NullLiteral) { + ifConditions.add((EqualTo) ifBody.child(0)); + ifThenSlots.add((SlotReference) ifBody.child(1)); + aliasToBePushDown.add(aggOutput); + continue; + } + } + } + patternMatch = false; + } + } + if (!patternMatch) { + return agg; + } + if (ifThenSlots.isEmpty()) { + return agg; + } + ifThenSlots = Lists.newArrayList(Sets.newHashSet(ifThenSlots)); + + List groupKeys = new ArrayList<>(); + for (Expression groupKey : agg.getGroupByExpressions()) { + if (groupKey instanceof SlotReference) { + groupKeys.add((SlotReference) groupKey); + } else { + if (SessionVariable.isFeDebug()) { + throw new RuntimeException("PushDownAggregation failed: agg is not normalized\n " + + agg.treeString()); + } else { + return agg; + } + } + } + + SumAggContext sumAggContext = new SumAggContext(aliasToBePushDown, ifConditions, ifThenSlots, groupKeys); + SumAggWriter writer = new SumAggWriter(); + Plan child = agg.child().accept(writer, sumAggContext); + if (child != agg.child()) { + List outputExpressions = agg.getOutputExpressions(); + List newOutputExpressions = new ArrayList<>(); + for (NamedExpression output : outputExpressions) { + if (output instanceof SlotReference) { + newOutputExpressions.add(output); + } else if (output instanceof Alias + && output.child(0) instanceof Sum + && output.child(0).child(0) instanceof If + && output.child(0).child(0).child(1) instanceof SlotReference) { + SlotReference targetSlot = (SlotReference) output.child(0).child(0).child(1); + Slot toReplace = null; + for (Slot slot : child.getOutput()) { + if (slot.getExprId().equals(targetSlot.getExprId())) { + toReplace = slot; + } + } + if (toReplace != null) { + Alias newOutput = (Alias) ((Alias) output).withChildren( + new Sum( + new If( + output.child(0).child(0).child(0), + toReplace, + new NullLiteral(toReplace.getDataType()) + ) + ) + ); + newOutputExpressions.add(newOutput); + } else { + return agg; + } + + } + } + return agg.withAggOutputChild(newOutputExpressions, child); + } + return agg; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java new file mode 100644 index 00000000000000..7b3e7ee948276c --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java @@ -0,0 +1,56 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.trees.expressions.EqualTo; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.SlotReference; + +import com.google.common.collect.ImmutableList; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * SumAggContext + */ +public class SumAggContext { + public final List aliasToBePushDown; + public final List ifConditions; + public final List ifThenSlots; + public final List groupKeys; + + public SumAggContext(List aliasToBePushDown, + List ifConditions, List ifThenSlots, + List groupKeys) { + this.aliasToBePushDown = ImmutableList.copyOf(aliasToBePushDown); + this.ifConditions = ImmutableList.copyOf(ifConditions); + Set distinct = new HashSet<>(ifThenSlots); + this.ifThenSlots = ImmutableList.copyOf(distinct); + this.groupKeys = ImmutableList.copyOf(groupKeys); + } + + public SumAggContext withIfThenSlots(List ifThenSlots) { + return new SumAggContext(this.aliasToBePushDown, + this.ifConditions, + ifThenSlots, + this.groupKeys); + } + +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java new file mode 100644 index 00000000000000..27a2165f42233a --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java @@ -0,0 +1,323 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.rules.rewrite.StatsDerive; +import org.apache.doris.nereids.stats.ExpressionEstimation; +import org.apache.doris.nereids.stats.StatsCalculator; +import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.Slot; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; +import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; +import org.apache.doris.nereids.trees.plans.logical.LogicalProject; +import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; +import org.apache.doris.nereids.trees.plans.logical.LogicalUnion; +import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; +import org.apache.doris.nereids.types.DataType; +import org.apache.doris.nereids.util.ExpressionUtils; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.statistics.ColumnStatistic; +import org.apache.doris.statistics.Statistics; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * SumAggWriter + */ +public class SumAggWriter extends DefaultPlanRewriter { + private static final double LOWER_AGGREGATE_EFFECT_COEFFICIENT = 10000; + private static final double LOW_AGGREGATE_EFFECT_COEFFICIENT = 1000; + private static final double MEDIUM_AGGREGATE_EFFECT_COEFFICIENT = 100; + private final StatsDerive derive = new StatsDerive(true); + + @Override + public Plan visit(Plan plan, SumAggContext context) { + return plan; + } + + @Override + public Plan visitLogicalProject(LogicalProject project, SumAggContext context) { + if (project.getProjects().stream().allMatch(proj -> proj instanceof SlotReference + || (proj instanceof Alias && proj.child(0) instanceof SlotReference))) { + List slotToPush = new ArrayList<>(); + for (SlotReference slot : context.ifThenSlots) { + slotToPush.add((SlotReference) project.pushDownExpressionPastProject(slot)); + } + List groupBySlots = new ArrayList<>(); + for (SlotReference slot : context.groupKeys) { + groupBySlots.add((SlotReference) project.pushDownExpressionPastProject(slot)); + } + SumAggContext contextForChild = new SumAggContext( + context.aliasToBePushDown, + context.ifConditions, + slotToPush, + groupBySlots); + Plan child = project.child().accept(this, contextForChild); + if (child != project.child()) { + List newProjects = Lists.newArrayList(); + for (NamedExpression ne : project.getProjects()) { + newProjects.add((NamedExpression) replaceBySlots(ne, child.getOutput())); + } + return project.withProjects(newProjects).withChildren(child); + } + } + return project; + } + + private static Expression replaceBySlots(Expression expression, List slots) { + Map replaceMap = new HashMap<>(); + for (Slot slot1 : expression.getInputSlots()) { + for (Slot slot2 : slots) { + if (slot1.getExprId().asInt() == slot2.getExprId().asInt()) { + replaceMap.put(slot1, slot2); + } + } + } + Expression result = ExpressionUtils.replace(expression, replaceMap); + return result; + } + + @Override + public Plan visitLogicalJoin(LogicalJoin join, SumAggContext context) { + Set leftOutput = join.left().getOutputSet(); + Set conditionSlots = join.getConditionSlot().stream() + .map(slot -> (SlotReference) slot).collect(Collectors.toSet()); + for (Slot slot : context.ifThenSlots) { + if (conditionSlots.contains(slot)) { + return join; + } + } + Set conditionSlotsFromLeft = Sets.newHashSet(conditionSlots); + conditionSlotsFromLeft.retainAll(leftOutput); + for (SlotReference slot : context.groupKeys) { + if (leftOutput.contains(slot)) { + conditionSlotsFromLeft.add(slot); + } + } + if (leftOutput.containsAll(context.ifThenSlots)) { + SumAggContext contextForChild = new SumAggContext( + context.aliasToBePushDown, + context.ifConditions, + context.ifThenSlots, + Lists.newArrayList(conditionSlotsFromLeft) + ); + Plan left = join.left().accept(this, contextForChild); + if (join.left() != left) { + return join.withChildren(left, join.right()); + } + } + return join; + } + + @Override + public Plan visitLogicalUnion(LogicalUnion union, SumAggContext context) { + if (!union.getOutputSet().containsAll(context.ifThenSlots)) { + return union; + } + if (!union.getConstantExprsList().isEmpty()) { + return union; + } + + if (!union.getOutputs().stream().allMatch(e -> e instanceof SlotReference)) { + return union; + } + List newChildren = Lists.newArrayList(); + + boolean changed = false; + for (int i = 0; i < union.children().size(); i++) { + Plan child = union.children().get(i); + List ifThenSlotsForChild = new ArrayList<>(); + // List groupByForChild = new ArrayList<>(); + for (SlotReference slot : context.ifThenSlots) { + Expression pushed = union.pushDownExpressionPastSetOperator(slot, i); + if (pushed instanceof SlotReference) { + ifThenSlotsForChild.add((SlotReference) pushed); + } else { + return union; + } + } + int childIdx = i; + SumAggContext contextForChild = new SumAggContext( + context.aliasToBePushDown, + context.ifConditions, + ifThenSlotsForChild, + context.groupKeys.stream().map(slot + -> (SlotReference) union.pushDownExpressionPastSetOperator(slot, childIdx)) + .collect(Collectors.toList()) + ); + Plan newChild = child.accept(this, contextForChild); + if (newChild != child) { + changed = true; + } + newChildren.add(newChild); + } + if (changed) { + List> newRegularChildrenOutputs = Lists.newArrayList(); + for (int i = 0; i < newChildren.size(); i++) { + List childOutput = new ArrayList<>(); + for (SlotReference slot : union.getRegularChildOutput(i)) { + for (Slot c : newChildren.get(i).getOutput()) { + if (slot.equals(c)) { + childOutput.add((SlotReference) c); + break; + } + } + } + newRegularChildrenOutputs.add(childOutput); + } + List newOutputs = new ArrayList<>(); + for (int i = 0; i < union.getOutput().size(); i++) { + SlotReference originSlot = (SlotReference) union.getOutput().get(i); + DataType dataType = newRegularChildrenOutputs.get(0).get(i).getDataType(); + newOutputs.add(originSlot.withNullableAndDataType(originSlot.nullable(), dataType)); + } + return union.withChildrenAndOutputs(newChildren, newOutputs, newRegularChildrenOutputs); + } else { + return union; + } + } + + @Override + public Plan visitLogicalRelation(LogicalRelation relation, SumAggContext context) { + return genAggregate(relation, context); + } + + private Plan genAggregate(Plan child, SumAggContext context) { + if (checkStats(child, context)) { + List aggOutputExpressions = new ArrayList<>(); + for (SlotReference slot : context.ifThenSlots) { + Alias alias = new Alias(slot.getExprId(), new Sum(slot)); + aggOutputExpressions.add(alias); + } + aggOutputExpressions.addAll(context.groupKeys); + + LogicalAggregate genAgg = new LogicalAggregate(context.groupKeys, aggOutputExpressions, child); + return genAgg; + } else { + return child; + } + + } + + private boolean checkStats(Plan plan, SumAggContext context) { + if (ConnectContext.get() == null) { + return false; + } + int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; + if (mode < 0) { + return false; + } + if (mode > 0) { + return true; + } + Statistics stats = plan.getStats(); + if (stats == null) { + stats = plan.accept(derive, new StatsDerive.DeriveContext()); + } + if (stats.getRowCount() == 0) { + return false; + } + + List groupKeysStats = new ArrayList<>(); + + List lower = Lists.newArrayList(); + List medium = Lists.newArrayList(); + List high = Lists.newArrayList(); + + List[] cards = new List[] {lower, medium, high}; + + for (NamedExpression key : context.groupKeys) { + ColumnStatistic colStats = ExpressionEstimation.INSTANCE.estimate(key, stats); + if (colStats.isUnKnown) { + return false; + } + groupKeysStats.add(colStats); + cards[groupByCardinality(colStats, stats.getRowCount())].add(colStats); + } + + double lowerCartesian = 1.0; + for (ColumnStatistic colStats : lower) { + lowerCartesian = lowerCartesian * colStats.ndv; + } + + // pow(row_count/20, a half of lower column size) + double lowerUpper = Math.max(stats.getRowCount() / 20, 1); + lowerUpper = Math.pow(lowerUpper, Math.max(lower.size() / 2, 1)); + + if (high.isEmpty() && (lower.size() + medium.size()) == 1) { + return true; + } + + if (high.isEmpty() && medium.isEmpty()) { + if (lower.size() == 1 && lowerCartesian * 20 <= stats.getRowCount()) { + return true; + } else if (lower.size() == 2 && lowerCartesian * 7 <= stats.getRowCount()) { + return true; + } else if (lower.size() <= 3 && lowerCartesian * 20 <= stats.getRowCount() && lowerCartesian < lowerUpper) { + return true; + } else { + return false; + } + } + + if (high.size() >= 2 || medium.size() > 2 || (high.size() == 1 && !medium.isEmpty())) { + return false; + } + + // 3. Extremely low cardinality for lower with at most one medium or high. + double lowerCartesianLowerBound = + stats.getRowCount() / LOWER_AGGREGATE_EFFECT_COEFFICIENT; + if (high.size() + medium.size() == 1 && lower.size() <= 2 && lowerCartesian <= lowerCartesianLowerBound) { + StatsCalculator statsCalculator = new StatsCalculator(null); + double estAggRowCount = statsCalculator.estimateGroupByRowCount( + context.groupKeys.stream().map(s -> (Expression) s).collect(Collectors.toList()), + stats); + return estAggRowCount < lowerCartesianLowerBound; + } + + return false; + } + + // high(2): row_count / cardinality < MEDIUM_AGGREGATE_EFFECT_COEFFICIENT + // medium(1): row_count / cardinality >= MEDIUM_AGGREGATE_EFFECT_COEFFICIENT and < LOW_AGGREGATE_EFFECT_COEFFICIENT + // lower(0): row_count / cardinality >= LOW_AGGREGATE_EFFECT_COEFFICIENT + private int groupByCardinality(ColumnStatistic colStats, double rowCount) { + if (rowCount == 0 || colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { + return 2; + } else if (colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT <= rowCount + && colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { + return 1; + } else if (colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT <= rowCount) { + return 0; + } + return 2; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java index a6e620b8efc839..020c0dd3d6a89a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java @@ -120,7 +120,7 @@ public class ExpressionEstimation extends ExpressionVisitor parentProjects) { public Optional processProject(List parentProjects) { return Optional.of(PushProjectThroughUnion.doPushProject(parentProjects, this)); } + + /** + * Push down expression past SetOperation to a specific child. + * + * This method maps the expression from the SetOperation's output slots + * to the corresponding child's output slots. + * + * Example: + * SetOperation outputs: [x, y] + * Child 0 outputs (regularChildrenOutputs[0]): [a, b] + * Child 1 outputs (regularChildrenOutputs[1]): [c, d] + * + * If expression is "x + 1": + * - For childIdx=0, return "a + 1" + * - For childIdx=1, return "c + 1" + * + * @param expression the expression to push down + * @param childIdx the index of the child to push down to + * @return the rewritten expression for the child, or null if childIdx is out of + * bounds + */ + public Expression pushDownExpressionPastSetOperator(Expression expression, int childIdx) { + // Check if childIdx is valid + if (childIdx < 0 || childIdx >= regularChildrenOutputs.size()) { + return null; + } + + // Build mapping from SetOperation output slots to child output slots + java.util.HashMap slotMapping = new java.util.HashMap<>(); + List childOutputs = regularChildrenOutputs.get(childIdx); + + // Map each output slot to the corresponding child slot + for (int i = 0; i < outputs.size() && i < childOutputs.size(); i++) { + Slot outputSlot = outputs.get(i).toSlot(); + SlotReference childSlot = childOutputs.get(i); + slotMapping.put(outputSlot, childSlot); + } + + // Replace slots in the expression using the mapping + return ExpressionUtils.replace(expression, slotMapping); + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java index 1a1b3b2e84e639..7dc1507cc7a24b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java @@ -424,4 +424,12 @@ private static List castToCommonType(List row, } return changed ? castedRow.build() : row; } + + public LogicalSetOperation withChildrenAndOutputs(List children, List newOuptuts, + List> childrenOutputs) { + Preconditions.checkArgument(children.size() == childrenOutputs.size(), + "children size %s is not equals with children outputs size %s", + children.size(), childrenOutputs.size()); + return new LogicalUnion(qualifier, newOuptuts, childrenOutputs, constantExprsList, hasPushedFilter, children); + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 7aa82a3e0ee0d3..5110a537cba9c1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -2246,6 +2246,15 @@ public boolean isEnableHboNonStrictMatchingMode() { @VariableMgr.VarAttr(name = DPHYPER_LIMIT) public int dphyperLimit = 1000; + @VariableMgr.VarAttr(name = "eager_aggregation_mode", needForward = true, + description = {"0: 根据统计信息决定是使用eager aggregation," + + "1: 强制使用 eager aggregation," + + "-1: 禁止使用 eager aggregation", + "0: Determine eager aggregation by statistics, " + + "1: force eager aggregation, " + + "-1: Prohibit eager aggregation "} + ) + public int eagerAggregationMode = 0; @VariableMgr.VarAttr( name = ENABLE_PAGE_CACHE, diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out index b9857d349977f8..2522a1a9f3f342 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out @@ -6,16 +6,22 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] ---------------PhysicalUnion -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[web_sales] apply RFs: RF0 -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 sold_date_sk->[d_date_sk] --------------PhysicalProject -----------------PhysicalOlapScan[date_dim] +----------------PhysicalOlapScan[date_dim] apply RFs: RF0 +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_sales] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out index f514575b3964ce..c38ee45f762950 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out @@ -53,29 +53,29 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------hashAgg[LOCAL] ----------------PhysicalUnion ------------------PhysicalProject ---------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF5 cs_item_sk->[item_sk] -----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 +--------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF5 item_sk->[cs_item_sk] ----------------------PhysicalProject ------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] ------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4 +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4 RF5 ------------------------------PhysicalProject --------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) ----------------------------------PhysicalOlapScan[date_dim] --------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ------------------PhysicalProject ---------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF8 ws_item_sk->[item_sk] -----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 +--------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF8 item_sk->[ws_item_sk] ----------------------PhysicalProject ------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ws_bill_customer_sk] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk] ------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 RF8 ------------------------------PhysicalProject --------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) ----------------------------------PhysicalOlapScan[date_dim] --------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query3.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query3.out index e9c6ec79c33e7b..fae84ff1a42849 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query3.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query3.out @@ -9,15 +9,18 @@ PhysicalResultSink ------------PhysicalDistribute[DistributionSpecHash] --------------hashAgg[LOCAL] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 -------------------------PhysicalProject ---------------------------filter((item.i_manufact_id = 816)) -----------------------------PhysicalOlapScan[item] +--------------------------filter((dt.d_moy = 11)) +----------------------------PhysicalOlapScan[date_dim(dt)] --------------------PhysicalProject -----------------------filter((dt.d_moy = 11)) -------------------------PhysicalOlapScan[date_dim(dt)] +----------------------filter((item.i_manufact_id = 816)) +------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query31.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query31.out index 56ccb985a8c645..ddd91f4702c00c 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query31.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query31.out @@ -9,9 +9,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------PhysicalProject --------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------------PhysicalProject -----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 --------------------PhysicalProject ----------------------filter((ss.d_year = 1999) and d_qoy IN (1, 2, 3)) ------------------------PhysicalOlapScan[date_dim] @@ -26,9 +29,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_bill_addr_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 ----------------------PhysicalProject ------------------------filter((ws.d_year = 1999) and d_qoy IN (1, 2, 3)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query42.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query42.out index 939c2713d64d44..68f93698b9a036 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query42.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query42.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query52.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query52.out index e3177f96cfd44c..5401ac3a92a539 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query52.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query52.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query55.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query55.out index 652a5dab8d16b2..b21e9d417e36dc 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query55.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query55.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 52)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query59.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query59.out index f0567b8768bf8f..050957da0f0a7a 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query59.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query59.out @@ -6,9 +6,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------PhysicalProject -----------------PhysicalOlapScan[store_sales] apply RFs: RF0 +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] --PhysicalResultSink From d9d19a70f4ec31fb76f2196f9835e37ce8cfb92f Mon Sep 17 00:00:00 2001 From: englefly Date: Mon, 5 Jan 2026 15:00:34 +0800 Subject: [PATCH 02/10] =?UTF-8?q?support=20count=20pushdown.=20tpcds=2014/?= =?UTF-8?q?=20tpch13=20ds14=20=E5=A2=9E=E5=8A=A0=E4=BA=86agg=20push?= =?UTF-8?q?=EF=BC=8C=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4=204.7=20->=204.8?= =?UTF-8?q?=20h13=20=E5=A2=9E=E5=8A=A0=E4=BA=86=20agg=20push=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=AE=A9p6=20=E6=81=A2=E5=A4=8D=E5=88=B0=20p?= =?UTF-8?q?4=20=E7=9A=84=E6=88=90=E7=BB=A9=EF=BC=8C=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当任一 group key的ndv 接近 行数(0.9 倍)时,不下推agg DORIS-24367 case-when 不能下推join 补null的一侧 pick unnest-subquery-cte ut-tmp adjust rt update-shape fix eager_agg.groovy, runtime_filter_mode=OFF; fmt 14/67 因为rebase后增加了 repeat 拆分, 形状变化 支持 min(if), max(if), 增加了context.isValid检查,避免无效下推 doris-24240: rewriteRoot 检查nullable失败则不做eagerAgg column pruning 不产生不合法 的setOp 24207-2: orExpansion union 字段没对齐 DORIS-24239 context.groupKeys 不能为空 DORIS-24206: fix EliminateGroupByKeyByUniform bug:没有替换alias的exprId DORIS-24205 1. union 的孩子不能部分改写 2. agg 输入字段和 group key 有交集,则不下推 LogicalProject 构造projectMap时不能有unbound DORIS-23842 没有aggFunc时 下推包含所有group key 的分支,而不是大分支. ds37/38/82/87 受到影响。select distinct A from T1 join T2 on ... group by A` aliasMap 使用HashMap,不用IdentityMap DORIS-24149 DORIS-24151 doris-24150 rt case 1. exprId 的等值判断, 2.update rt. DORIS-24150 update shape remove unused code 1. sum-if 不考虑穿过bigJoin, 2. 支持union q5 两个sum(0)错误去重了 sum-if 基本款 (还没有支持union), 43 有提升 simple sum-if no union 检查context的字段 是project的输出.拒绝 sum(A) 下推 proj(x, x+y as A) 且x 不是group key derive deep false throw exception for eager agg when FeDebug 1. remove finalGroupKeys, 2. project 下推后改写projects push agg on join group key only slotreference do not support avg/count mode=1 时 即使没有经过big join 也要 强制 下推 shape with/without pkfk based on tpc_preview --- .../doris/nereids/jobs/executor/Rewriter.java | 65 +- .../nereids/rules/rewrite/AdjustNullable.java | 35 +- .../nereids/rules/rewrite/ColumnPruning.java | 47 +- .../nereids/rules/rewrite/OrExpansion.java | 28 +- .../eageraggregation/EagerAggRewriter.java | 389 +- .../eageraggregation/PushDownAggContext.java | 83 +- .../eageraggregation/PushDownAggregation.java | 184 +- .../PushdownSumIfAggregation.java | 152 - .../eageraggregation/SumAggContext.java | 56 - .../eageraggregation/SumAggWriter.java | 323 -- .../expressions/functions/BoundFunction.java | 4 + .../trees/plans/logical/LogicalFileScan.java | 2 +- .../trees/plans/logical/LogicalOlapScan.java | 2 +- .../trees/plans/logical/LogicalProject.java | 20 +- .../plans/logical/LogicalSetOperation.java | 44 +- .../trees/plans/logical/LogicalUnion.java | 2 +- .../doris/nereids/util/ExpressionUtils.java | 100 +- .../org/apache/doris/qe/SessionVariable.java | 33 +- .../org/apache/doris/qe/StmtExecutor.java | 4 +- .../EagerAggRewriterTest.java | 113 + .../nereids/trees/plans/PlanToStringTest.java | 2 +- .../data/nereids_p0/eager_agg/eager_agg.out | 452 ++ .../eager_aggregate/basic.out | 98 - .../eager_aggregate/basic_one_side.out | 98 - ...n_count_distinct_through_join_one_side.out | 237 - .../push_down_count_through_join.out | 1032 ---- .../push_down_count_through_join_one_side.out | 1093 ---- .../push_down_max_through_join.out | 592 -- ...own_min_distinct_through_join_one_side.out | 237 - .../push_down_min_through_join.out | 592 -- ...own_sum_distinct_through_join_one_side.out | 231 - .../push_down_sum_through_join.out | 569 -- .../push_down_sum_through_join_one_side.out | 592 -- .../tpcds_sf100/rf_prune/query2.out | 22 +- .../tpcds_sf100/rf_prune/query3.out | 19 +- .../tpcds_sf100/rf_prune/query31.out | 18 +- .../tpcds_sf100/rf_prune/query42.out | 9 +- .../tpcds_sf100/rf_prune/query43.out | 9 +- .../tpcds_sf100/rf_prune/query52.out | 9 +- .../tpcds_sf100/rf_prune/query55.out | 9 +- .../tpcds_sf100/rf_prune/query59.out | 9 +- .../tpcds_sf100/rf_prune/query64.out | 129 +- .../shape_check/tpcds_sf100/shape/query2.out | 22 +- .../shape_check/tpcds_sf100/shape/query3.out | 19 +- .../shape_check/tpcds_sf100/shape/query31.out | 18 +- .../shape_check/tpcds_sf100/shape/query42.out | 9 +- .../shape_check/tpcds_sf100/shape/query43.out | 9 +- .../shape_check/tpcds_sf100/shape/query52.out | 9 +- .../shape_check/tpcds_sf100/shape/query55.out | 9 +- .../shape_check/tpcds_sf100/shape/query59.out | 9 +- .../shape_check/tpcds_sf100/shape/query64.out | 129 +- .../shape_check/tpcds_sf1000/hint/query2.out | 16 +- .../shape_check/tpcds_sf1000/hint/query31.out | 18 +- .../shape_check/tpcds_sf1000/hint/query42.out | 9 +- .../shape_check/tpcds_sf1000/hint/query43.out | 9 +- .../shape_check/tpcds_sf1000/hint/query52.out | 9 +- .../shape_check/tpcds_sf1000/hint/query59.out | 9 +- .../tpcds_sf1000/shape/query14.out | 78 +- .../shape_check/tpcds_sf1000/shape/query2.out | 22 +- .../tpcds_sf1000/shape/query23.out | 12 +- .../tpcds_sf1000/shape/query43.out | 9 +- .../tpcds_sf1000_nopkfk/shape/query1.out | 37 + .../tpcds_sf1000_nopkfk/shape/query10.out | 47 + .../tpcds_sf1000_nopkfk/shape/query11.out | 63 + .../tpcds_sf1000_nopkfk/shape/query12.out | 26 + .../tpcds_sf1000_nopkfk/shape/query13.out | 34 + .../tpcds_sf1000_nopkfk/shape/query14.out | 170 + .../tpcds_sf1000_nopkfk/shape/query15.out | 25 + .../tpcds_sf1000_nopkfk/shape/query16.out | 35 + .../tpcds_sf1000_nopkfk/shape/query17.out | 44 + .../tpcds_sf1000_nopkfk/shape/query18.out | 42 + .../tpcds_sf1000_nopkfk/shape/query19.out | 35 + .../tpcds_sf1000_nopkfk/shape/query2.out | 43 + .../tpcds_sf1000_nopkfk/shape/query20.out | 26 + .../tpcds_sf1000_nopkfk/shape/query21.out | 26 + .../tpcds_sf1000_nopkfk/shape/query22.out | 23 + .../tpcds_sf1000_nopkfk/shape/query23.out | 89 + .../tpcds_sf1000_nopkfk/shape/query24.out | 52 + .../tpcds_sf1000_nopkfk/shape/query25.out | 43 + .../tpcds_sf1000_nopkfk/shape/query26.out | 31 + .../tpcds_sf1000_nopkfk/shape/query27.out | 33 + .../tpcds_sf1000_nopkfk/shape/query28.out | 75 + .../tpcds_sf1000_nopkfk/shape/query29.out | 43 + .../tpcds_sf1000_nopkfk/shape/query3.out | 26 + .../tpcds_sf1000_nopkfk/shape/query30.out | 41 + .../tpcds_sf1000_nopkfk/shape/query31.out | 73 + .../tpcds_sf1000_nopkfk/shape/query32.out | 26 + .../tpcds_sf1000_nopkfk/shape/query33.out | 83 + .../tpcds_sf1000_nopkfk/shape/query34.out | 32 + .../tpcds_sf1000_nopkfk/shape/query35.out | 47 + .../tpcds_sf1000_nopkfk/shape/query36.out | 33 + .../tpcds_sf1000_nopkfk/shape/query37.out | 27 + .../tpcds_sf1000_nopkfk/shape/query38.out | 53 + .../tpcds_sf1000_nopkfk/shape/query39.out | 31 + .../tpcds_sf1000_nopkfk/shape/query4.out | 91 + .../tpcds_sf1000_nopkfk/shape/query40.out | 30 + .../tpcds_sf1000_nopkfk/shape/query41.out | 23 + .../tpcds_sf1000_nopkfk/shape/query42.out | 26 + .../tpcds_sf1000_nopkfk/shape/query43.out | 25 + .../tpcds_sf1000_nopkfk/shape/query44.out | 71 + .../tpcds_sf1000_nopkfk/shape/query45.out | 35 + .../tpcds_sf1000_nopkfk/shape/query46.out | 38 + .../tpcds_sf1000_nopkfk/shape/query47.out | 43 + .../tpcds_sf1000_nopkfk/shape/query48.out | 29 + .../tpcds_sf1000_nopkfk/shape/query49.out | 107 + .../tpcds_sf1000_nopkfk/shape/query5.out | 77 + .../tpcds_sf1000_nopkfk/shape/query50.out | 29 + .../tpcds_sf1000_nopkfk/shape/query51.out | 40 + .../tpcds_sf1000_nopkfk/shape/query52.out | 26 + .../tpcds_sf1000_nopkfk/shape/query53.out | 31 + .../tpcds_sf1000_nopkfk/shape/query54.out | 74 + .../tpcds_sf1000_nopkfk/shape/query55.out | 26 + .../tpcds_sf1000_nopkfk/shape/query56.out | 83 + .../tpcds_sf1000_nopkfk/shape/query57.out | 43 + .../tpcds_sf1000_nopkfk/shape/query58.out | 86 + .../tpcds_sf1000_nopkfk/shape/query59.out | 45 + .../tpcds_sf1000_nopkfk/shape/query6.out | 47 + .../tpcds_sf1000_nopkfk/shape/query60.out | 83 + .../tpcds_sf1000_nopkfk/shape/query61.out | 70 + .../tpcds_sf1000_nopkfk/shape/query62.out | 29 + .../tpcds_sf1000_nopkfk/shape/query63.out | 31 + .../tpcds_sf1000_nopkfk/shape/query64.out | 102 + .../tpcds_sf1000_nopkfk/shape/query65.out | 43 + .../tpcds_sf1000_nopkfk/shape/query66.out | 61 + .../tpcds_sf1000_nopkfk/shape/query67.out | 42 + .../tpcds_sf1000_nopkfk/shape/query68.out | 40 + .../tpcds_sf1000_nopkfk/shape/query69.out | 47 + .../tpcds_sf1000_nopkfk/shape/query7.out | 31 + .../tpcds_sf1000_nopkfk/shape/query70.out | 44 + .../tpcds_sf1000_nopkfk/shape/query71.out | 36 + .../tpcds_sf1000_nopkfk/shape/query72.out | 58 + .../tpcds_sf1000_nopkfk/shape/query73.out | 32 + .../tpcds_sf1000_nopkfk/shape/query74.out | 63 + .../tpcds_sf1000_nopkfk/shape/query75.out | 68 + .../tpcds_sf1000_nopkfk/shape/query76.out | 38 + .../tpcds_sf1000_nopkfk/shape/query77.out | 101 + .../tpcds_sf1000_nopkfk/shape/query78.out | 57 + .../tpcds_sf1000_nopkfk/shape/query79.out | 32 + .../tpcds_sf1000_nopkfk/shape/query8.out | 47 + .../tpcds_sf1000_nopkfk/shape/query80.out | 100 + .../tpcds_sf1000_nopkfk/shape/query81.out | 41 + .../tpcds_sf1000_nopkfk/shape/query82.out | 27 + .../tpcds_sf1000_nopkfk/shape/query83.out | 80 + .../tpcds_sf1000_nopkfk/shape/query84.out | 31 + .../tpcds_sf1000_nopkfk/shape/query85.out | 46 + .../tpcds_sf1000_nopkfk/shape/query86.out | 28 + .../tpcds_sf1000_nopkfk/shape/query87.out | 51 + .../tpcds_sf1000_nopkfk/shape/query88.out | 171 + .../tpcds_sf1000_nopkfk/shape/query89.out | 31 + .../tpcds_sf1000_nopkfk/shape/query9.out | 115 + .../tpcds_sf1000_nopkfk/shape/query90.out | 47 + .../tpcds_sf1000_nopkfk/shape/query91.out | 41 + .../tpcds_sf1000_nopkfk/shape/query92.out | 25 + .../tpcds_sf1000_nopkfk/shape/query93.out | 21 + .../tpcds_sf1000_nopkfk/shape/query94.out | 35 + .../tpcds_sf1000_nopkfk/shape/query95.out | 44 + .../tpcds_sf1000_nopkfk/shape/query96.out | 26 + .../tpcds_sf1000_nopkfk/shape/query97.out | 35 + .../tpcds_sf1000_nopkfk/shape/query98.out | 26 + .../tpcds_sf1000_nopkfk/shape/query99.out | 29 + .../data/shape_check/tpch_sf1000/hint/q10.out | 7 +- .../data/shape_check/tpch_sf1000/hint/q3.out | 7 +- .../shape_check/tpch_sf1000/rf_prune/q10.out | 29 +- .../shape_check/tpch_sf1000/rf_prune/q3.out | 7 +- .../shape_check/tpch_sf1000/shape/q10.out | 29 +- .../shape_check/tpch_sf1000/shape/q13.out | 11 +- .../data/shape_check/tpch_sf1000/shape/q3.out | 7 +- .../nereids_p0/eager_agg/eager_agg.groovy | 435 ++ .../suites/nereids_p0/eager_agg/load.groovy | 299 + .../eager_aggregate/basic.groovy | 203 - .../eager_aggregate/basic_one_side.groovy | 204 - ...distinct_through_join_one_side_cust.groovy | 130 - ...ount_distinct_through_join_one_side.groovy | 259 - .../push_down_count_through_join.groovy | 429 -- ...sh_down_count_through_join_one_side.groovy | 524 -- .../push_down_max_through_join.groovy | 261 - ..._min_distinct_through_join_one_side.groovy | 257 - .../push_down_min_through_join.groovy | 260 - ..._sum_distinct_through_join_one_side.groovy | 253 - .../push_down_sum_through_join.groovy | 259 - ...push_down_sum_through_join_one_side.groovy | 259 - .../shape_check/tpcds_sf1000/load.groovy | 5080 ++++++++--------- .../tpcds_sf1000_nopkfk/load.groovy | 2520 ++++++++ .../tpcds_sf1000_nopkfk/shape/query1.groovy | 86 + .../tpcds_sf1000_nopkfk/shape/query10.groovy | 154 + .../tpcds_sf1000_nopkfk/shape/query11.groovy | 198 + .../tpcds_sf1000_nopkfk/shape/query12.groovy | 104 + .../tpcds_sf1000_nopkfk/shape/query13.groovy | 140 + .../tpcds_sf1000_nopkfk/shape/query14.groovy | 244 + .../tpcds_sf1000_nopkfk/shape/query15.groovy | 76 + .../tpcds_sf1000_nopkfk/shape/query16.groovy | 98 + .../tpcds_sf1000_nopkfk/shape/query17.groovy | 126 + .../tpcds_sf1000_nopkfk/shape/query18.groovy | 104 + .../tpcds_sf1000_nopkfk/shape/query19.groovy | 86 + .../tpcds_sf1000_nopkfk/shape/query2.groovy | 156 + .../tpcds_sf1000_nopkfk/shape/query20.groovy | 96 + .../tpcds_sf1000_nopkfk/shape/query21.groovy | 97 + .../tpcds_sf1000_nopkfk/shape/query22.groovy | 76 + .../tpcds_sf1000_nopkfk/shape/query23.groovy | 143 + .../tpcds_sf1000_nopkfk/shape/query24.groovy | 146 + .../tpcds_sf1000_nopkfk/shape/query25.groovy | 132 + .../tpcds_sf1000_nopkfk/shape/query26.groovy | 78 + .../tpcds_sf1000_nopkfk/shape/query27.groovy | 82 + .../tpcds_sf1000_nopkfk/shape/query28.groovy | 142 + .../tpcds_sf1000_nopkfk/shape/query29.groovy | 130 + .../tpcds_sf1000_nopkfk/shape/query3.groovy | 78 + .../tpcds_sf1000_nopkfk/shape/query30.groovy | 98 + .../tpcds_sf1000_nopkfk/shape/query31.groovy | 140 + .../tpcds_sf1000_nopkfk/shape/query32.groovy | 95 + .../tpcds_sf1000_nopkfk/shape/query33.groovy | 186 + .../tpcds_sf1000_nopkfk/shape/query34.groovy | 98 + .../tpcds_sf1000_nopkfk/shape/query35.groovy | 152 + .../tpcds_sf1000_nopkfk/shape/query36.groovy | 96 + .../tpcds_sf1000_nopkfk/shape/query37.groovy | 70 + .../tpcds_sf1000_nopkfk/shape/query38.groovy | 85 + .../tpcds_sf1000_nopkfk/shape/query39.groovy | 90 + .../tpcds_sf1000_nopkfk/shape/query4.groovy | 268 + .../tpcds_sf1000_nopkfk/shape/query40.groovy | 92 + .../tpcds_sf1000_nopkfk/shape/query41.groovy | 140 + .../tpcds_sf1000_nopkfk/shape/query42.groovy | 80 + .../tpcds_sf1000_nopkfk/shape/query43.groovy | 74 + .../tpcds_sf1000_nopkfk/shape/query44.groovy | 106 + .../tpcds_sf1000_nopkfk/shape/query45.groovy | 76 + .../tpcds_sf1000_nopkfk/shape/query46.groovy | 106 + .../tpcds_sf1000_nopkfk/shape/query47.groovy | 138 + .../tpcds_sf1000_nopkfk/shape/query48.groovy | 170 + .../tpcds_sf1000_nopkfk/shape/query49.groovy | 294 + .../tpcds_sf1000_nopkfk/shape/query5.groovy | 292 + .../tpcds_sf1000_nopkfk/shape/query50.groovy | 154 + .../tpcds_sf1000_nopkfk/shape/query51.groovy | 126 + .../tpcds_sf1000_nopkfk/shape/query52.groovy | 80 + .../tpcds_sf1000_nopkfk/shape/query53.groovy | 92 + .../tpcds_sf1000_nopkfk/shape/query54.groovy | 148 + .../tpcds_sf1000_nopkfk/shape/query55.groovy | 64 + .../tpcds_sf1000_nopkfk/shape/query56.groovy | 174 + .../tpcds_sf1000_nopkfk/shape/query57.groovy | 132 + .../tpcds_sf1000_nopkfk/shape/query58.groovy | 166 + .../tpcds_sf1000_nopkfk/shape/query59.groovy | 124 + .../tpcds_sf1000_nopkfk/shape/query6.groovy | 88 + .../tpcds_sf1000_nopkfk/shape/query60.groovy | 192 + .../tpcds_sf1000_nopkfk/shape/query61.groovy | 124 + .../tpcds_sf1000_nopkfk/shape/query62.groovy | 106 + .../tpcds_sf1000_nopkfk/shape/query63.groovy | 94 + .../tpcds_sf1000_nopkfk/shape/query64.groovy | 279 + .../tpcds_sf1000_nopkfk/shape/query65.groovy | 94 + .../tpcds_sf1000_nopkfk/shape/query66.groovy | 476 ++ .../tpcds_sf1000_nopkfk/shape/query67.groovy | 124 + .../tpcds_sf1000_nopkfk/shape/query68.groovy | 120 + .../tpcds_sf1000_nopkfk/shape/query69.groovy | 130 + .../tpcds_sf1000_nopkfk/shape/query7.groovy | 78 + .../tpcds_sf1000_nopkfk/shape/query70.groovy | 112 + .../tpcds_sf1000_nopkfk/shape/query71.groovy | 116 + .../tpcds_sf1000_nopkfk/shape/query72.groovy | 94 + .../tpcds_sf1000_nopkfk/shape/query73.groovy | 92 + .../tpcds_sf1000_nopkfk/shape/query74.groovy | 158 + .../tpcds_sf1000_nopkfk/shape/query75.groovy | 176 + .../tpcds_sf1000_nopkfk/shape/query76.groovy | 84 + .../tpcds_sf1000_nopkfk/shape/query77.groovy | 252 + .../tpcds_sf1000_nopkfk/shape/query78.groovy | 152 + .../tpcds_sf1000_nopkfk/shape/query79.groovy | 82 + .../tpcds_sf1000_nopkfk/shape/query8.groovy | 253 + .../tpcds_sf1000_nopkfk/shape/query80.groovy | 228 + .../tpcds_sf1000_nopkfk/shape/query81.groovy | 98 + .../tpcds_sf1000_nopkfk/shape/query82.groovy | 70 + .../tpcds_sf1000_nopkfk/shape/query83.groovy | 170 + .../tpcds_sf1000_nopkfk/shape/query84.groovy | 78 + .../tpcds_sf1000_nopkfk/shape/query85.groovy | 204 + .../tpcds_sf1000_nopkfk/shape/query86.groovy | 88 + .../tpcds_sf1000_nopkfk/shape/query87.groovy | 82 + .../tpcds_sf1000_nopkfk/shape/query88.groovy | 224 + .../tpcds_sf1000_nopkfk/shape/query89.groovy | 92 + .../tpcds_sf1000_nopkfk/shape/query9.groovy | 139 + .../tpcds_sf1000_nopkfk/shape/query90.groovy | 80 + .../tpcds_sf1000_nopkfk/shape/query91.groovy | 98 + .../tpcds_sf1000_nopkfk/shape/query92.groovy | 96 + .../tpcds_sf1000_nopkfk/shape/query93.groovy | 72 + .../tpcds_sf1000_nopkfk/shape/query94.groovy | 94 + .../tpcds_sf1000_nopkfk/shape/query95.groovy | 100 + .../tpcds_sf1000_nopkfk/shape/query96.groovy | 68 + .../tpcds_sf1000_nopkfk/shape/query97.groovy | 89 + .../tpcds_sf1000_nopkfk/shape/query98.groovy | 102 + .../tpcds_sf1000_nopkfk/shape/query99.groovy | 106 + 282 files changed, 25160 insertions(+), 12413 deletions(-) delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java create mode 100644 fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java create mode 100644 regression-test/data/nereids_p0/eager_agg/eager_agg.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/basic.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/basic_one_side.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_max_through_join.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_through_join.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out delete mode 100644 regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query1.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query10.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query11.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query12.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query13.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query14.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query15.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query16.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query17.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query18.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query19.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query2.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query20.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query21.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query22.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query23.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query24.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query25.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query26.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query27.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query28.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query29.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query3.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query30.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query31.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query32.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query33.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query34.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query35.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query36.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query37.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query38.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query39.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query4.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query40.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query41.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query42.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query43.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query44.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query45.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query46.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query47.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query48.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query49.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query5.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query50.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query51.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query52.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query53.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query54.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query55.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query56.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query57.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query58.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query59.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query6.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query60.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query61.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query62.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query63.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query64.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query65.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query66.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query67.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query68.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query69.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query7.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query70.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query71.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query73.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query74.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query75.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query76.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query77.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query78.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query79.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query8.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query80.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query81.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query82.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query83.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query84.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query85.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query86.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query87.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query88.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query89.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query9.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query90.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query91.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query92.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query93.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query94.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query95.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query96.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query97.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query98.out create mode 100644 regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query99.out create mode 100644 regression-test/suites/nereids_p0/eager_agg/eager_agg.groovy create mode 100644 regression-test/suites/nereids_p0/eager_agg/load.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/basic.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/basic_one_side.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_aggr_distinct_through_join_one_side_cust.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_max_through_join.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_through_join.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.groovy delete mode 100644 regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/load.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query1.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query10.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query11.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query12.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query13.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query14.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query15.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query16.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query17.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query18.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query19.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query2.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query20.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query21.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query22.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query23.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query24.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query25.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query26.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query27.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query28.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query29.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query3.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query30.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query31.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query32.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query33.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query34.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query35.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query36.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query37.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query38.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query39.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query4.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query40.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query41.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query42.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query43.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query44.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query45.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query46.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query47.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query48.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query49.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query5.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query50.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query51.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query52.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query53.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query54.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query55.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query56.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query57.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query58.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query59.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query6.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query60.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query61.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query62.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query63.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query64.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query65.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query66.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query67.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query68.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query69.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query7.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query70.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query71.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query72.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query73.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query74.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query75.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query76.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query77.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query78.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query79.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query8.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query80.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query81.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query82.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query83.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query84.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query85.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query86.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query87.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query88.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query89.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query9.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query90.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query91.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query92.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query93.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query94.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query95.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query96.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query97.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query98.groovy create mode 100644 regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query99.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java index 1615f3b6712f76..57192e8ab8d5c9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java @@ -173,7 +173,6 @@ import org.apache.doris.nereids.rules.rewrite.batch.CorrelateApplyToUnCorrelateApply; import org.apache.doris.nereids.rules.rewrite.batch.EliminateUselessPlanUnderApply; import org.apache.doris.nereids.rules.rewrite.eageraggregation.PushDownAggregation; -import org.apache.doris.nereids.rules.rewrite.eageraggregation.PushdownSumIfAggregation; import org.apache.doris.nereids.trees.plans.algebra.SetOperation; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; import org.apache.doris.nereids.trees.plans.logical.LogicalApply; @@ -684,7 +683,6 @@ public class Rewriter extends AbstractBatchJobExecutor { )), costBased(custom(RuleType.PUSH_DOWN_DISTINCT_THROUGH_JOIN, PushDownDistinctThroughJoin::new)), - custom(RuleType.PUSH_DOWN_AGG_THROUGH_JOIN, PushdownSumIfAggregation::new), custom(RuleType.PUSH_DOWN_AGG_THROUGH_JOIN, PushDownAggregation::new), topDown(new PushCountIntoUnionAll()) ), @@ -922,42 +920,41 @@ private static List getWholeTreeRewriteJobs( custom(RuleType.DISTINCT_AGG_STRATEGY_SELECTOR, () -> DistinctAggStrategySelector.INSTANCE)))); - // Rewrite search function before VariantSubPathPruning - // so that ElementAt expressions from search can be processed - rewriteJobs.addAll(jobs( - bottomUp(new RewriteSearchToSlots()) - )); + // Rewrite search function before VariantSubPathPruning + // so that ElementAt expressions from search can be processed + rewriteJobs.addAll(jobs( + bottomUp(new RewriteSearchToSlots()) + )); - if (needSubPathPushDown) { - rewriteJobs.addAll(jobs( - topic("variant element_at push down", - custom(RuleType.VARIANT_SUB_PATH_PRUNING, VariantSubPathPruning::new) - ) - )); - } - rewriteJobs.add( - topic("nested column prune", - custom(RuleType.NESTED_COLUMN_PRUNING, NestedColumnPruning::new) - ) - ); + if (needSubPathPushDown) { rewriteJobs.addAll(jobs( - topic("rewrite cte sub-tree after sub path push down", - custom(RuleType.CLEAR_CONTEXT_STATUS, ClearContextStatus::new), - custom(RuleType.REWRITE_CTE_CHILDREN, - () -> new RewriteCteChildren(afterPushDownJobs, runCboRules) - ) - ), - topic("whole plan check", - custom(RuleType.ADJUST_NULLABLE, () -> new AdjustNullable(false)) - ), - // NullableDependentExpressionRewrite need to be done after nullable fixed - topic("condition function", bottomUp(ImmutableList.of( - new NullableDependentExpressionRewrite()))) + topic("variant element_at push down", + custom(RuleType.VARIANT_SUB_PATH_PRUNING, VariantSubPathPruning::new) + ) )); - return rewriteJobs; } - )); - return builder.build(); + rewriteJobs.add( + topic("nested column prune", + custom(RuleType.NESTED_COLUMN_PRUNING, NestedColumnPruning::new) + ) + ); + rewriteJobs.addAll(jobs( + topic("rewrite cte sub-tree after sub path push down", + custom(RuleType.CLEAR_CONTEXT_STATUS, ClearContextStatus::new), + custom(RuleType.REWRITE_CTE_CHILDREN, + () -> new RewriteCteChildren(afterPushDownJobs, runCboRules) + ) + ), + topic("whole plan check", + custom(RuleType.ADJUST_NULLABLE, () -> new AdjustNullable(false)) + ), + // NullableDependentExpressionRewrite need to be done after nullable fixed + topic("condition function", bottomUp(ImmutableList.of( + new NullableDependentExpressionRewrite()))) + )); + return rewriteJobs; + } + ); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java index d2a12e82f59148..d0d3d33822db01 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java @@ -17,8 +17,6 @@ package org.apache.doris.nereids.rules.rewrite; -import org.apache.doris.common.util.DebugUtil; -import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.jobs.JobContext; import org.apache.doris.nereids.properties.OrderKey; import org.apache.doris.nereids.trees.expressions.Alias; @@ -52,6 +50,7 @@ import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; import org.apache.doris.nereids.util.ExpressionUtils; import org.apache.doris.qe.ConnectContext; +import org.apache.doris.qe.SessionVariable; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -59,8 +58,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.util.LinkedHashMap; import java.util.List; @@ -74,25 +71,10 @@ * So, we need add a rule to adjust all expression's nullable attribute after rewrite. */ public class AdjustNullable extends DefaultPlanRewriter> implements CustomRewriter { - - private static final Logger LOG = LogManager.getLogger(AdjustNullable.class); - private final boolean isAnalyzedPhase; - /** - * When check is true, if we find a slot that is non-nullable in the plan, - * but we infer it should be nullable from the plan's subtree, and fe_debug is true, - * then throw an exception. - */ - private final boolean check; - - public AdjustNullable(boolean isAnalyzedPhase, boolean check) { - this.isAnalyzedPhase = isAnalyzedPhase; - this.check = check; - } - public AdjustNullable(boolean isAnalyzedPhase) { - this(isAnalyzedPhase, !isAnalyzedPhase); + this.isAnalyzedPhase = isAnalyzedPhase; } @Override @@ -460,7 +442,7 @@ private Optional updateExpression(Optional input, private Optional updateExpression(T input, Map replaceMap, boolean debugCheck) { AtomicBoolean changed = new AtomicBoolean(false); - Expression replaced = doUpdateExpression(changed, input, replaceMap, check && debugCheck); + Expression replaced = doUpdateExpression(changed, input, replaceMap, !isAnalyzedPhase && debugCheck); return changed.get() ? Optional.of((T) replaced) : Optional.empty(); } @@ -497,14 +479,9 @@ private static Expression doUpdateExpression(AtomicBoolean changed, Expression i // repeat may check fail. if (!slotReference.nullable() && newSlotReference.nullable() && check && ConnectContext.get() != null) { - if (ConnectContext.get().getSessionVariable().feDebug) { - throw new AnalysisException("AdjustNullable convert slot " + slotReference - + " from not-nullable to nullable. You can disable check by set fe_debug = false."); - } else { - LOG.warn("adjust nullable convert slot '" + slotReference - + "' from not-nullable to nullable for query " - + DebugUtil.printId(ConnectContext.get().queryId())); - } + SessionVariable.throwAnalysisExceptionWhenFeDebug("AdjustNullable convert slot " + + slotReference + + " from not-nullable to nullable. You can disable check by set fe_debug = false."); } return newSlotReference; } else { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ColumnPruning.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ColumnPruning.java index cc2eb7d2057dce..685fc984960f91 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ColumnPruning.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ColumnPruning.java @@ -59,7 +59,6 @@ import org.apache.doris.qe.ConnectContext; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.roaringbitmap.RoaringBitmap; @@ -69,7 +68,6 @@ import java.util.Optional; import java.util.Set; import java.util.function.Function; -import java.util.stream.IntStream; /** * ColumnPruning. @@ -221,28 +219,21 @@ public Plan visitLogicalUnion(LogicalUnion union, PruneContext context) { } LogicalUnion prunedOutputUnion = pruneUnionOutput(union, context); // start prune children of union - List originOutput = union.getOutput(); - Set prunedOutput = prunedOutputUnion.getOutputSet(); - List prunedOutputIndexes = IntStream.range(0, originOutput.size()) - .filter(index -> prunedOutput.contains(originOutput.get(index))) - .boxed() - .collect(ImmutableList.toImmutableList()); - ImmutableList.Builder prunedChildren = ImmutableList.builder(); ImmutableList.Builder> prunedChildrenOutputs = ImmutableList.builder(); for (int i = 0; i < prunedOutputUnion.arity(); i++) { List regularChildOutputs = prunedOutputUnion.getRegularChildOutput(i); RoaringBitmap prunedChildOutputExprIds = new RoaringBitmap(); - Builder prunedChildOutputBuilder - = ImmutableList.builderWithExpectedSize(regularChildOutputs.size()); - for (Integer index : prunedOutputIndexes) { - SlotReference slot = regularChildOutputs.get(index); - prunedChildOutputBuilder.add(slot); - prunedChildOutputExprIds.add(slot.getExprId().asInt()); - } - - List prunedChildOutput = prunedChildOutputBuilder.build(); + //Builder prunedChildOutputBuilder + // = ImmutableList.builderWithExpectedSize(regularChildOutputs.size()); + //for (Integer index : prunedOutputIndexes) { + // SlotReference slot = regularChildOutputs.get(index); + // prunedChildOutputBuilder.add(slot); + // prunedChildOutputExprIds.add(slot.getExprId().asInt()); + //} + regularChildOutputs.forEach(col -> prunedChildOutputExprIds.add(col.getExprId().asInt())); + List prunedChildOutput = regularChildOutputs; //prunedChildOutputBuilder.build(); Plan prunedChild = doPruneChild( prunedOutputUnion, prunedOutputUnion.child(i), prunedChildOutputExprIds, prunedChildOutput, true @@ -420,15 +411,15 @@ private LogicalUnion pruneUnionOutput(LogicalUnion union, PruneContext context) extractColumnIndex.add(i); } } - ImmutableList.Builder> prunedConstantExprsList = ImmutableList.builderWithExpectedSize(constantExprsList.size()); + List> prunedRegularChildrenOutputs = + Lists.newArrayListWithCapacity(regularChildrenOutputs.size()); if (prunedOutputs.isEmpty()) { // process prune all columns NamedExpression originSlot = originOutput.get(0); prunedOutputs = ImmutableList.of(new SlotReference(originSlot.getExprId(), originSlot.getName(), TinyIntType.INSTANCE, false, originSlot.getQualifier())); - regularChildrenOutputs = Lists.newArrayListWithCapacity(regularChildrenOutputs.size()); children = Lists.newArrayListWithCapacity(children.size()); for (int i = 0; i < union.getArity(); i++) { Plan child = union.child(i); @@ -442,28 +433,36 @@ private LogicalUnion pruneUnionOutput(LogicalUnion union, PruneContext context) } else { project = new LogicalProject<>(newProjectOutput, child); } - regularChildrenOutputs.add((List) project.getOutput()); + prunedRegularChildrenOutputs.add((List) project.getOutput()); children.add(project); } for (int i = 0; i < constantExprsList.size(); i++) { prunedConstantExprsList.add(ImmutableList.of(new Alias(new TinyIntLiteral((byte) 1)))); } } else { - int len = extractColumnIndex.size(); + int prunedOutputSize = extractColumnIndex.size(); for (List row : constantExprsList) { - ImmutableList.Builder newRow = ImmutableList.builderWithExpectedSize(len); + ImmutableList.Builder newRow = ImmutableList.builderWithExpectedSize(prunedOutputSize); for (int idx : extractColumnIndex) { newRow.add(row.get(idx)); } prunedConstantExprsList.add(newRow.build()); } + + for (int childIdx = 0; childIdx < union.getRegularChildrenOutputs().size(); childIdx++) { + List regular = Lists.newArrayListWithExpectedSize(prunedOutputSize); + for (int colIdx : extractColumnIndex) { + regular.add(regularChildrenOutputs.get(childIdx).get(colIdx)); + } + prunedRegularChildrenOutputs.add(regular); + } } if (prunedOutputs.equals(originOutput) && !context.requiredSlotsIds.isEmpty()) { return union; } else { return union.withNewOutputsChildrenAndConstExprsList(prunedOutputs, children, - regularChildrenOutputs, prunedConstantExprsList.build()); + prunedRegularChildrenOutputs, prunedConstantExprsList.build()); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/OrExpansion.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/OrExpansion.java index cf06ee608c14dd..cb3067c18593aa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/OrExpansion.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/OrExpansion.java @@ -176,10 +176,13 @@ public Plan visitLogicalJoin(LogicalJoin join, O } //4. union all joins and put producers to context List> childrenOutputs = joins.stream() - .map(j -> j.getOutput().stream() + .map(j -> j.getOutput().stream() //.map(j -> j.getOutput().stream().distinct() .map(SlotReference.class::cast) .collect(ImmutableList.toImmutableList())) .collect(ImmutableList.toImmutableList()); + //LogicalUnion union = new LogicalUnion(Qualifier.ALL, + // new ArrayList<>(join.getOutput().stream().distinct().collect(Collectors.toList())), + // childrenOutputs, ImmutableList.of(), false, joins); LogicalUnion union = new LogicalUnion(Qualifier.ALL, new ArrayList<>(join.getOutput()), childrenOutputs, ImmutableList.of(), false, joins); ctx.cteProducerList.add(leftProducer); @@ -319,8 +322,26 @@ private List expandInnerJoin(CascadesContext ctx, Pair, LogicalCTEConsumer left = new LogicalCTEConsumer(ctx.getStatementContext().getNextRelationId(), leftProducer.getCteId(), "", leftProducer); + List leftOutput = new ArrayList<>(); + for (Slot producerOutputSlot : leftProducer.getOutput()) { + for (Slot consumerSlot : left.getProducerToConsumerOutputMap().get(producerOutputSlot)) { + if (!leftOutput.contains(consumerSlot)) { + leftOutput.add(consumerSlot); + break; + } + } + } LogicalCTEConsumer right = new LogicalCTEConsumer(ctx.getStatementContext().getNextRelationId(), rightProducer.getCteId(), "", rightProducer); + List rightOutput = new ArrayList<>(); + for (Slot producerOutputSlot : rightProducer.getOutput()) { + for (Slot consumerSlot : right.getProducerToConsumerOutputMap().get(producerOutputSlot)) { + if (!rightOutput.contains(consumerSlot)) { + rightOutput.add(consumerSlot); + break; + } + } + } ctx.putCTEIdToConsumer(left); ctx.putCTEIdToConsumer(right); @@ -335,7 +356,10 @@ private List expandInnerJoin(CascadesContext ctx, Pair, LogicalJoin newJoin = new LogicalJoin<>( JoinType.INNER_JOIN, hashCond, otherCond, join.getDistributeHint(), - join.getMarkJoinSlotReference(), left, right, null); + join.getMarkJoinSlotReference(), + new LogicalProject<>(leftOutput, left), + new LogicalProject<>(rightOutput, right), + null); if (newJoin.getHashJoinConjuncts().stream() .anyMatch(equalTo -> equalTo.children().stream().anyMatch(e -> !(e instanceof Slot)))) { Plan plan = PushDownExpressionsInHashCondition.pushDownHashExpression(newJoin); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java index f7ed45777f4e6c..4484ecf20237f9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -20,13 +20,14 @@ import org.apache.doris.nereids.rules.analysis.NormalizeAggregate; import org.apache.doris.nereids.rules.rewrite.StatsDerive; import org.apache.doris.nereids.stats.ExpressionEstimation; -// import org.apache.doris.nereids.stats.StatsCalculator; import org.apache.doris.nereids.trees.expressions.Alias; +import org.apache.doris.nereids.trees.expressions.Cast; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; +import org.apache.doris.nereids.trees.plans.JoinType; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; import org.apache.doris.nereids.trees.plans.logical.LogicalCatalogRelation; @@ -34,9 +35,9 @@ import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; import org.apache.doris.nereids.trees.plans.logical.LogicalProject; import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; +import org.apache.doris.nereids.trees.plans.logical.LogicalUnion; import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; -import org.apache.doris.nereids.util.ExpressionUtils; -import org.apache.doris.qe.ConnectContext; +import org.apache.doris.nereids.types.DataType; import org.apache.doris.qe.SessionVariable; import org.apache.doris.statistics.ColumnStatistic; import org.apache.doris.statistics.Statistics; @@ -44,11 +45,10 @@ import com.google.common.collect.Lists; import java.util.ArrayList; -import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.stream.Collectors; /** @@ -69,39 +69,87 @@ public class EagerAggRewriter extends DefaultPlanRewriter { private static final double LOWER_AGGREGATE_EFFECT_COEFFICIENT = 10000; private static final double LOW_AGGREGATE_EFFECT_COEFFICIENT = 1000; private static final double MEDIUM_AGGREGATE_EFFECT_COEFFICIENT = 100; - private final StatsDerive derive = new StatsDerive(true); + private final StatsDerive derive = new StatsDerive(false); @Override public Plan visitLogicalJoin(LogicalJoin join, PushDownAggContext context) { - List pushToLeft = new ArrayList<>(); - List pushToRight = new ArrayList<>(); - boolean toLeft = true; - boolean toRight = true; - for (AggregateFunction aggFunc : context.getAggFunctions()) { - if (join.left().getOutputSet().containsAll(aggFunc.getInputSlots())) { - pushToLeft.add(aggFunc); - toRight = false; - } else if (join.right().getOutputSet().containsAll(aggFunc.getInputSlots())) { - pushToRight.add(aggFunc); + boolean toLeft = false; + boolean toRight = false; + boolean pushHere = false; + if (context.getAggFunctions().isEmpty()) { + // select t1.v from t1 join t2 on t1.id = t2.id group by t1.v, t2.v + // if no agg function, try to push agg to the child which contains all group keys + // TODO: consider t1.rows/(t1.id, t1.v).ndv and t2.rows/(t2.id, t2.v).ndv to determine push target + if (join.left().getOutputSet().containsAll(context.getGroupKeys())) { + toLeft = true; + } else if (join.right().getOutputSet().containsAll(context.getGroupKeys())) { + toRight = true; + } else { + pushHere = true; + } + } else { + for (AggregateFunction aggFunc : context.getAggFunctions()) { + if (join.left().getOutputSet().containsAll(aggFunc.getInputSlots())) { + toLeft = true; + } else if (join.right().getOutputSet().containsAll(aggFunc.getInputSlots())) { + toRight = true; + } else { + pushHere = true; + } + } + } + + // Do not push aggregation to the nullable side of outer joins when agg function contains case-when. + // plan1: + // agg(max(case when t1.a is null then 1 else null end)) + // --> right join on false + // --> t1 + // --> t2 + // => + // plan2: + // agg(max(x)) + // --> right join on false + // --> agg((case when t1.a is null when 1 else null end) as x) + // --> t2 + // this transform is incorrect, because right join condition is false, then x is null, + // and the output is max(null)=null. + // but the output of plan1 should be 1 + if (context.aggregateOnCaseWhen) { + JoinType joinType = join.getJoinType(); + if (joinType.isFullOuterJoin()) { + return join; + } + if (joinType.isRightOuterJoin()) { toLeft = false; } - if (toLeft == toRight) { + if (joinType.isLeftOuterJoin()) { + toRight = false; + } + if (!toLeft && !toRight && !pushHere) { + return join; + } + } + + if (pushHere || (toLeft && toRight)) { + if (SessionVariable.isEagerAggregationOnJoin()) { + return genAggregate(join, context); + } else { return join; } } List joinConditionSlots; - List childGroupByKeys = new ArrayList<>(); + List childGroupByKeys = new ArrayList<>(); if (toLeft) { joinConditionSlots = getJoinConditionsInputSlotsFromOneSide(join, join.left()); - for (NamedExpression key : context.getGroupKeys()) { + for (SlotReference key : context.getGroupKeys()) { if (join.left().getOutputSet().containsAll(key.getInputSlots())) { childGroupByKeys.add(key); } } } else { joinConditionSlots = getJoinConditionsInputSlotsFromOneSide(join, join.right()); - for (NamedExpression key : context.getGroupKeys()) { + for (SlotReference key : context.getGroupKeys()) { if (join.right().getOutputSet().containsAll(key.getInputSlots())) { childGroupByKeys.add(key); } @@ -115,30 +163,33 @@ public Plan visitLogicalJoin(LogicalJoin join, P } PushDownAggContext childContext = context.withGroupKeys(childGroupByKeys); + if (!childContext.isValid()) { + return join; + } Statistics stats = join.right().getStats(); if (stats == null) { stats = join.right().accept(derive, new StatsDerive.DeriveContext()); } - if (stats.getRowCount() > PushDownAggContext.BIG_JOIN_BUILD_SIZE) { + if (stats.getRowCount() > PushDownAggContext.BIG_JOIN_BUILD_SIZE + || SessionVariable.getEagerAggregationMode() > 0) { childContext = childContext.passThroughBigJoin(); } if (toLeft) { Plan newLeft = join.left().accept(this, childContext); if (newLeft != join.left()) { - context.getFinalGroupKeys().addAll(childContext.getFinalGroupKeys()); return join.withChildren(newLeft, join.right()); } } else { Plan newRight = join.right().accept(this, childContext); if (newRight != join.right()) { - context.getFinalGroupKeys().addAll(childContext.getFinalGroupKeys()); return join.withChildren(join.left(), newRight); } } return join; } - private List getJoinConditionsInputSlotsFromOneSide(LogicalJoin join, + private List getJoinConditionsInputSlotsFromOneSide( + LogicalJoin join, Plan side) { List oneSideSlots = new ArrayList<>(); for (Expression condition : join.getHashJoinConjuncts()) { @@ -158,52 +209,187 @@ private List getJoinConditionsInputSlotsFromOneSide(LogicalJoin project, + private PushDownAggContext createContextFromProject( + LogicalProject project, PushDownAggContext context) { - HashMap replaceMapAliasBody = new HashMap<>(); - HashMap replaceMapAlias = new HashMap<>(); - for (NamedExpression ne : project.getProjects()) { - if (ne instanceof Alias) { - replaceMapAliasBody.put(ne.toSlot(), ((Alias) ne).child()); - replaceMapAlias.put(ne.toSlot(), ne); - } - } - /* * context: sum(a) groupBy(y+z as x, l) * proj: b+c as a, u+v as y, m+n as l * newContext: sum(b+c), groupBy((u+v)+z as x, m+n as l) */ - List groupKeys = new ArrayList<>(); - for (NamedExpression key : context.getGroupKeys()) { - NamedExpression newKey; - if (key instanceof Alias) { - newKey = (Alias) ExpressionUtils.replace(key, replaceMapAliasBody); - } else { - // key is slot - newKey = (NamedExpression) replaceMapAlias.getOrDefault(key, key); - } - groupKeys.add(newKey); + List groupKeys = new ArrayList<>(); + for (SlotReference key : context.getGroupKeys()) { + groupKeys.addAll( + project.pushDownExpressionPastProject(key).getInputSlots() + .stream().map(slot -> (SlotReference) slot).collect(Collectors.toList())); } List aggFunctions = new ArrayList<>(); - Map aliasMap = new HashMap<>(); + Map aliasMap = new IdentityHashMap<>(); for (AggregateFunction aggFunc : context.getAggFunctions()) { - AggregateFunction newAggFunc = (AggregateFunction) ExpressionUtils.replace(aggFunc, replaceMapAliasBody); + AggregateFunction newAggFunc = (AggregateFunction) project.pushDownExpressionPastProject(aggFunc); Alias alias = context.getAliasMap().get(aggFunc); aliasMap.put(newAggFunc, (Alias) alias.withChildren(newAggFunc)); aggFunctions.add(newAggFunc); } return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, - context.getCascadesContext(), context.isPassThroughBigJoin()); + context.getCascadesContext(), context.isPassThroughBigJoin(), context.aggregateOnCaseWhen); + } + + private boolean canPushThroughProject(LogicalProject project, PushDownAggContext context) { + for (SlotReference slot : context.getGroupKeys()) { + if (!project.getOutputSet().contains(slot)) { + SessionVariable.throwAnalysisExceptionWhenFeDebug("eager agg failed: can not find group key(" + + slot + ") in " + project); + return false; + } + } + for (Slot slot : context.getAggFunctionsInputSlots()) { + if (!project.getOutputSet().contains(slot)) { + SessionVariable.throwAnalysisExceptionWhenFeDebug("eager agg failed: can not find aggFunc slot(" + + slot + ") in " + project); + return false; + } + } + + // push sum(A) through project(x, x+y as A) + // if x is not used as group key, do not push through + for (Slot slot : context.getAggFunctionsInputSlots()) { + for (NamedExpression prj : project.getProjects()) { + if (prj instanceof Alias && prj.getExprId().equals(slot.getExprId())) { + if (prj.getInputSlots().stream() + .anyMatch( + s -> project.getOutputSet().contains(s) + && !context.getGroupKeys().contains(s))) { + return false; + } + } + } + } + + return true; + } + + private Plan alignUnionChildrenDataType(Plan child, PushDownAggContext context) { + int outputSize = child.getOutput().size(); + List outputDataType = Lists.newArrayListWithExpectedSize(outputSize); + outputDataType.addAll(context.getAggFunctions().stream() + .map(func -> context.getAliasMap().get(func).getDataType()).collect(Collectors.toList())); + outputDataType.addAll(context.getGroupKeys().stream().map(s -> s.getDataType()).collect(Collectors.toList())); + List projection = Lists.newArrayListWithExpectedSize(outputSize); + boolean needProject = false; + for (int colIdx = 0; colIdx < outputSize; colIdx++) { + SlotReference slot = (SlotReference) child.getOutput().get(colIdx); + if (!slot.getDataType().equals(outputDataType.get(colIdx))) { + projection.add(new Alias(new Cast(slot, outputDataType.get(colIdx)))); + needProject = true; + } else { + projection.add(slot); + } + } + if (needProject) { + return new LogicalProject(projection, child); + } else { + return child; + } + } + + @Override + public Plan visitLogicalUnion(LogicalUnion union, PushDownAggContext context) { + if (!union.getConstantExprsList().isEmpty()) { + return union; + } + + if (!union.getOutputs().stream().allMatch(e -> e instanceof SlotReference)) { + return union; + } + List newChildren = Lists.newArrayList(); + List childrenContext = new ArrayList<>(); + /* + if any child can not push, do not push + example + agg(output=[sum(a),min(a)], groupkey=[b]) + ->union(a, b) + ->child1(a1, b1) + ->child2(a2, b2) + if agg pushdown through child1, newChild1 output is (sum(a1), min(a1) b1) + but if agg can not pushdown through child2, the output of child2 is (a2, b2). + Output size of newChild1 and child2 are different + */ + boolean changed = false; + for (int idx = 0; idx < union.children().size(); idx++) { + Plan child = union.children().get(idx); + final int childIdx = idx; + List aggFunctionsForChild = new ArrayList<>(); + IdentityHashMap aliasMapForChild = new IdentityHashMap<>(); + for (AggregateFunction func : context.getAggFunctions()) { + AggregateFunction newFunc = (AggregateFunction) union.pushDownExpressionPastSetOperator(func, childIdx); + aggFunctionsForChild.add(newFunc); + Alias alias = context.getAliasMap().get(func); + // aliasForChild should have its own ExprId + Alias aliasForChild = new Alias(newFunc, alias.getName(), alias.getQualifier()); + aliasMapForChild.put(newFunc, aliasForChild); + } + + List groupKeysForChild = context.getGroupKeys().stream() + .map(slot -> (SlotReference) union.pushDownExpressionPastSetOperator(slot, childIdx)) + .collect(Collectors.toList()); + PushDownAggContext contextForChild = new PushDownAggContext(aggFunctionsForChild, groupKeysForChild, + aliasMapForChild, context.getCascadesContext(), + context.isPassThroughBigJoin(), context.aggregateOnCaseWhen); + childrenContext.add(contextForChild); + if (contextForChild.isValid()) { + Plan newChild = child.accept(this, contextForChild); + if (newChild != child) { + newChildren.add(newChild); + changed = true; + } else { + changed = false; + break; + } + } else { + // child(idx) cannot be rewritten, stop + break; + } + } + if (changed) { + for (int idx = 0; idx < union.children().size(); idx++) { + // all children need align data type + Plan newChild = alignUnionChildrenDataType(newChildren.get(idx), context); + newChildren.set(idx, newChild); + } + List> newRegularChildrenOutputs = Lists.newArrayListWithExpectedSize(union.arity()); + for (int childIdx = 0; childIdx < union.arity(); childIdx++) { + newRegularChildrenOutputs.add( + newChildren.get(childIdx).getOutput().stream() + .map(s -> (SlotReference) s).collect(Collectors.toList())); + } + + List newOutput = Lists.newArrayList(); + for (AggregateFunction func : context.getAggFunctions()) { + Alias alias = context.getAliasMap().get(func); + if (alias == null) { + SessionVariable.throwAnalysisExceptionWhenFeDebug("push down agg failed. union: " + union + + " context: " + context); + return union; + } + newOutput.add(alias.toSlot()); + } + newOutput.addAll(context.getGroupKeys()); + LogicalUnion newUnion = (LogicalUnion) union + .withChildrenAndOutputs(newChildren, newOutput, newRegularChildrenOutputs); + return newUnion; + } else { + return union; + } } @Override public Plan visitLogicalProject(LogicalProject project, PushDownAggContext context) { if (project.child() instanceof LogicalCatalogRelation || (project.child() instanceof LogicalFilter - && project.child().child(0) instanceof LogicalCatalogRelation)) { + && project.child().child(0) instanceof LogicalCatalogRelation)) { // project // --> scan // => @@ -213,26 +399,16 @@ public Plan visitLogicalProject(LogicalProject project, PushDown return genAggregate(project, context); } - // check validation - // all slots in context are projected - List slotsInContext = context.getGroupKeys().stream() - .flatMap(e -> e.getInputSlots().stream()).collect(Collectors.toList()); - slotsInContext.addAll(context.getAggFunctionsInputSlots()); - for (Slot slot : slotsInContext) { - if (!project.getOutputSet().contains(slot)) { - if (SessionVariable.isFeDebug()) { - throw new RuntimeException("push down failed: " + slot + " is not in project \n" - + project.treeString()); - } else { - return project; - } - } + if (!canPushThroughProject(project, context)) { + return genAggregate(project, context); } PushDownAggContext newContext = createContextFromProject(project, context); + if (!newContext.isValid()) { + return project; + } Plan newChild = project.child().accept(this, newContext); if (newChild != project.child()) { - context.getFinalGroupKeys().addAll(newContext.getFinalGroupKeys()); /* * agg[sum(a), groupBy(b)] * -> proj(a, b1+b2 as b) @@ -241,35 +417,37 @@ public Plan visitLogicalProject(LogicalProject project, PushDown * -> any(d, ...) * => * agg[sum(x), groupBy(b)] - * -> proj(x, b) + * -> proj(x, b1+b2 as b) * -> join(c=d) - * ->agg[sum(a) as x, groupBy(b, c)] - * ->proj(a, b1+b2 as b, c, ...) + * ->agg[sum(a) as x, groupBy(b1, b2, c)] + * ->proj(a, b1, b2, c, ...) * -> any(a, b1, b2, c) * -> any(d, ...) */ - Set aggFuncInputSlots = context.getAggFunctionsInputSlots(); List newProjections = new ArrayList<>(); - for (NamedExpression ne : project.getProjects()) { - if (aggFuncInputSlots.contains(ne.toSlot())) { - // ne (a) is replaced by alias slot (x) - continue; - } else if (context.getFinalGroupKeys().contains(ne.toSlot())) { - newProjections.add(ne.toSlot()); - } else { - newProjections.add(ne); - } + //for (Alias alias : context.getAliasMap().values()) { + // newProjections.add(alias.toSlot()); + //} + for (AggregateFunction aggFunc : context.getAggFunctions()) { + newProjections.add(context.getAliasMap().get(aggFunc).toSlot()); } - for (Alias alias : context.getAliasMap().values()) { - newProjections.add(alias.toSlot()); - } - for (SlotReference key : context.getFinalGroupKeys()) { - if (!newProjections.contains(key)) { - newProjections.add(key); + for (SlotReference slot : context.getGroupKeys()) { + boolean valid = false; + for (NamedExpression ne : project.getProjects()) { + if (ne.toSlot().getExprId().equals(slot.getExprId())) { + valid = true; + newProjections.add(ne); + break; + } + } + if (!valid) { + SessionVariable.throwAnalysisExceptionWhenFeDebug( + "push agg failed. slot: " + "not found in " + project); + return project; } } - - return project.withProjectsAndChild(newProjections, newChild); + LogicalProject result = new LogicalProject(newProjections, newChild); + return result; } return project; @@ -291,13 +469,12 @@ public Plan visitLogicalRelation(LogicalRelation relation, PushDownAggContext co } private Plan genAggregate(Plan child, PushDownAggContext context) { - if (checkStats(child, context)) { + if (context.isValid() && checkStats(child, context)) { List aggOutputExpressions = new ArrayList<>(); - aggOutputExpressions.addAll(context.getAliasMap().values()); - aggOutputExpressions.addAll(context.getGroupKeys()); - for (NamedExpression key : context.getGroupKeys()) { - context.addFinalGroupKey((SlotReference) key.toSlot()); + for (AggregateFunction func : context.getAggFunctions()) { + aggOutputExpressions.add(context.getAliasMap().get(func)); } + aggOutputExpressions.addAll(context.getGroupKeys()); LogicalAggregate genAgg = new LogicalAggregate(context.getGroupKeys(), aggOutputExpressions, child); NormalizeAggregate normalizeAggregate = new NormalizeAggregate(); return normalizeAggregate.normalizeAgg(genAgg, Optional.empty(), @@ -308,24 +485,26 @@ private Plan genAggregate(Plan child, PushDownAggContext context) { } private boolean checkStats(Plan plan, PushDownAggContext context) { - if (!context.isPassThroughBigJoin()) { - return false; - } - if (ConnectContext.get() == null) { - return false; - } - int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; + int mode = SessionVariable.getEagerAggregationMode(); if (mode < 0) { return false; } + if (mode > 0) { - return true; + // when mode=1, any join is regarded as big join in order to + // push down aggregation through at least one join + return context.isPassThroughBigJoin(); } + + if (!context.isPassThroughBigJoin() && !context.aggregateOnCaseWhen) { + return false; + } + Statistics stats = plan.getStats(); if (stats == null) { stats = plan.accept(derive, new StatsDerive.DeriveContext()); } - if (stats.getRowCount() == 0) { + if (stats.getRowCount() <= 0) { return false; } @@ -335,13 +514,16 @@ private boolean checkStats(Plan plan, PushDownAggContext context) { List medium = Lists.newArrayList(); List high = Lists.newArrayList(); - List[] cards = new List[] {lower, medium, high}; + List[] cards = new List[] { lower, medium, high }; for (NamedExpression key : context.getGroupKeys()) { ColumnStatistic colStats = ExpressionEstimation.INSTANCE.estimate(key, stats); if (colStats.isUnKnown) { return false; } + if (stats.getRowCount() * 0.9 <= colStats.ndv) { + return false; + } groupKeysStats.add(colStats); cards[groupByCardinality(colStats, stats.getRowCount())].add(colStats); } @@ -376,20 +558,17 @@ private boolean checkStats(Plan plan, PushDownAggContext context) { } // 3. Extremely low cardinality for lower with at most one medium or high. - double lowerCartesianLowerBound = - stats.getRowCount() / LOWER_AGGREGATE_EFFECT_COEFFICIENT; + double lowerCartesianLowerBound = stats.getRowCount() / LOWER_AGGREGATE_EFFECT_COEFFICIENT; if (high.size() + medium.size() == 1 && lower.size() <= 2 && lowerCartesian <= lowerCartesianLowerBound) { return true; - // StatsCalculator statsCalculator = new StatsCalculator(null); - // double estAggRowCount = statsCalculator.estimateGroupByRowCount(context.getGroupKeys(), stats); - // return estAggRowCount < lowerCartesianLowerBound; } return false; } // high(2): row_count / cardinality < MEDIUM_AGGREGATE_EFFECT_COEFFICIENT - // medium(1): row_count / cardinality >= MEDIUM_AGGREGATE_EFFECT_COEFFICIENT and < LOW_AGGREGATE_EFFECT_COEFFICIENT + // medium(1): row_count / cardinality >= MEDIUM_AGGREGATE_EFFECT_COEFFICIENT and + // < LOW_AGGREGATE_EFFECT_COEFFICIENT // lower(0): row_count / cardinality >= LOW_AGGREGATE_EFFECT_COEFFICIENT private int groupByCardinality(ColumnStatistic colStats, double rowCount) { if (rowCount == 0 || colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java index e9475bf7ac1d4c..6ef312fb0de42d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java @@ -19,33 +19,30 @@ import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.trees.expressions.Alias; -import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import java.util.LinkedHashSet; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; /** * PushDownAggContext */ public class PushDownAggContext { public static final int BIG_JOIN_BUILD_SIZE = 400_000; + public final boolean aggregateOnCaseWhen; private final List aggFunctions; - private final List groupKeys; - private final Map aliasMap; + private final List groupKeys; + private final HashMap aliasMap; private final Set aggFunctionsInputSlots; - // the group keys that eventually used to generate aggregation node - private final LinkedHashSet finalGroupKeys = new LinkedHashSet<>(); - // cascadesContext is used for normalizeAgg private final CascadesContext cascadesContext; @@ -55,44 +52,51 @@ public class PushDownAggContext { * constructor */ public PushDownAggContext(List aggFunctions, - List groupKeys, - CascadesContext cascadesContext) { - this(aggFunctions, groupKeys, null, cascadesContext, false); - } - - /** - * constructor - */ - public PushDownAggContext(List aggFunctions, - List groupKeys, Map aliasMap, CascadesContext cascadesContext, - boolean passThroughBigJoin) { - this.groupKeys = groupKeys; + List groupKeys, Map aliasMap, CascadesContext cascadesContext, + boolean passThroughBigJoin, boolean hasSumIf) { + this.groupKeys = groupKeys.stream().distinct().collect(Collectors.toList()); this.aggFunctions = ImmutableList.copyOf(aggFunctions); this.cascadesContext = cascadesContext; + HashMap builtAliasMap = new HashMap<>(); if (aliasMap == null) { - ImmutableMap.Builder aliasMapBuilder = ImmutableMap.builder(); for (AggregateFunction aggFunction : this.aggFunctions) { - Alias alias = new Alias(aggFunction, aggFunction.getName()); - aliasMapBuilder.put(aggFunction, alias); + builtAliasMap.put(aggFunction, new Alias(aggFunction, aggFunction.getName())); } - this.aliasMap = aliasMapBuilder.build(); } else { - this.aliasMap = aliasMap; + for (AggregateFunction aggFunction : this.aggFunctions) { + Alias alias = aliasMap.get(aggFunction); + if (alias == null) { + alias = new Alias(aggFunction, aggFunction.getName()); + } + builtAliasMap.put(aggFunction, alias); + } } + this.aliasMap = builtAliasMap; this.aggFunctionsInputSlots = aggFunctions.stream() .flatMap(aggFunction -> aggFunction.getInputSlots().stream()) .filter(Slot.class::isInstance) .collect(ImmutableSet.toImmutableSet()); this.passThroughBigJoin = passThroughBigJoin; + this.aggregateOnCaseWhen = hasSumIf; + } + + /** + * check validation + * @return true, if groupKeys is not empty and no group by key is in aggFunctionsInputSlots + */ + public boolean isValid() { + return !groupKeys.isEmpty() + && !groupKeys.stream().anyMatch(s -> aggFunctionsInputSlots.contains(s)); } public PushDownAggContext passThroughBigJoin() { - return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, true); + return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, + true, aggregateOnCaseWhen); } - public Map getAliasMap() { + public HashMap getAliasMap() { return aliasMap; } @@ -100,26 +104,19 @@ public List getAggFunctions() { return aggFunctions; } - public List getGroupKeys() { + public List getGroupKeys() { return groupKeys; } - public PushDownAggContext withGroupKeys(List groupKeys) { - return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, passThroughBigJoin); + public PushDownAggContext withGroupKeys(List groupKeys) { + return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, + cascadesContext, passThroughBigJoin, aggregateOnCaseWhen); } public Set getAggFunctionsInputSlots() { return aggFunctionsInputSlots; } - public LinkedHashSet getFinalGroupKeys() { - return finalGroupKeys; - } - - public void addFinalGroupKey(SlotReference key) { - this.finalGroupKeys.add(key); - } - public CascadesContext getCascadesContext() { return cascadesContext; } @@ -127,4 +124,14 @@ public CascadesContext getCascadesContext() { public boolean isPassThroughBigJoin() { return passThroughBigJoin; } + + @Override + public String toString() { + return "PushDownAggContext{" + + "aggFunctions=" + aggFunctions + + ", groupKeys=" + groupKeys + + ", aliasMap=" + aliasMap + + ", passThroughBigJoin=" + passThroughBigJoin + + '}'; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index 221b234117ac4a..07d94752437048 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -37,32 +37,33 @@ import org.apache.doris.nereids.jobs.JobContext; import org.apache.doris.nereids.rules.analysis.NormalizeAggregate; import org.apache.doris.nereids.rules.rewrite.AdjustNullable; -import org.apache.doris.nereids.trees.expressions.Alias; -import org.apache.doris.nereids.trees.expressions.Cast; -import org.apache.doris.nereids.trees.expressions.Divide; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.expressions.functions.Function; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; -import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; import org.apache.doris.nereids.trees.expressions.functions.agg.Count; import org.apache.doris.nereids.trees.expressions.functions.agg.Max; import org.apache.doris.nereids.trees.expressions.functions.agg.Min; +import org.apache.doris.nereids.trees.expressions.functions.agg.RollUpTrait; import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.scalar.If; +import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; import org.apache.doris.nereids.trees.plans.logical.LogicalFilter; import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; -import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; import org.apache.doris.nereids.trees.plans.logical.LogicalProject; import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; +import org.apache.doris.nereids.trees.plans.logical.LogicalUnion; import org.apache.doris.nereids.trees.plans.visitor.CustomRewriter; import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; -import org.apache.doris.nereids.types.DataType; import org.apache.doris.nereids.util.ExpressionUtils; -import org.apache.doris.qe.ConnectContext; import org.apache.doris.qe.SessionVariable; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,6 +74,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.stream.Collectors; /** * push down aggregation @@ -83,13 +85,13 @@ public class PushDownAggregation extends DefaultPlanRewriter impleme public final EagerAggRewriter writer = new EagerAggRewriter(); private final Set pushDownAggFunctionSet = Sets.newHashSet( - Sum.class, Count.class, - Avg.class, + Sum.class, Max.class, Min.class); private final Set acceptNodeType = Sets.newHashSet( + LogicalUnion.class, LogicalProject.class, LogicalFilter.class, LogicalRelation.class, @@ -97,11 +99,23 @@ public class PushDownAggregation extends DefaultPlanRewriter impleme @Override public Plan rewriteRoot(Plan plan, JobContext jobContext) { - int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; + if (SessionVariable.isFeDebug()) { + try { + new AdjustNullable(false).rewriteRoot(plan, null); + } catch (Exception e) { + LOG.warn("(PushDownAggregation) input plan has nullable problem", e); + return plan; + } + } + int mode = SessionVariable.getEagerAggregationMode(); if (mode < 0) { return plan; } else { - return plan.accept(this, jobContext); + Plan result = plan.accept(this, jobContext); + if (SessionVariable.isFeDebug()) { + result = new AdjustNullable(true).rewriteRoot(result, null); + } + return result; } } @@ -109,7 +123,6 @@ public Plan rewriteRoot(Plan plan, JobContext jobContext) { public Plan visitLogicalAggregate(LogicalAggregate agg, JobContext context) { Plan newChild = agg.child().accept(this, context); if (newChild != agg.child()) { - // TODO : push down upper aggregations return agg.withChildren(newChild); } @@ -117,55 +130,69 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte return agg; } - List aggFunctions = new ArrayList<>(); - - Map avgToSumCountMap = new HashMap<>(); - for (AggregateFunction aggFunction : agg.getAggregateFunctions()) { - if (pushDownAggFunctionSet.contains(aggFunction.getClass()) - && !aggFunction.isDistinct() - && (!(aggFunction instanceof Count) || (!((Count) aggFunction).isCountStar()))) { - if (aggFunction instanceof Avg) { - DataType targetType = aggFunction.getDataType(); - Sum sum = new Sum(aggFunction.child(0)); - Count count = new Count(aggFunction.child(0)); - if (!aggFunctions.contains(sum)) { - aggFunctions.add(sum); - } - if (!aggFunctions.contains(count)) { - aggFunctions.add(count); - } - Expression castSum = targetType.equals(sum.getDataType()) ? sum : new Cast(sum, targetType); - Expression castCount = targetType.equals(count.getDataType()) ? count : new Cast(count, targetType); - avgToSumCountMap.put((Avg) aggFunction, - new Divide(castSum, castCount)); - } else { - aggFunctions.add(aggFunction); - } + List groupKeys = new ArrayList<>(); + for (Expression groupKey : agg.getGroupByExpressions()) { + if (groupKey instanceof SlotReference) { + groupKeys.add((SlotReference) groupKey); } else { + SessionVariable.throwAnalysisExceptionWhenFeDebug( + "PushDownAggregation failed: agg is not normalized\n " + + agg.treeString()); return agg; } } - if (!checkSubTreePattern(agg.child())) { - return agg; - } + Set aggFunctions = Sets.newHashSet(); + boolean hasSumIf = false; + Map> aggFunctionsForOutputExpressions = Maps.newHashMap(); + for (NamedExpression aggOutput : agg.getOutputExpressions()) { + List funcs = Lists.newArrayList(); + aggFunctionsForOutputExpressions.put(aggOutput, funcs); + for (Object obj : aggOutput.collect(AggregateFunction.class::isInstance)) { + AggregateFunction aggFunction = (AggregateFunction) obj; + if (pushDownAggFunctionSet.contains(aggFunction.getClass()) + && !aggFunction.isDistinct()) { + if (aggFunction.arity() > 0 && aggFunction.child(0) instanceof If) { + If body = (If) (aggFunction).child(0); + Set valueSlots = Sets.newHashSet(body.getTrueValue().getInputSlots()); + valueSlots.addAll(body.getFalseValue().getInputSlots()); + if (body.getCondition().getInputSlots().stream().anyMatch(s -> valueSlots.contains(s))) { + // do not push down sum(if a then a else b) + return agg; + } + AggregateFunction aggTrue = (AggregateFunction) aggFunction.withChildren(body.getTrueValue()); + aggFunctions.add(aggTrue); + funcs.add(aggTrue); + if (!(body.getFalseValue() instanceof NullLiteral)) { + AggregateFunction aggFalse = + (AggregateFunction) aggFunction.withChildren(body.getFalseValue()); + aggFunctions.add(aggFalse); + funcs.add(aggFalse); + } + groupKeys.addAll(body.getCondition().getInputSlots() + .stream().map(slot -> (SlotReference) slot).collect(Collectors.toList())); + hasSumIf = true; + } else { + aggFunctions.add(aggFunction); + funcs.add(aggFunction); + } - List groupKeys = new ArrayList<>(); - for (Expression groupKey : agg.getGroupByExpressions()) { - if (groupKey instanceof SlotReference) { - groupKeys.add((SlotReference) groupKey); - } else { - if (SessionVariable.isFeDebug()) { - throw new RuntimeException("PushDownAggregation failed: agg is not normalized\n " - + agg.treeString()); } else { return agg; } } } + groupKeys = groupKeys.stream().distinct().collect(Collectors.toList()); + if (!checkSubTreePattern(agg.child())) { + return agg; + } + PushDownAggContext pushDownContext = new PushDownAggContext(new ArrayList<>(aggFunctions), - groupKeys, context.getCascadesContext()); + groupKeys, null, context.getCascadesContext(), false, hasSumIf); + if (!pushDownContext.isValid()) { + return agg; + } try { Plan child = agg.child().accept(writer, pushDownContext); if (child != agg.child()) { @@ -180,41 +207,66 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte // ->scan(T1[A...]) // ->scan(T2) List newOutputExpressions = new ArrayList<>(); + //Map replaceMap = new HashMap<>(); + //for (AggregateFunction aggFunc : pushDownContext.getAliasMap().keySet()) { + // Alias alias = pushDownContext.getAliasMap().get(aggFunc); + // replaceMap.put(aggFunc, (AggregateFunction) aggFunc.withChildren((Expression) alias.toSlot())); + //} + for (NamedExpression ne : agg.getOutputExpressions()) { if (ne instanceof SlotReference) { newOutputExpressions.add(ne); } else { - Expression rewriteAvgExpr = ExpressionUtils.replace(ne, avgToSumCountMap); - NamedExpression replaceAliasExpr = (NamedExpression) rewriteAvgExpr - .rewriteDownShortCircuit(e -> { - Alias alias = pushDownContext.getAliasMap().get(e); - if (alias != null) { - AggregateFunction aggFunction = (AggregateFunction) e; - return aggFunction.withChildren(alias.toSlot()); - } else { - return e; - } - }); + // every expression has its own replaceMap + // aggregation(output=[min(A), sum(A)]) + // --> join + // -> T1 [A ...] + // -> T2 [...] + // => + // aggregation(output=[min(minA), sum(sumA)]) + // --> join + // -> agg(output=[min(A) as minA, sum(A) as sumA]) + // -> T1 [A ...] + // -> T2 [...] + // for min(A), replaceMap: A->minA + // for sum(A), replaceMap: A->sumA + // for count(A), replaceMap: count(A)->sum(countA), because count needs rollup to sum + Map replaceMap = new HashMap<>(); + List relatedAggFunc = aggFunctionsForOutputExpressions.get(ne); + for (AggregateFunction func : relatedAggFunc) { + Slot pushedDownSlot = pushDownContext.getAliasMap().get(func).toSlot(); + if (func instanceof Count) { + // For count(A), after pushdown we have count(A) as x, + // and the top agg should use sum(x) instead of count(x) + Function rollUpFunc = ((RollUpTrait) func).constructRollUp(pushedDownSlot); + replaceMap.put(func, rollUpFunc); + } else if (func.arity() > 0) { + // For sum/max/min, replace the child expression with the pushed down slot + replaceMap.put(func.child(0), pushedDownSlot); + } + } + NamedExpression replaceAliasExpr = (NamedExpression) ExpressionUtils.replace(ne, replaceMap); + replaceAliasExpr = (NamedExpression) ExpressionUtils.rebuildSignature(replaceAliasExpr); newOutputExpressions.add(replaceAliasExpr); } } LogicalAggregate eagerAgg = agg.withAggOutputChild(newOutputExpressions, child); NormalizeAggregate normalizeAggregate = new NormalizeAggregate(); - LogicalPlan normalized = normalizeAggregate.normalizeAgg(eagerAgg, Optional.empty(), + return normalizeAggregate.normalizeAgg(eagerAgg, Optional.empty(), context.getCascadesContext()); - AdjustNullable adjustNullable = new AdjustNullable(false, false); - return adjustNullable.rewriteRoot(normalized, null); } } catch (RuntimeException e) { - LOG.info("PushDownAggregation failed: " + e.getMessage() + "\n" + agg.treeString()); + String msg = "PushDownAggregation failed: " + e.getMessage() + "\n" + agg.treeString(); + LOG.info(msg, e); + SessionVariable.throwAnalysisExceptionWhenFeDebug(msg); } return agg; } private boolean checkSubTreePattern(Plan root) { return containsPushDownJoin(root) - && isSPJ(root); + && checkPlanNodeType(root); } private boolean containsPushDownJoin(Plan root) { @@ -227,14 +279,14 @@ private boolean containsPushDownJoin(Plan root) { return root.children().stream().anyMatch(this::containsPushDownJoin); } - private boolean isSPJ(Plan root) { + private boolean checkPlanNodeType(Plan root) { boolean accepted = acceptNodeType.stream() .anyMatch(clazz -> clazz.isAssignableFrom(root.getClass())); if (!accepted) { return false; } for (Plan child : root.children()) { - if (!isSPJ(child)) { + if (!checkPlanNodeType(child)) { return false; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java deleted file mode 100644 index 292caf230d0ca2..00000000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushdownSumIfAggregation.java +++ /dev/null @@ -1,152 +0,0 @@ -// 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. - -package org.apache.doris.nereids.rules.rewrite.eageraggregation; - -import org.apache.doris.nereids.jobs.JobContext; -import org.apache.doris.nereids.trees.expressions.Alias; -import org.apache.doris.nereids.trees.expressions.EqualTo; -import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.NamedExpression; -import org.apache.doris.nereids.trees.expressions.Slot; -import org.apache.doris.nereids.trees.expressions.SlotReference; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; -import org.apache.doris.nereids.trees.expressions.functions.scalar.If; -import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; -import org.apache.doris.nereids.trees.plans.Plan; -import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; -import org.apache.doris.nereids.trees.plans.visitor.CustomRewriter; -import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; -import org.apache.doris.qe.SessionVariable; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -/** - * sum(if t1.a then t2.b) - */ -public class PushdownSumIfAggregation extends DefaultPlanRewriter implements CustomRewriter { - - @Override - public Plan rewriteRoot(Plan plan, JobContext jobContext) { - return plan.accept(this, jobContext); - } - - @Override - public Plan visitLogicalAggregate(LogicalAggregate agg, JobContext context) { - Plan newChild = agg.child().accept(this, context); - if (newChild != agg.child()) { - // TODO : push down upper aggregations - return agg.withChildren(newChild); - } - - if (agg.getSourceRepeat().isPresent()) { - return agg; - } - - List aliasToBePushDown = Lists.newArrayList(); - List ifConditions = Lists.newArrayList(); - List ifThenSlots = Lists.newArrayList(); - boolean patternMatch = true; - for (NamedExpression aggOutput : agg.getOutputExpressions()) { - if (aggOutput instanceof Alias) { - Expression body = aggOutput.child(0); - if (body instanceof Sum) { - Expression sumBody = ((Sum) body).child(); - if (sumBody instanceof If) { - If ifBody = (If) sumBody; - if (ifBody.child(0) instanceof EqualTo - && ifBody.child(1) instanceof SlotReference - && ifBody.child(2) instanceof NullLiteral) { - ifConditions.add((EqualTo) ifBody.child(0)); - ifThenSlots.add((SlotReference) ifBody.child(1)); - aliasToBePushDown.add(aggOutput); - continue; - } - } - } - patternMatch = false; - } - } - if (!patternMatch) { - return agg; - } - if (ifThenSlots.isEmpty()) { - return agg; - } - ifThenSlots = Lists.newArrayList(Sets.newHashSet(ifThenSlots)); - - List groupKeys = new ArrayList<>(); - for (Expression groupKey : agg.getGroupByExpressions()) { - if (groupKey instanceof SlotReference) { - groupKeys.add((SlotReference) groupKey); - } else { - if (SessionVariable.isFeDebug()) { - throw new RuntimeException("PushDownAggregation failed: agg is not normalized\n " - + agg.treeString()); - } else { - return agg; - } - } - } - - SumAggContext sumAggContext = new SumAggContext(aliasToBePushDown, ifConditions, ifThenSlots, groupKeys); - SumAggWriter writer = new SumAggWriter(); - Plan child = agg.child().accept(writer, sumAggContext); - if (child != agg.child()) { - List outputExpressions = agg.getOutputExpressions(); - List newOutputExpressions = new ArrayList<>(); - for (NamedExpression output : outputExpressions) { - if (output instanceof SlotReference) { - newOutputExpressions.add(output); - } else if (output instanceof Alias - && output.child(0) instanceof Sum - && output.child(0).child(0) instanceof If - && output.child(0).child(0).child(1) instanceof SlotReference) { - SlotReference targetSlot = (SlotReference) output.child(0).child(0).child(1); - Slot toReplace = null; - for (Slot slot : child.getOutput()) { - if (slot.getExprId().equals(targetSlot.getExprId())) { - toReplace = slot; - } - } - if (toReplace != null) { - Alias newOutput = (Alias) ((Alias) output).withChildren( - new Sum( - new If( - output.child(0).child(0).child(0), - toReplace, - new NullLiteral(toReplace.getDataType()) - ) - ) - ); - newOutputExpressions.add(newOutput); - } else { - return agg; - } - - } - } - return agg.withAggOutputChild(newOutputExpressions, child); - } - return agg; - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java deleted file mode 100644 index 7b3e7ee948276c..00000000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggContext.java +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -package org.apache.doris.nereids.rules.rewrite.eageraggregation; - -import org.apache.doris.nereids.trees.expressions.EqualTo; -import org.apache.doris.nereids.trees.expressions.NamedExpression; -import org.apache.doris.nereids.trees.expressions.SlotReference; - -import com.google.common.collect.ImmutableList; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * SumAggContext - */ -public class SumAggContext { - public final List aliasToBePushDown; - public final List ifConditions; - public final List ifThenSlots; - public final List groupKeys; - - public SumAggContext(List aliasToBePushDown, - List ifConditions, List ifThenSlots, - List groupKeys) { - this.aliasToBePushDown = ImmutableList.copyOf(aliasToBePushDown); - this.ifConditions = ImmutableList.copyOf(ifConditions); - Set distinct = new HashSet<>(ifThenSlots); - this.ifThenSlots = ImmutableList.copyOf(distinct); - this.groupKeys = ImmutableList.copyOf(groupKeys); - } - - public SumAggContext withIfThenSlots(List ifThenSlots) { - return new SumAggContext(this.aliasToBePushDown, - this.ifConditions, - ifThenSlots, - this.groupKeys); - } - -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java deleted file mode 100644 index 27a2165f42233a..00000000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/SumAggWriter.java +++ /dev/null @@ -1,323 +0,0 @@ -// 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. - -package org.apache.doris.nereids.rules.rewrite.eageraggregation; - -import org.apache.doris.nereids.rules.rewrite.StatsDerive; -import org.apache.doris.nereids.stats.ExpressionEstimation; -import org.apache.doris.nereids.stats.StatsCalculator; -import org.apache.doris.nereids.trees.expressions.Alias; -import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.NamedExpression; -import org.apache.doris.nereids.trees.expressions.Slot; -import org.apache.doris.nereids.trees.expressions.SlotReference; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; -import org.apache.doris.nereids.trees.plans.Plan; -import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; -import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; -import org.apache.doris.nereids.trees.plans.logical.LogicalProject; -import org.apache.doris.nereids.trees.plans.logical.LogicalRelation; -import org.apache.doris.nereids.trees.plans.logical.LogicalUnion; -import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter; -import org.apache.doris.nereids.types.DataType; -import org.apache.doris.nereids.util.ExpressionUtils; -import org.apache.doris.qe.ConnectContext; -import org.apache.doris.statistics.ColumnStatistic; -import org.apache.doris.statistics.Statistics; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * SumAggWriter - */ -public class SumAggWriter extends DefaultPlanRewriter { - private static final double LOWER_AGGREGATE_EFFECT_COEFFICIENT = 10000; - private static final double LOW_AGGREGATE_EFFECT_COEFFICIENT = 1000; - private static final double MEDIUM_AGGREGATE_EFFECT_COEFFICIENT = 100; - private final StatsDerive derive = new StatsDerive(true); - - @Override - public Plan visit(Plan plan, SumAggContext context) { - return plan; - } - - @Override - public Plan visitLogicalProject(LogicalProject project, SumAggContext context) { - if (project.getProjects().stream().allMatch(proj -> proj instanceof SlotReference - || (proj instanceof Alias && proj.child(0) instanceof SlotReference))) { - List slotToPush = new ArrayList<>(); - for (SlotReference slot : context.ifThenSlots) { - slotToPush.add((SlotReference) project.pushDownExpressionPastProject(slot)); - } - List groupBySlots = new ArrayList<>(); - for (SlotReference slot : context.groupKeys) { - groupBySlots.add((SlotReference) project.pushDownExpressionPastProject(slot)); - } - SumAggContext contextForChild = new SumAggContext( - context.aliasToBePushDown, - context.ifConditions, - slotToPush, - groupBySlots); - Plan child = project.child().accept(this, contextForChild); - if (child != project.child()) { - List newProjects = Lists.newArrayList(); - for (NamedExpression ne : project.getProjects()) { - newProjects.add((NamedExpression) replaceBySlots(ne, child.getOutput())); - } - return project.withProjects(newProjects).withChildren(child); - } - } - return project; - } - - private static Expression replaceBySlots(Expression expression, List slots) { - Map replaceMap = new HashMap<>(); - for (Slot slot1 : expression.getInputSlots()) { - for (Slot slot2 : slots) { - if (slot1.getExprId().asInt() == slot2.getExprId().asInt()) { - replaceMap.put(slot1, slot2); - } - } - } - Expression result = ExpressionUtils.replace(expression, replaceMap); - return result; - } - - @Override - public Plan visitLogicalJoin(LogicalJoin join, SumAggContext context) { - Set leftOutput = join.left().getOutputSet(); - Set conditionSlots = join.getConditionSlot().stream() - .map(slot -> (SlotReference) slot).collect(Collectors.toSet()); - for (Slot slot : context.ifThenSlots) { - if (conditionSlots.contains(slot)) { - return join; - } - } - Set conditionSlotsFromLeft = Sets.newHashSet(conditionSlots); - conditionSlotsFromLeft.retainAll(leftOutput); - for (SlotReference slot : context.groupKeys) { - if (leftOutput.contains(slot)) { - conditionSlotsFromLeft.add(slot); - } - } - if (leftOutput.containsAll(context.ifThenSlots)) { - SumAggContext contextForChild = new SumAggContext( - context.aliasToBePushDown, - context.ifConditions, - context.ifThenSlots, - Lists.newArrayList(conditionSlotsFromLeft) - ); - Plan left = join.left().accept(this, contextForChild); - if (join.left() != left) { - return join.withChildren(left, join.right()); - } - } - return join; - } - - @Override - public Plan visitLogicalUnion(LogicalUnion union, SumAggContext context) { - if (!union.getOutputSet().containsAll(context.ifThenSlots)) { - return union; - } - if (!union.getConstantExprsList().isEmpty()) { - return union; - } - - if (!union.getOutputs().stream().allMatch(e -> e instanceof SlotReference)) { - return union; - } - List newChildren = Lists.newArrayList(); - - boolean changed = false; - for (int i = 0; i < union.children().size(); i++) { - Plan child = union.children().get(i); - List ifThenSlotsForChild = new ArrayList<>(); - // List groupByForChild = new ArrayList<>(); - for (SlotReference slot : context.ifThenSlots) { - Expression pushed = union.pushDownExpressionPastSetOperator(slot, i); - if (pushed instanceof SlotReference) { - ifThenSlotsForChild.add((SlotReference) pushed); - } else { - return union; - } - } - int childIdx = i; - SumAggContext contextForChild = new SumAggContext( - context.aliasToBePushDown, - context.ifConditions, - ifThenSlotsForChild, - context.groupKeys.stream().map(slot - -> (SlotReference) union.pushDownExpressionPastSetOperator(slot, childIdx)) - .collect(Collectors.toList()) - ); - Plan newChild = child.accept(this, contextForChild); - if (newChild != child) { - changed = true; - } - newChildren.add(newChild); - } - if (changed) { - List> newRegularChildrenOutputs = Lists.newArrayList(); - for (int i = 0; i < newChildren.size(); i++) { - List childOutput = new ArrayList<>(); - for (SlotReference slot : union.getRegularChildOutput(i)) { - for (Slot c : newChildren.get(i).getOutput()) { - if (slot.equals(c)) { - childOutput.add((SlotReference) c); - break; - } - } - } - newRegularChildrenOutputs.add(childOutput); - } - List newOutputs = new ArrayList<>(); - for (int i = 0; i < union.getOutput().size(); i++) { - SlotReference originSlot = (SlotReference) union.getOutput().get(i); - DataType dataType = newRegularChildrenOutputs.get(0).get(i).getDataType(); - newOutputs.add(originSlot.withNullableAndDataType(originSlot.nullable(), dataType)); - } - return union.withChildrenAndOutputs(newChildren, newOutputs, newRegularChildrenOutputs); - } else { - return union; - } - } - - @Override - public Plan visitLogicalRelation(LogicalRelation relation, SumAggContext context) { - return genAggregate(relation, context); - } - - private Plan genAggregate(Plan child, SumAggContext context) { - if (checkStats(child, context)) { - List aggOutputExpressions = new ArrayList<>(); - for (SlotReference slot : context.ifThenSlots) { - Alias alias = new Alias(slot.getExprId(), new Sum(slot)); - aggOutputExpressions.add(alias); - } - aggOutputExpressions.addAll(context.groupKeys); - - LogicalAggregate genAgg = new LogicalAggregate(context.groupKeys, aggOutputExpressions, child); - return genAgg; - } else { - return child; - } - - } - - private boolean checkStats(Plan plan, SumAggContext context) { - if (ConnectContext.get() == null) { - return false; - } - int mode = ConnectContext.get().getSessionVariable().eagerAggregationMode; - if (mode < 0) { - return false; - } - if (mode > 0) { - return true; - } - Statistics stats = plan.getStats(); - if (stats == null) { - stats = plan.accept(derive, new StatsDerive.DeriveContext()); - } - if (stats.getRowCount() == 0) { - return false; - } - - List groupKeysStats = new ArrayList<>(); - - List lower = Lists.newArrayList(); - List medium = Lists.newArrayList(); - List high = Lists.newArrayList(); - - List[] cards = new List[] {lower, medium, high}; - - for (NamedExpression key : context.groupKeys) { - ColumnStatistic colStats = ExpressionEstimation.INSTANCE.estimate(key, stats); - if (colStats.isUnKnown) { - return false; - } - groupKeysStats.add(colStats); - cards[groupByCardinality(colStats, stats.getRowCount())].add(colStats); - } - - double lowerCartesian = 1.0; - for (ColumnStatistic colStats : lower) { - lowerCartesian = lowerCartesian * colStats.ndv; - } - - // pow(row_count/20, a half of lower column size) - double lowerUpper = Math.max(stats.getRowCount() / 20, 1); - lowerUpper = Math.pow(lowerUpper, Math.max(lower.size() / 2, 1)); - - if (high.isEmpty() && (lower.size() + medium.size()) == 1) { - return true; - } - - if (high.isEmpty() && medium.isEmpty()) { - if (lower.size() == 1 && lowerCartesian * 20 <= stats.getRowCount()) { - return true; - } else if (lower.size() == 2 && lowerCartesian * 7 <= stats.getRowCount()) { - return true; - } else if (lower.size() <= 3 && lowerCartesian * 20 <= stats.getRowCount() && lowerCartesian < lowerUpper) { - return true; - } else { - return false; - } - } - - if (high.size() >= 2 || medium.size() > 2 || (high.size() == 1 && !medium.isEmpty())) { - return false; - } - - // 3. Extremely low cardinality for lower with at most one medium or high. - double lowerCartesianLowerBound = - stats.getRowCount() / LOWER_AGGREGATE_EFFECT_COEFFICIENT; - if (high.size() + medium.size() == 1 && lower.size() <= 2 && lowerCartesian <= lowerCartesianLowerBound) { - StatsCalculator statsCalculator = new StatsCalculator(null); - double estAggRowCount = statsCalculator.estimateGroupByRowCount( - context.groupKeys.stream().map(s -> (Expression) s).collect(Collectors.toList()), - stats); - return estAggRowCount < lowerCartesianLowerBound; - } - - return false; - } - - // high(2): row_count / cardinality < MEDIUM_AGGREGATE_EFFECT_COEFFICIENT - // medium(1): row_count / cardinality >= MEDIUM_AGGREGATE_EFFECT_COEFFICIENT and < LOW_AGGREGATE_EFFECT_COEFFICIENT - // lower(0): row_count / cardinality >= LOW_AGGREGATE_EFFECT_COEFFICIENT - private int groupByCardinality(ColumnStatistic colStats, double rowCount) { - if (rowCount == 0 || colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { - return 2; - } else if (colStats.ndv * MEDIUM_AGGREGATE_EFFECT_COEFFICIENT <= rowCount - && colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT > rowCount) { - return 1; - } else if (colStats.ndv * LOW_AGGREGATE_EFFECT_COEFFICIENT <= rowCount) { - return 0; - } - return 2; - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/BoundFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/BoundFunction.java index 16d7740cf9c2a4..ea472071678e8d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/BoundFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/BoundFunction.java @@ -155,4 +155,8 @@ private Supplier buildSignatureCache(Supplier"), diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java index fef5e46f2c07a7..35bce61733a928 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java @@ -63,6 +63,8 @@ public class LogicalProject extends LogicalUnary> projectsSet; private final boolean isDistinct; + private final HashMap projectMap; + public LogicalProject(List projects, CHILD_TYPE child) { this(projects, false, ImmutableList.of(child)); } @@ -90,6 +92,17 @@ private LogicalProject(List projects, boolean isDistinct, : projects; this.projectsSet = Suppliers.memoize(() -> Utils.fastToImmutableSet(this.projects)); this.isDistinct = isDistinct; + this.projectMap = new HashMap<>(); + for (NamedExpression namedExpression : projects) { + if (namedExpression.hasUnbound()) { + projectMap.clear(); + break; + } + if (namedExpression instanceof Alias) { + Alias alias = (Alias) namedExpression; + projectMap.put(alias.toSlot(), alias.child()); + } + } } /** @@ -315,13 +328,6 @@ public void computeFd(DataTrait.Builder builder) { * */ public Expression pushDownExpressionPastProject(Expression expression) { - HashMap projectMap = new HashMap(); - for (NamedExpression namedExpression : projects) { - if (namedExpression instanceof Alias) { - Alias alias = (Alias) namedExpression; - projectMap.put(alias.toSlot(), alias.child()); - } - } return ExpressionUtils.replace(expression, projectMap); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java index 69447253cbaa18..913f89d5c61055 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java @@ -77,14 +77,18 @@ public LogicalSetOperation(PlanType planType, Qualifier qualifier, List ch this.regularChildrenOutputs = ImmutableList.of(); } + /** + * constructor + */ public LogicalSetOperation(PlanType planType, Qualifier qualifier, List outputs, List> regularChildrenOutputs, List children) { - super(planType, children); - this.qualifier = qualifier; - this.outputs = ImmutableList.copyOf(outputs); - this.regularChildrenOutputs = ImmutableList.copyOf(regularChildrenOutputs); + this(planType, qualifier, outputs, regularChildrenOutputs, Optional.empty(), + Optional.empty(), children); } + /** + * constr + */ public LogicalSetOperation(PlanType planType, Qualifier qualifier, List outputs, List> regularChildrenOutputs, Optional groupExpression, Optional logicalProperties, @@ -93,6 +97,38 @@ public LogicalSetOperation(PlanType planType, Qualifier qualifier, List SessionVariable.throwAnalysisExceptionWhenFeDebug(msg)); + //} + } + + // check every slot in outputs has its counterpart in regularChildrenOutputs, and they have the same data type. + private Optional checkOutputs(List outputs, + List> regularChildrenOutputs) { + if (!regularChildrenOutputs.isEmpty() && !outputs.isEmpty()) { + for (List childOutput : regularChildrenOutputs) { + if (outputs.size() != childOutput.size()) { + return Optional.of("regularChildrenOutputs size error: regularOutput " + + childOutput + " output: " + outputs); + } + for (int i = 0; i < childOutput.size(); i++) { + DataType outputDataType = outputs.get(i).getDataType(); + boolean outputNullable = outputs.get(i).nullable(); + String outputInfo = outputNullable ? "+" : "-" + outputDataType; + DataType childDataType = childOutput.get(i).getDataType(); + boolean childNullable = childOutput.get(i).nullable(); + String childInfo = childNullable ? "+" : "-" + childDataType; + if (!outputDataType.equals(childDataType) + || outputNullable != childNullable) { + return Optional.of("regularChildrenOutputs data type is different from output. " + + "regularOutput slot: " + childOutput.get(i) + + "[" + childInfo + "], output: " + outputs.get(i) + "[" + outputInfo + "]"); + } + } + } + } + return Optional.empty(); } public List> getRegularChildrenOutputs() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java index 7dc1507cc7a24b..55ffc5a286a820 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalUnion.java @@ -114,7 +114,7 @@ public List getExpressions() { @Override public String toString() { - return Utils.toSqlStringSkipNull("LogicalUnion", + return Utils.toSqlStringSkipNull("LogicalUnion[" + id.asInt() + "]", "qualifier", qualifier, "outputs", outputs, "regularChildrenOutputs", regularChildrenOutputs, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java index f131128a088c1b..b8987334668d89 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java @@ -54,6 +54,7 @@ import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.WhenClause; import org.apache.doris.nereids.trees.expressions.WindowExpression; +import org.apache.doris.nereids.trees.expressions.functions.BoundFunction; import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; import org.apache.doris.nereids.trees.expressions.functions.agg.Max; import org.apache.doris.nereids.trees.expressions.functions.agg.Min; @@ -211,14 +212,57 @@ public static Optional optionalAnd(Collection collection } /** - * AND / OR expression, also remove duplicate expression, boolean literal + * Rebuild expression tree and refresh BoundFunction signatures. + * If an expression is a BoundFunction, recreate it with rebuilt children and + * reset its signature. + * Other expressions are recreated only when children change. + * + * @return rebuilt expression (may be the same instance when unchanged and + * non-BoundFunction) + */ + public static Expression rebuildSignature(Expression expr) { + List newChildren = expr.children().stream() + .map(ExpressionUtils::rebuildSignature) + .collect(Collectors.toList()); + return MoreFieldsThread.keepFunctionSignature(false, + () -> { + boolean childrenUnchanged = true; + List originChildren = expr.children(); + if (originChildren.size() != newChildren.size()) { + childrenUnchanged = false; + } else { + for (int i = 0; i < originChildren.size(); i++) { + if (originChildren.get(i) != newChildren.get(i)) { + childrenUnchanged = false; + break; + } + } + } + + if (expr instanceof BoundFunction) { + BoundFunction fn = (BoundFunction) expr; + BoundFunction rebuilt = (BoundFunction) fn.withChildren(newChildren); + rebuilt = (BoundFunction) TypeCoercionUtils.processBoundFunction(rebuilt); + return rebuilt; + } + + if (childrenUnchanged) { + return expr; + } + return expr.withChildren(newChildren); + }); + + } + + /** + * AND / OR expression, also remove duplicate expression, boolean literal */ public static Expression compound(boolean isAnd, Collection expressions) { return isAnd ? and(expressions) : or(expressions); } /** - * AND expression, also remove duplicate expression, boolean literal + * AND expression, also remove duplicate expression, boolean literal */ public static Expression and(Collection expressions) { if (expressions.size() == 1) { @@ -244,7 +288,7 @@ public static Expression and(Collection expressions) { } /** - * AND expression, also remove duplicate expression, boolean literal + * AND expression, also remove duplicate expression, boolean literal */ public static Expression and(Expression... expressions) { return and(Lists.newArrayList(expressions)); @@ -259,14 +303,14 @@ public static Optional optionalOr(List expressions) { } /** - * OR expression, also remove duplicate expression, boolean literal + * OR expression, also remove duplicate expression, boolean literal */ public static Expression or(Expression... expressions) { return or(Lists.newArrayList(expressions)); } /** - * OR expression, also remove duplicate expression, boolean literal + * OR expression, also remove duplicate expression, boolean literal */ public static Expression or(Collection expressions) { if (expressions.size() == 1) { @@ -676,10 +720,9 @@ public static boolean canInferNotNullForMarkSlot(Expression predicate, Expressio * the mark slot can be non-nullable boolean * and in semi join, we can safely change the mark conjunct to hash conjunct */ - ImmutableList literals = - ImmutableList.of(NullLiteral.BOOLEAN_INSTANCE, BooleanLiteral.FALSE); - List markJoinSlotReferenceList = - new ArrayList<>((predicate.collect(MarkJoinSlotReference.class::isInstance))); + ImmutableList literals = ImmutableList.of(NullLiteral.BOOLEAN_INSTANCE, BooleanLiteral.FALSE); + List markJoinSlotReferenceList = new ArrayList<>( + (predicate.collect(MarkJoinSlotReference.class::isInstance))); int markSlotSize = markJoinSlotReferenceList.size(); int maxMarkSlotCount = 4; // if the conjunct has mark slot, and maximum 4 mark slots(for performance) @@ -688,9 +731,9 @@ public static boolean canInferNotNullForMarkSlot(Expression predicate, Expressio boolean meetTrue = false; boolean meetNullOrFalse = false; /* - * markSlotSize = 1 -> loopCount = 2 ---- 0, 1 - * markSlotSize = 2 -> loopCount = 4 ---- 00, 01, 10, 11 - * markSlotSize = 3 -> loopCount = 8 ---- 000, 001, 010, 011, 100, 101, 110, 111 + * markSlotSize = 1 -> loopCount = 2 ---- 0, 1 + * markSlotSize = 2 -> loopCount = 4 ---- 00, 01, 10, 11 + * markSlotSize = 3 -> loopCount = 8 ---- 000, 001, 010, 011, 100, 101, 110, 111 * markSlotSize = 4 -> loopCount = 16 ---- 0000, 0001, ... 1111 */ int loopCount = 1 << markSlotSize; @@ -706,8 +749,7 @@ public static boolean canInferNotNullForMarkSlot(Expression predicate, Expressio } Expression evalResult = FoldConstantRule.evaluate( ExpressionUtils.replace(predicate, replaceMap), - ctx - ); + ctx); if (evalResult.equals(BooleanLiteral.TRUE)) { if (meetNullOrFalse) { @@ -746,8 +788,7 @@ public static Set inferNotNullSlots(Set predicates, CascadesCo replaceMap.put(slot, nullLiteral); Expression evalExpr = FoldConstantRule.evaluate( ExpressionUtils.replace(predicate, replaceMap), - new ExpressionRewriteContext(cascadesContext) - ); + new ExpressionRewriteContext(cascadesContext)); if (evalExpr.isNullLiteral() || BooleanLiteral.FALSE.equals(evalExpr)) { notNullSlots.add(slot); } @@ -923,7 +964,7 @@ public static boolean isInjective(Expression expression) { return expression instanceof Slot; } - // if the input is unique, the output of agg is unique, too + // if the input is unique, the output of agg is unique, too public static boolean isInjectiveAgg(Expression agg) { return agg instanceof Sum || agg instanceof Avg || agg instanceof Max || agg instanceof Min; } @@ -941,7 +982,8 @@ public static Set mutableCollect(List expressions, public static List collectAll(Collection expressions, Predicate> predicate) { switch (expressions.size()) { - case 0: return ImmutableList.of(); + case 0: + return ImmutableList.of(); default: { ImmutableList.Builder result = ImmutableList.builder(); for (Expression expr : expressions) { @@ -1050,14 +1092,13 @@ public static Expression getSingleNumericSlotOrExpressionCoveredByCast(Expressio */ public static boolean checkSlotConstant(Slot slot, Set predicates) { return predicates.stream().anyMatch(predicate -> { - if (predicate instanceof EqualTo) { - EqualTo equalTo = (EqualTo) predicate; - return (equalTo.left() instanceof Literal && equalTo.right().equals(slot)) - || (equalTo.right() instanceof Literal && equalTo.left().equals(slot)); - } - return false; - } - ); + if (predicate instanceof EqualTo) { + EqualTo equalTo = (EqualTo) predicate; + return (equalTo.left() instanceof Literal && equalTo.right().equals(slot)) + || (equalTo.right() instanceof Literal && equalTo.left().equals(slot)); + } + return false; + }); } /** @@ -1175,8 +1216,7 @@ public static Literal analyzeAndFoldToLiteral(ConnectContext ctx, Expression exp } ExpressionRewriteContext context = new ExpressionRewriteContext(cascadesContext); ExpressionRuleExecutor executor = new ExpressionRuleExecutor(ImmutableList.of( - ExpressionRewrite.bottomUp(ReplaceVariableByLiteral.INSTANCE) - )); + ExpressionRewrite.bottomUp(ReplaceVariableByLiteral.INSTANCE))); Expression rewrittenExpression = executor.rewrite(analyzedExpr, context); Expression foldExpression = FoldConstantRule.evaluate(rewrittenExpression, context); if (foldExpression instanceof Literal) { @@ -1251,8 +1291,8 @@ public static boolean containsCaseWhenLikeType(Expression expression) { public static Optional> getCaseWhenLikeBranchResults(Expression expression) { if (expression instanceof CaseWhen) { CaseWhen caseWhen = (CaseWhen) expression; - ImmutableList.Builder builder - = ImmutableList.builderWithExpectedSize(caseWhen.getWhenClauses().size() + 1); + ImmutableList.Builder builder = ImmutableList + .builderWithExpectedSize(caseWhen.getWhenClauses().size() + 1); for (WhenClause whenClause : caseWhen.getWhenClauses()) { builder.add(whenClause.getResult()); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 5110a537cba9c1..0a2604fd8e939d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -29,6 +29,7 @@ import org.apache.doris.common.util.TimeUtils; import org.apache.doris.common.util.Util; import org.apache.doris.nereids.StatementContext; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.glue.LogicalPlanAdapter; import org.apache.doris.nereids.metrics.Event; import org.apache.doris.nereids.metrics.EventSwitchParser; @@ -2254,7 +2255,30 @@ public boolean isEnableHboNonStrictMatchingMode() { + "1: force eager aggregation, " + "-1: Prohibit eager aggregation "} ) - public int eagerAggregationMode = 0; + private int eagerAggregationMode = 0; + + public static int getEagerAggregationMode() { + if (ConnectContext.get() != null) { + return ConnectContext.get().getSessionVariable().eagerAggregationMode; + } else { + return VariableMgr.getDefaultSessionVariable().eagerAggregationMode; + } + } + + public void setEagerAggregationMode(int mode) { + this.eagerAggregationMode = mode; + } + + @VariableMgr.VarAttr(name = "eager_aggregation_on_join", needForward = true) + public boolean eagerAggregationOnJoin = false; + + public static boolean isEagerAggregationOnJoin() { + if (ConnectContext.get() != null) { + return ConnectContext.get().getSessionVariable().eagerAggregationOnJoin; + } else { + return VariableMgr.getDefaultSessionVariable().eagerAggregationOnJoin; + } + } @VariableMgr.VarAttr( name = ENABLE_PAGE_CACHE, @@ -6164,6 +6188,13 @@ public static boolean isFeDebug() { } } + public static void throwAnalysisExceptionWhenFeDebug(String msg) { + LOG.warn(msg); + if (isFeDebug()) { + throw new AnalysisException(msg); + } + } + public Map getAffectQueryResultInPlanVariables() { ImmutableMap.Builder builder = ImmutableMap.builder(); try { diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 4284ddbfc4ac12..f2afbc47085c22 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -771,9 +771,7 @@ private void executeByNereids(TUniqueId queryId) throws Exception { new AnalysisException(e.getMessage(), e)); } catch (Exception | Error e) { // Maybe our bug - if (LOG.isDebugEnabled()) { - LOG.debug("Command({}) process failed.", originStmt.originStmt, e); - } + LOG.info("Command({}) process failed.", originStmt.originStmt, e); context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR, e.getMessage()); throw new NereidsException("Command (" + originStmt.originStmt + ") process failed.", new AnalysisException(e.getMessage() == null ? e.toString() : e.getMessage(), e)); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java new file mode 100644 index 00000000000000..bf46829c4e097a --- /dev/null +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java @@ -0,0 +1,113 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite.eageraggregation; + +import org.apache.doris.nereids.util.MemoPatternMatchSupported; +import org.apache.doris.nereids.util.PlanChecker; +import org.apache.doris.utframe.TestWithFeService; + +import org.junit.jupiter.api.Test; + +class EagerAggRewriterTest extends TestWithFeService implements MemoPatternMatchSupported { + @Override + protected void runBeforeAll() throws Exception { + createDatabase("test"); + connectContext.setDatabase("default_cluster:test"); + createTables( + "CREATE TABLE IF NOT EXISTS t1 (\n" + + " id1 int not null,\n" + + " name varchar(20)\n" + + ")\n" + + "DUPLICATE KEY(id1)\n" + + "DISTRIBUTED BY HASH(id1) BUCKETS 10\n" + + "PROPERTIES (\"replication_num\" = \"1\")\n", + "CREATE TABLE IF NOT EXISTS t2 (\n" + + " id2 int not null,\n" + + " name varchar(20)\n" + + ")\n" + + "DUPLICATE KEY(id2)\n" + + "DISTRIBUTED BY HASH(id2) BUCKETS 10\n" + + "PROPERTIES (\"replication_num\" = \"1\")\n" + ); + connectContext.getSessionVariable().setDisableNereidsRules("PRUNE_EMPTY_PARTITION"); + } + + @Test + void testNotPushAggCaseWhenToNullableSideOfOuterJoin() { + connectContext.getSessionVariable().setEagerAggregationMode(1); + connectContext.getSessionVariable().setDisableJoinReorder(true); + try { + // RIGHT JOIN: agg function (case-when) references left side columns, + // left side is nullable, should NOT be pushed below the join + String sql = "select max(case when t1.name is not null then 'aaa' end) from t1 right join t2 on t1.id1 = t2.id2" + + " group by t1.id1"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .nonMatch(logicalJoin(logicalAggregate(), any())) + .printlnTree(); + + // LEFT JOIN: agg function(case-when) references right side columns, + // right side is nullable, should NOT be pushed below the join + sql = "select max(case when t2.name is null then 'xxx' end) from t1 left join t2" + + " on t1.id1 = t2.id2 group by t1.id1"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .nonMatch(logicalJoin(any(), logicalAggregate())) + .printlnTree(); + // RIGHT JOIN: agg function (not-case-when) references left side columns, + // left side is nullable, can be pushed below the join + sql = "select max(t2.name) from t1 left join t2" + + " on t1.id1 = t2.id2 group by t1.id1"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .matches(logicalJoin(any(), logicalAggregate())) + .printlnTree(); + } finally { + connectContext.getSessionVariable().setEagerAggregationMode(0); + } + } + + @Test + void testPushDownCount() { + // Test count pushdown: count(a) should be pushed down and + // the top aggregation should use sum to aggregate the count results + // Before: agg(count(name), groupby(id2)) + // -> join(t1.id1=t2.id2) + // -> t1(id1, name) + // -> t2(id2) + // After: agg(sum(x), groupby(id2)) + // -> join(t1.id1=t2.id2) + // -> agg(count(name) as x, groupby(id1)) + // -> t1(id1, name) + // -> t2(id2) + connectContext.getSessionVariable().setEagerAggregationMode(1); + try { + String sql = "select count(t1.name), t2.id2 from t1 join t2 on t1.id1 = t2.id2 group by t2.id2"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .matches(logicalAggregate(logicalProject(logicalJoin(logicalAggregate(), any())))) + .printlnTree(); + } finally { + connectContext.getSessionVariable().setEagerAggregationMode(0); + } + } +} diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java index c8b311ee219d7b..2bb3ae4211f0d4 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java @@ -116,7 +116,7 @@ public void testLogicalJoin() { public void testLogicalOlapScan() { LogicalOlapScan plan = PlanConstructor.newLogicalOlapScan(0, "table", 0); Assertions.assertTrue( - plan.toString().matches("LogicalOlapScan \\( qualified=db\\.table, " + plan.toString().matches("LogicalOlapScan\\[0\\] \\( qualified=db\\.table, " + "indexName=, " + "selectedIndexId=-1, preAgg=UNSET, operativeCol=\\[].*")); } diff --git a/regression-test/data/nereids_p0/eager_agg/eager_agg.out b/regression-test/data/nereids_p0/eager_agg/eager_agg.out new file mode 100644 index 00000000000000..250d49364b6e5a --- /dev/null +++ b/regression-test/data/nereids_p0/eager_agg/eager_agg.out @@ -0,0 +1,452 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !a -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !a_exe -- +2024 66.00 54.00 +2025 50.00 42.00 + +-- !a2 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !a2_exe -- +2024 120.00 +2025 92.00 + +-- !sum_min_max -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !sum_min_max_exe -- +2024 66.00 11.00 16.00 +2025 50.00 20.00 22.00 + +-- !avg -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------PhysicalProject +------------------PhysicalOlapScan[store_sales(ss)] +----------------PhysicalProject +------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !avg_exe -- +2025 25.0000 +2024 16.5000 + +-- !count_column -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------PhysicalProject +------------------PhysicalOlapScan[store_sales(ss)] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !count_column_exe -- +2024 4 +2025 2 + +-- !count_star -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------PhysicalProject +------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !count_star_exe -- +2025 2 +2024 4 + +-- !count_distinct -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------PhysicalProject +------------------PhysicalOlapScan[store_sales(ss)] +----------------PhysicalProject +------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !count_distinct_exe -- +2024 2 +2025 1 + +-- !count_sum_mixed -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !count_sum_mixed_exe -- +2025 2 42.00 +2024 4 54.00 + +-- !count_star_sum_mixed -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales(ss)] +----------------PhysicalProject +------------------PhysicalOlapScan[web_sales(ws)] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim(dt)] + +Hint log: +Used: leading({ ss ws } dt ) +UnUsed: +SyntaxError: + +-- !count_star_sum_mixed_exe -- +2024 4 54.00 +2025 2 42.00 + +-- !groupkey_push_SS_JOIN_D -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales(ss)] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[date_dim(dt)] +--------------PhysicalProject +----------------PhysicalOlapScan[web_sales(ws)] + +Hint log: +Used: leading({ ss dt } ws ) +UnUsed: +SyntaxError: + +-- !groupkey_push_SS_JOIN_D_exe -- +2024 10.00 12.00 +2024 15.00 17.00 +2024 25.00 29.00 +2025 18.00 21.00 +2025 20.00 23.00 + +-- !groupkey_push -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales(ss)] +------------------PhysicalProject +--------------------PhysicalOlapScan[date_dim(dt)] +--------------PhysicalProject +----------------PhysicalOlapScan[web_sales(ws)] + +Hint log: +Used: leading({ ss dt } ws ) +UnUsed: +SyntaxError: + +-- !groupkey_push_exe -- +2024 20.00 22.00 +2024 30.00 32.00 +2025 18.00 20.00 +2025 20.00 22.00 + +-- !sum_if_push -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_sales] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] + +Hint log: +Used: leading({ web_sales item } date_dim ) +UnUsed: +SyntaxError: + +-- !sum_if_push_exe -- +1 30.50 \N \N \N \N \N +2 \N 22.00 \N \N \N \N + +-- !check_case_when_outer_join_not_push -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() +--------------PhysicalProject +----------------PhysicalOlapScan[store_sales] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] + +-- !check_no_case_when_outer_join_push -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[RIGHT_OUTER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] + +-- !check_no_push_value_slots_contains_if_slots -- +PhysicalResultSink +--PhysicalProject +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() +--------------PhysicalProject +----------------PhysicalOlapScan[store_sales] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] + +-- !min_sum_same_slot -- +PhysicalResultSink +--filter(brand IS NULL) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales(ss)] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[date_dim(dt)] +--------------PhysicalProject +----------------PhysicalOlapScan[web_sales(ws)] + +Hint log: +Used: leading({ ss dt } ws ) +UnUsed: +SyntaxError: + +-- !min_sum_same_slot_exe -- + +-- !sum_min_same_slot_exe -- + +-- !no_push_aggkey_groupKey_overlap -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((ss.ss_item_sk = ws.ws_item_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +----------------PhysicalProject +------------------PhysicalOlapScan[store_sales(ss)] +----------------PhysicalProject +------------------PhysicalOlapScan[date_dim(dt)] +------------PhysicalProject +--------------PhysicalOlapScan[web_sales(ws)] + +Hint log: +Used: leading({ ss dt } ws ) +UnUsed: +SyntaxError: + +-- !no_push_not_all_union_children_push -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecHash] +------hashAgg[LOCAL] +--------PhysicalUnion +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((dt.d_date_sk = ss.ss_sold_date_sk)) otherCondition=() +--------------PhysicalProject +----------------PhysicalOlapScan[store_sales(ss)] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim(dt)] +----------PhysicalDistribute[DistributionSpecExecutionAny] +------------PhysicalProject +--------------PhysicalOlapScan[date_dim] + +Hint log: +Used: leading({ ss dt } ) +UnUsed: +SyntaxError: + diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/basic.out b/regression-test/data/nereids_rules_p0/eager_aggregate/basic.out deleted file mode 100644 index 717af2c6806157..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/basic.out +++ /dev/null @@ -1,98 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------filter((a.event_id = 'ad_click')) -----------PhysicalOlapScan[com_dd_library(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 37.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library(b)] - --- !2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library(b)] - --- !3 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library(b)] - --- !4 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library(a)] ---------PhysicalOlapScan[shunt_log_com_dd_library(b)] - --- !with_hint_1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((a.event_id = 'ad_click')) -------------PhysicalOlapScan[com_dd_library(a)] ---------hashAgg[GLOBAL] -----------filter((cast(experiment_id as DECIMALV3(38, 6)) = 37.000000)) -------------PhysicalOlapScan[shunt_log_com_dd_library(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_3 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_4 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library(a)] ---------PhysicalOlapScan[shunt_log_com_dd_library(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: use_push_down_agg_through_join -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/basic_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/basic_one_side.out deleted file mode 100644 index 40e57c30dd9582..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/basic_one_side.out +++ /dev/null @@ -1,98 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------filter((a.event_id = 'ad_click')) -----------PhysicalOlapScan[com_dd_library_one_side(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 37.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - --- !2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library_one_side(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - --- !3 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library_one_side(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - --- !4 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------PhysicalOlapScan[com_dd_library_one_side(a)] ---------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - --- !with_hint_1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((a.event_id = 'ad_click')) -------------PhysicalOlapScan[com_dd_library_one_side(a)] ---------hashAgg[GLOBAL] -----------filter((cast(experiment_id as DECIMALV3(38, 6)) = 37.000000)) -------------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library_one_side(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_3 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library_one_side(a)] ---------filter((cast(experiment_id as DECIMALV3(38, 6)) = 73.000000)) -----------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_4 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((a.device_id = b.device_id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[com_dd_library_one_side(a)] ---------PhysicalOlapScan[shunt_log_com_dd_library_one_side(b)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.out deleted file mode 100644 index 69b42b6eedce76..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.out +++ /dev/null @@ -1,237 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -1 -1 -1 -3 - --- !groupby_pushdown_left_join -- -1 -1 -1 -3 - --- !groupby_pushdown_right_join -- -1 -1 -1 -3 - --- !groupby_pushdown_full_join -- -1 -1 -1 -3 - --- !groupby_pushdown_left_semi_join -- -1 -1 -1 -3 - --- !groupby_pushdown_left_anti_join -- - --- !groupby_pushdown_complex_conditions -- - --- !groupby_pushdown_with_aggregate -- -1 1 -1 2 -1 3 -3 2 - --- !groupby_pushdown_subquery -- - --- !groupby_pushdown_outer_join -- -1 -1 -1 -3 - --- !groupby_pushdown_deep_subquery -- - --- !groupby_pushdown_having -- - --- !groupby_pushdown_mixed_aggregates -- -1 1 -1 2 -1 3 -3 6 - --- !groupby_pushdown_multi_table_join -- -1 -1 -1 - --- !groupby_pushdown_with_order_by -- -1 -1 -1 -3 - --- !groupby_pushdown_multiple_equal_conditions -- -1 -1 -1 - --- !groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 1 -3 1 - --- !groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 1 -c 1 - --- !groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 1 1 -c 1 1 - --- !groupby_pushdown_with_where_clause -- - --- !groupby_pushdown_varied_aggregates -- -1 1.5 1 -1 4.5 1 -1 7.5 1 -3 7 0 - --- !groupby_pushdown_with_order_by_limit -- -1 -1 -1 -3 - --- !groupby_pushdown_alias_multiple_equal_conditions -- -1 -1 -1 - --- !groupby_pushdown_complex_join_condition -- - --- !groupby_pushdown_function_processed_columns -- -0 -1 -1 -1 - --- !groupby_pushdown_nested_queries -- - --- !with_hint_groupby_pushdown_basic -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_left_join -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_right_join -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_full_join -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_left_semi_join -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_left_anti_join -- - --- !with_hint_groupby_pushdown_complex_conditions -- - --- !with_hint_groupby_pushdown_with_aggregate -- -1 1 -1 2 -1 3 -3 2 - --- !with_hint_groupby_pushdown_subquery -- - --- !with_hint_groupby_pushdown_outer_join -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_deep_subquery -- - --- !with_hint_groupby_pushdown_having -- - --- !with_hint_groupby_pushdown_mixed_aggregates -- -1 1 -1 2 -1 3 -3 6 - --- !with_hint_groupby_pushdown_multi_table_join -- -1 -1 -1 - --- !with_hint_groupby_pushdown_with_order_by -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -1 -1 -1 - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 1 -3 1 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 1 -c 1 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 1 1 -c 1 1 - --- !with_hint_groupby_pushdown_with_where_clause -- - --- !with_hint_groupby_pushdown_varied_aggregates -- -1 1.5 1 -1 4.5 1 -1 7.5 1 -3 7 0 - --- !with_hint_groupby_pushdown_with_order_by_limit -- -1 -1 -1 -3 - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -1 -1 -1 - --- !with_hint_groupby_pushdown_complex_join_condition -- - --- !with_hint_groupby_pushdown_function_processed_columns -- -0 -1 -1 -1 - --- !with_hint_groupby_pushdown_nested_queries -- - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out deleted file mode 100644 index 709d8d0eb821c5..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join.out +++ /dev/null @@ -1,1032 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((count(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t(t1)] -----------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_multi_table_join_1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] -------PhysicalOlapScan[count_t(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1_alias)] ---------PhysicalOlapScan[count_t(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t.id < 100)) -----------PhysicalOlapScan[count_t] ---------filter((count_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t] - --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((count(*) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t(t1)] -----------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_multi_table_join_2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] -------PhysicalOlapScan[count_t(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t.id < 100)) -----------PhysicalOlapScan[count_t] ---------filter((count_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((count(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t(t1)] -----------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join_1 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] -------PhysicalOlapScan[count_t(t3)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t(t1)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1_alias)] ---------PhysicalOlapScan[count_t(t2_alias)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t.id < 100)) -----------PhysicalOlapScan[count_t] ---------filter((count_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((count_t.score > 10)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((count(*) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t(t1)] -----------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join_2 -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] -------PhysicalOlapScan[count_t(t3)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t(t1)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t(t1)] -------------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t(t1)] ---------PhysicalOlapScan[count_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t.id < 100)) -----------PhysicalOlapScan[count_t] ---------filter((count_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.out deleted file mode 100644 index b9a4c103a9b767..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.out +++ /dev/null @@ -1,1093 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((count_t_one_side.score > 10)) -----------PhysicalOlapScan[count_t_one_side] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((count_t_one_side.score > 10)) -----------PhysicalOlapScan[count_t_one_side] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((count(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t_one_side(t1)] -----------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] -------PhysicalOlapScan[count_t_one_side(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t_one_side(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1_alias)] ---------PhysicalOlapScan[count_t_one_side(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t_one_side.id < 100)) -----------PhysicalOlapScan[count_t_one_side] ---------filter((count_t_one_side.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t_one_side] - --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((count_t_one_side.score > 10)) -----------PhysicalOlapScan[count_t_one_side] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((count_t_one_side.score > 10)) -----------PhysicalOlapScan[count_t_one_side] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((count(*) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[count_t_one_side(t1)] -----------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] -------PhysicalOlapScan[count_t_one_side(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[count_t_one_side(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t_one_side.id < 100)) -----------PhysicalOlapScan[count_t_one_side] ---------filter((count_t_one_side.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[count_t_one_side] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 10)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 10)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((count(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------hashAgg[GLOBAL] -------------PhysicalOlapScan[count_t_one_side(t1)] -----------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------PhysicalOlapScan[count_t_one_side(t3)] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((t1.score > 50)) -------------PhysicalOlapScan[count_t_one_side(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1_alias)] ---------PhysicalOlapScan[count_t_one_side(t2_alias)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t_one_side.id < 100)) -----------PhysicalOlapScan[count_t_one_side] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 20) and (t1.id < 100)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 10)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 10)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((count(*) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------hashAgg[GLOBAL] -------------PhysicalOlapScan[count_t_one_side(t1)] -----------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------PhysicalOlapScan[count_t_one_side(t3)] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((t1.score > 50)) -------------PhysicalOlapScan[count_t_one_side(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[count_t_one_side(t1)] -------------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[count_t_one_side(t1)] ---------PhysicalOlapScan[count_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((count_t_one_side.id < 100)) -----------PhysicalOlapScan[count_t_one_side] ---------hashAgg[GLOBAL] -----------filter((count_t_one_side.score > 20) and (t1.id < 100)) -------------PhysicalOlapScan[count_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !shape -- -PhysicalResultSink ---PhysicalLimit[GLOBAL] -----PhysicalLimit[LOCAL] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((dwd_tracking_sensor_init_tmp_ymd.dt = dw_user_b2c_tracking_info_tmp_ymd.dt) and (dwd_tracking_sensor_init_tmp_ymd.guid = dw_user_b2c_tracking_info_tmp_ymd.guid)) otherCondition=() -------------filter((dwd_tracking_sensor_init_tmp_ymd.dt = '2024-08-19') and (dwd_tracking_sensor_init_tmp_ymd.tracking_type = 'click')) ---------------PhysicalOlapScan[dwd_tracking_sensor_init_tmp_ymd] -------------hashAgg[GLOBAL] ---------------hashAgg[LOCAL] -----------------filter((dw_user_b2c_tracking_info_tmp_ymd.dt = '2024-08-19') and (substring(first_visit_time, 1, 10) <= '2024-08-19')) -------------------PhysicalOlapScan[dw_user_b2c_tracking_info_tmp_ymd] - -Hint log: -Used: use_PUSH_DOWN_AGG_THROUGH_JOIN_ONE_SIDE -UnUsed: -SyntaxError: - --- !agg_pushed -- -2 是 2024-08-19 - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_max_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_max_through_join.out deleted file mode 100644 index 721adabf79816f..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_max_through_join.out +++ /dev/null @@ -1,592 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------filter((max_t.score > 10)) -----------PhysicalOlapScan[max_t] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------filter((max_t.score > 10)) -----------PhysicalOlapScan[max_t] - --- !groupby_pushdown_having -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------filter((t1.score > 100)) -----------PhysicalOlapScan[max_t(t1)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[max_t(t1)] -----------PhysicalOlapScan[max_t(t2)] ---------PhysicalOlapScan[max_t(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[max_t(t1)] -------------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[max_t(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[max_t(t1)] -------------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[max_t(t1_alias)] ---------PhysicalOlapScan[max_t(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((max_t.id < 100)) -----------PhysicalOlapScan[max_t] ---------filter((max_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[max_t] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------hashAgg[GLOBAL] -----------filter((max_t.score > 10)) -------------PhysicalOlapScan[max_t] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------hashAgg[GLOBAL] -----------filter((max_t.score > 10)) -------------PhysicalOlapScan[max_t] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------hashAgg[GLOBAL] -----------filter((t1.score > 100)) -------------PhysicalOlapScan[max_t(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------PhysicalOlapScan[max_t(t3)] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[max_t(t1)] -------------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[max_t(t1)] -------------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t2)] ---------hashAgg[GLOBAL] -----------filter((t1.score > 50)) -------------PhysicalOlapScan[max_t(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[max_t(t1)] -------------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1_alias)] ---------PhysicalOlapScan[max_t(t2_alias)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[max_t(t1)] ---------PhysicalOlapScan[max_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((max_t.id < 100)) -----------PhysicalOlapScan[max_t] ---------hashAgg[GLOBAL] -----------filter((max_t.score > 20) and (t1.id < 100)) -------------PhysicalOlapScan[max_t] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.out deleted file mode 100644 index 434c37d5d9a48c..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.out +++ /dev/null @@ -1,237 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -1 -1 -2 -3 - --- !groupby_pushdown_left_join -- -1 -1 -2 -3 - --- !groupby_pushdown_right_join -- -1 -1 -2 -3 - --- !groupby_pushdown_full_join -- -1 -1 -2 -3 - --- !groupby_pushdown_left_semi_join -- -1 -1 -2 -3 - --- !groupby_pushdown_left_anti_join -- - --- !groupby_pushdown_complex_conditions -- - --- !groupby_pushdown_with_aggregate -- -1 1 -1 2 -2 2 -3 3 - --- !groupby_pushdown_subquery -- - --- !groupby_pushdown_outer_join -- -1 -1 -2 -3 - --- !groupby_pushdown_deep_subquery -- - --- !groupby_pushdown_having -- - --- !groupby_pushdown_mixed_aggregates -- -1 1 -1 6 -2 2 -3 3 - --- !groupby_pushdown_multi_table_join -- -1 -2 -3 - --- !groupby_pushdown_with_order_by -- -1 -1 -2 -3 - --- !groupby_pushdown_multiple_equal_conditions -- -1 -2 -3 - --- !groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 2 -3 3 - --- !groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 2 -c 3 - --- !groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 2 2 -c 3 3 - --- !groupby_pushdown_with_where_clause -- - --- !groupby_pushdown_varied_aggregates -- -1 1.5 a -1 7 \N -2 4.5 b -3 7.5 c - --- !groupby_pushdown_with_order_by_limit -- -1 -1 -2 -3 - --- !groupby_pushdown_alias_multiple_equal_conditions -- -1 -2 -3 - --- !groupby_pushdown_complex_join_condition -- - --- !groupby_pushdown_function_processed_columns -- -\N -1 -1 -1 - --- !groupby_pushdown_nested_queries -- - --- !with_hint_groupby_pushdown_basic -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_left_join -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_right_join -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_full_join -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_left_semi_join -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_left_anti_join -- - --- !with_hint_groupby_pushdown_complex_conditions -- - --- !with_hint_groupby_pushdown_with_aggregate -- -1 1 -1 2 -2 2 -3 3 - --- !with_hint_groupby_pushdown_subquery -- - --- !with_hint_groupby_pushdown_outer_join -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_deep_subquery -- - --- !with_hint_groupby_pushdown_having -- - --- !with_hint_groupby_pushdown_mixed_aggregates -- -1 1 -1 6 -2 2 -3 3 - --- !with_hint_groupby_pushdown_multi_table_join -- -1 -2 -3 - --- !with_hint_groupby_pushdown_with_order_by -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -1 -2 -3 - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 2 -3 3 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 2 -c 3 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 2 2 -c 3 3 - --- !with_hint_groupby_pushdown_with_where_clause -- - --- !with_hint_groupby_pushdown_varied_aggregates -- -1 1.5 a -1 7 \N -2 4.5 b -3 7.5 c - --- !with_hint_groupby_pushdown_with_order_by_limit -- -1 -1 -2 -3 - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -1 -2 -3 - --- !with_hint_groupby_pushdown_complex_join_condition -- - --- !with_hint_groupby_pushdown_function_processed_columns -- -\N -1 -1 -1 - --- !with_hint_groupby_pushdown_nested_queries -- - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_through_join.out deleted file mode 100644 index 380636767f30d4..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_min_through_join.out +++ /dev/null @@ -1,592 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((min_t.score > 10)) -----------PhysicalOlapScan[min_t] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((min_t.score > 10)) -----------PhysicalOlapScan[min_t] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((min(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[min_t(t1)] -----------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[min_t(t1)] -----------PhysicalOlapScan[min_t(t2)] ---------PhysicalOlapScan[min_t(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[min_t(t1)] -------------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((t1.score > 50)) -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[min_t(t1)] -------------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[min_t(t1_alias)] ---------PhysicalOlapScan[min_t(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((min_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[min_t] ---------filter((min_t.id < 100)) -----------PhysicalOlapScan[min_t] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((min_t.score > 10)) -------------PhysicalOlapScan[min_t] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((min_t.score > 10)) -------------PhysicalOlapScan[min_t] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((min(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------hashAgg[GLOBAL] -------------PhysicalOlapScan[min_t(t1)] -----------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[min_t(t1)] -------------PhysicalOlapScan[min_t(t2)] -------PhysicalOlapScan[min_t(t3)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[min_t(t1)] -------------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((t1.score > 50)) -------------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[min_t(t1)] -------------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1_alias)] ---------PhysicalOlapScan[min_t(t2_alias)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[min_t(t1)] ---------PhysicalOlapScan[min_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------filter((min_t.score > 20) and (t1.id < 100)) -------------PhysicalOlapScan[min_t] ---------filter((min_t.id < 100)) -----------PhysicalOlapScan[min_t] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.out deleted file mode 100644 index f520240cc73290..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.out +++ /dev/null @@ -1,231 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -1 -2 -3 -6 - --- !groupby_pushdown_left_join -- -1 -2 -3 -6 - --- !groupby_pushdown_right_join -- -1 -2 -3 -6 - --- !groupby_pushdown_full_join -- -1 -2 -3 -6 - --- !groupby_pushdown_left_semi_join -- -1 -2 -3 -6 - --- !groupby_pushdown_left_anti_join -- - --- !groupby_pushdown_complex_conditions -- - --- !groupby_pushdown_with_aggregate -- -1 1 -2 2 -3 3 -6 2 - --- !groupby_pushdown_subquery -- - --- !groupby_pushdown_outer_join -- -1 -2 -3 -6 - --- !groupby_pushdown_deep_subquery -- - --- !groupby_pushdown_having -- - --- !groupby_pushdown_mixed_aggregates -- -1 1 -2 2 -3 3 -6 6 - --- !groupby_pushdown_multi_table_join -- -1 -2 -3 - --- !groupby_pushdown_with_order_by -- -1 -2 -3 -6 - --- !groupby_pushdown_multiple_equal_conditions -- -1 -2 -3 - --- !groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 2 -3 3 - --- !groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 2 -c 3 - --- !groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 2 2 -c 3 3 - --- !groupby_pushdown_with_where_clause -- - --- !groupby_pushdown_varied_aggregates -- -1 -2 -3 -6 - --- !groupby_pushdown_with_order_by_limit -- -1 -2 -3 -6 - --- !groupby_pushdown_alias_multiple_equal_conditions -- -1 -2 -3 - --- !groupby_pushdown_complex_join_condition -- - --- !groupby_pushdown_function_processed_columns -- -1 -2 -3 -6 - --- !groupby_pushdown_nested_queries -- - --- !with_hint_groupby_pushdown_basic -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_left_join -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_right_join -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_full_join -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_left_semi_join -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_left_anti_join -- - --- !with_hint_groupby_pushdown_complex_conditions -- - --- !with_hint_groupby_pushdown_with_aggregate -- -1 1 -2 2 -3 3 -6 2 - --- !with_hint_groupby_pushdown_subquery -- - --- !with_hint_groupby_pushdown_outer_join -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_deep_subquery -- - --- !with_hint_groupby_pushdown_having -- - --- !with_hint_groupby_pushdown_mixed_aggregates -- -1 1 -2 2 -3 3 -6 6 - --- !with_hint_groupby_pushdown_multi_table_join -- -1 -2 -3 - --- !with_hint_groupby_pushdown_with_order_by -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -1 -2 -3 - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -1 1 -2 2 -3 3 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate -- -a 1 -b 2 -c 3 - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate -- -a 1 1 -b 2 2 -c 3 3 - --- !with_hint_groupby_pushdown_with_where_clause -- - --- !with_hint_groupby_pushdown_varied_aggregates -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_with_order_by_limit -- -1 -2 -3 -6 - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -1 -2 -3 - --- !with_hint_groupby_pushdown_complex_join_condition -- - --- !with_hint_groupby_pushdown_nested_queries -- - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out deleted file mode 100644 index d7df3cbed86e71..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.out +++ /dev/null @@ -1,569 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((sum_t.score > 10)) -----------PhysicalOlapScan[sum_t] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((sum_t.score > 10)) -----------PhysicalOlapScan[sum_t] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((sum(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[sum_t(t1)] -----------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] -------PhysicalOlapScan[sum_t(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t(t1)] -------------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[sum_t(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t(t1)] -------------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1_alias)] ---------PhysicalOlapScan[sum_t(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((sum_t.id < 100)) -----------PhysicalOlapScan[sum_t] ---------filter((sum_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[sum_t] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((sum_t.score > 10)) -----------PhysicalOlapScan[sum_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((sum_t.score > 10)) -----------PhysicalOlapScan[sum_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((sum(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[sum_t(t1)] -----------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] -------PhysicalOlapScan[sum_t(t3)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t(t1)] -------------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[sum_t(t1)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t(t1)] -------------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1_alias)] ---------PhysicalOlapScan[sum_t(t2_alias)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t(t1)] ---------PhysicalOlapScan[sum_t(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((sum_t.id < 100)) -----------PhysicalOlapScan[sum_t] ---------filter((sum_t.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[sum_t] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join -SyntaxError: - diff --git a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.out b/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.out deleted file mode 100644 index ff4de95e6c89ef..00000000000000 --- a/regression-test/data/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.out +++ /dev/null @@ -1,592 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------filter((sum_t_one_side.score > 10)) -----------PhysicalOlapScan[sum_t_one_side] - --- !groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------filter((sum_t_one_side.score > 10)) -----------PhysicalOlapScan[sum_t_one_side] - --- !groupby_pushdown_having -- -PhysicalResultSink ---filter((sum(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[sum_t_one_side(t1)] -----------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] -------PhysicalOlapScan[sum_t_one_side(t3)] - --- !groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t_one_side(t1)] -------------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------filter((t1.score > 50)) -----------PhysicalOlapScan[sum_t_one_side(t1)] - --- !groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------PhysicalOlapScan[sum_t_one_side(t1)] -------------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1_alias)] ---------PhysicalOlapScan[sum_t_one_side(t2_alias)] - --- !groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - --- !groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((sum_t_one_side.id < 100)) -----------PhysicalOlapScan[sum_t_one_side] ---------filter((sum_t_one_side.score > 20) and (t1.id < 100)) -----------PhysicalOlapScan[sum_t_one_side] - --- !with_hint_groupby_pushdown_basic -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------filter((t2.score < 100)) -----------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_right_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_full_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_left_semi_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_left_anti_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_complex_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=((t1.name < t2.name)) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((sum_t_one_side.score > 10)) -------------PhysicalOlapScan[sum_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_outer_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_deep_subquery -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((sum_t_one_side.score > 10)) -------------PhysicalOlapScan[sum_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_having -- -PhysicalResultSink ---filter((sum(t1.score) > 100)) -----hashAgg[GLOBAL] -------hashAgg[LOCAL] ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------hashAgg[GLOBAL] -------------PhysicalOlapScan[sum_t_one_side(t1)] -----------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_mixed_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multi_table_join -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashJoin[INNER_JOIN] hashCondition=((t1.name = t3.name)) otherCondition=() -------PhysicalOlapScan[sum_t_one_side(t3)] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[sum_t_one_side(t1)] -------------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by -- -PhysicalResultSink ---PhysicalQuickSort[MERGE_SORT] -----PhysicalQuickSort[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[sum_t_one_side(t1)] -------------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.name = t2.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_with_where_clause -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t2)] ---------hashAgg[GLOBAL] -----------filter((t1.score > 50)) -------------PhysicalOlapScan[sum_t_one_side(t1)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_varied_aggregates -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_with_order_by_limit -- -PhysicalResultSink ---PhysicalTopN[MERGE_SORT] -----PhysicalTopN[LOCAL_SORT] -------hashAgg[GLOBAL] ---------hashAgg[LOCAL] -----------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------------hashAgg[GLOBAL] ---------------PhysicalOlapScan[sum_t_one_side(t1)] -------------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_alias_multiple_equal_conditions -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1_alias.id = t2_alias.id) and (t1_alias.name = t2_alias.name)) otherCondition=() ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1_alias)] ---------PhysicalOlapScan[sum_t_one_side(t2_alias)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_complex_join_condition -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id) and (t1.score = t2.score)) otherCondition=(( not (name = name))) ---------hashAgg[GLOBAL] -----------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - --- !with_hint_groupby_pushdown_function_processed_columns -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[sum_t_one_side(t1)] ---------PhysicalOlapScan[sum_t_one_side(t2)] - -Hint log: -Used: -UnUsed: use_push_down_agg_through_join_one_side -SyntaxError: - --- !with_hint_groupby_pushdown_nested_queries -- -PhysicalResultSink ---hashAgg[GLOBAL] -----hashAgg[LOCAL] -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((sum_t_one_side.id < 100)) -----------PhysicalOlapScan[sum_t_one_side] ---------hashAgg[GLOBAL] -----------filter((sum_t_one_side.score > 20) and (t1.id < 100)) -------------PhysicalOlapScan[sum_t_one_side] - -Hint log: -Used: use_push_down_agg_through_join_one_side -UnUsed: -SyntaxError: - diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query2.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query2.out index 12167efa7486a4..41ad24ad066406 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query2.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query2.out @@ -6,16 +6,20 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() ---------------PhysicalUnion -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[web_sales] -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[catalog_sales] +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 sold_date_sk->[d_date_sk] --------------PhysicalProject -----------------PhysicalOlapScan[date_dim] +----------------PhysicalOlapScan[date_dim] apply RFs: RF0 +--------------PhysicalUnion +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query3.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query3.out index e9c6ec79c33e7b..fae84ff1a42849 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query3.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query3.out @@ -9,15 +9,18 @@ PhysicalResultSink ------------PhysicalDistribute[DistributionSpecHash] --------------hashAgg[LOCAL] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 -------------------------PhysicalProject ---------------------------filter((item.i_manufact_id = 816)) -----------------------------PhysicalOlapScan[item] +--------------------------filter((dt.d_moy = 11)) +----------------------------PhysicalOlapScan[date_dim(dt)] --------------------PhysicalProject -----------------------filter((dt.d_moy = 11)) -------------------------PhysicalOlapScan[date_dim(dt)] +----------------------filter((item.i_manufact_id = 816)) +------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query31.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query31.out index af4392c42a70b7..89da394c70488e 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query31.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query31.out @@ -9,9 +9,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------PhysicalProject --------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------------PhysicalProject -----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 --------------------PhysicalProject ----------------------filter((ss.d_year = 2000) and d_qoy IN (1, 2, 3)) ------------------------PhysicalOlapScan[date_dim] @@ -26,9 +29,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 ----------------------PhysicalProject ------------------------filter((ws.d_year = 2000) and d_qoy IN (1, 2, 3)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query42.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query42.out index b2a262da46536b..0bb9347e187642 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query42.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query42.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query43.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query43.out index 37ab89010ef0a9..38ee41c557e4dd 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query43.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query43.out @@ -10,9 +10,12 @@ PhysicalResultSink --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ----------------------PhysicalProject ------------------------filter((date_dim.d_year = 2000)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query52.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query52.out index ddcc09c49f974a..0d3bcc7688306c 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query52.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query52.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query55.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query55.out index e24470e9606c8b..94b0bfd66b3823 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query55.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query55.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 100)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query59.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query59.out index 215b62a9180db7..12ffd327e847a8 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query59.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query59.out @@ -6,9 +6,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() ---------------PhysicalProject -----------------PhysicalOlapScan[store_sales] +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] --PhysicalResultSink diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query64.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query64.out index 92a15d7ac88b59..28df68528b5f2f 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query64.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query64.out @@ -7,86 +7,85 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) --------PhysicalDistribute[DistributionSpecHash] ----------hashAgg[LOCAL] ------------PhysicalProject ---------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[cr_item_sk,cs_item_sk,sr_item_sk,ss_item_sk] +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) build RFs:RF17 ss_customer_sk->[c_customer_sk] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=() --------------------------------PhysicalProject ----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_hdemo_sk = hd2.hd_demo_sk)) otherCondition=() ------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF17 +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() ----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() ---------------------------------------------PhysicalProject -----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) -------------------------------------------------PhysicalProject ---------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() -----------------------------------------------------PhysicalProject -------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() ---------------------------------------------------------PhysicalProject -----------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() -------------------------------------------------------------PhysicalProject ---------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() -----------------------------------------------------------------PhysicalProject -------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() ---------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] -------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[sr_item_sk,ss_item_sk] -----------------------------------------------------------------------------PhysicalProject -------------------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() ---------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 RF19 ---------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF4 RF19 -----------------------------------------------------------------------------PhysicalProject -------------------------------------------------------------------------------filter((sale > (2 * refund))) ---------------------------------------------------------------------------------hashAgg[GLOBAL] -----------------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------------------------------------------hashAgg[LOCAL] ---------------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() -------------------------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF19 -------------------------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF19 -------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------filter(d_year IN (2001, 2002)) -----------------------------------------------------------------------------PhysicalOlapScan[date_dim(d1)] ---------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------PhysicalOlapScan[store] -----------------------------------------------------------------PhysicalProject -------------------------------------------------------------------PhysicalOlapScan[customer] -------------------------------------------------------------PhysicalProject ---------------------------------------------------------------PhysicalOlapScan[date_dim(d2)] ---------------------------------------------------------PhysicalProject -----------------------------------------------------------PhysicalOlapScan[date_dim(d3)] -----------------------------------------------------PhysicalProject -------------------------------------------------------PhysicalOlapScan[customer_demographics(cd1)] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[customer_demographics(cd2)] ---------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[promotion] +------------------------------------------PhysicalOlapScan[household_demographics(hd2)] ----------------------------------------PhysicalProject -------------------------------------------PhysicalOlapScan[household_demographics(hd1)] -------------------------------------PhysicalProject ---------------------------------------PhysicalOlapScan[household_demographics(hd2)] +------------------------------------------PhysicalOlapScan[income_band(ib2)] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[customer_address(ad1)] +----------------------------------PhysicalOlapScan[customer_demographics(cd2)] ----------------------------PhysicalProject ------------------------------PhysicalOlapScan[customer_address(ad2)] ------------------------PhysicalProject ---------------------------PhysicalOlapScan[income_band(ib1)] +--------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF11 ss_item_sk->[sr_item_sk];RF12 ss_ticket_number->[sr_ticket_number] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_returns] apply RFs: RF11 RF12 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() build RFs:RF10 ss_addr_sk->[ca_address_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer_address(ad1)] apply RFs: RF10 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF9 ss_cdemo_sk->[cd_demo_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer_demographics(cd1)] apply RFs: RF9 +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF8 i_item_sk->[cr_item_sk,cs_item_sk,ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() +--------------------------------------------------PhysicalProject +----------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF3 cs_item_sk->[ss_item_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF8 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter(d_year IN (2001, 2002)) +------------------------------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((sale > (2 * refund))) +--------------------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF8 +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF8 +------------------------------------------------------PhysicalProject +--------------------------------------------------------PhysicalOlapScan[household_demographics(hd1)] +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[income_band(ib1)] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[promotion] +--------------------------------------PhysicalProject +----------------------------------------filter((item.i_current_price <= 33.00) and (item.i_current_price >= 24.00) and i_color IN ('blanched', 'brown', 'burlywood', 'chocolate', 'drab', 'medium')) +------------------------------------------PhysicalOlapScan[item] --------------------PhysicalProject -----------------------PhysicalOlapScan[income_band(ib2)] +----------------------PhysicalOlapScan[date_dim(d2)] ----------------PhysicalProject -------------------filter((item.i_current_price <= 33.00) and (item.i_current_price >= 24.00) and i_color IN ('blanched', 'brown', 'burlywood', 'chocolate', 'drab', 'medium')) ---------------------PhysicalOlapScan[item] +------------------PhysicalOlapScan[date_dim(d3)] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query2.out b/regression-test/data/shape_check/tpcds_sf100/shape/query2.out index b9857d349977f8..41ad24ad066406 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query2.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query2.out @@ -6,16 +6,20 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] ---------------PhysicalUnion -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[web_sales] apply RFs: RF0 -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 sold_date_sk->[d_date_sk] --------------PhysicalProject -----------------PhysicalOlapScan[date_dim] +----------------PhysicalOlapScan[date_dim] apply RFs: RF0 +--------------PhysicalUnion +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query3.out b/regression-test/data/shape_check/tpcds_sf100/shape/query3.out index e9c6ec79c33e7b..fae84ff1a42849 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query3.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query3.out @@ -9,15 +9,18 @@ PhysicalResultSink ------------PhysicalDistribute[DistributionSpecHash] --------------hashAgg[LOCAL] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 -------------------------PhysicalProject ---------------------------filter((item.i_manufact_id = 816)) -----------------------------PhysicalOlapScan[item] +--------------------------filter((dt.d_moy = 11)) +----------------------------PhysicalOlapScan[date_dim(dt)] --------------------PhysicalProject -----------------------filter((dt.d_moy = 11)) -------------------------PhysicalOlapScan[date_dim(dt)] +----------------------filter((item.i_manufact_id = 816)) +------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query31.out b/regression-test/data/shape_check/tpcds_sf100/shape/query31.out index d45dad8dca8825..ed4c26b9893795 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query31.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query31.out @@ -9,9 +9,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------PhysicalProject --------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------------PhysicalProject -----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 --------------------PhysicalProject ----------------------filter((ss.d_year = 2000) and d_qoy IN (1, 2, 3)) ------------------------PhysicalOlapScan[date_dim] @@ -26,9 +29,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_bill_addr_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 ----------------------PhysicalProject ------------------------filter((ws.d_year = 2000) and d_qoy IN (1, 2, 3)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query42.out b/regression-test/data/shape_check/tpcds_sf100/shape/query42.out index b2a262da46536b..0bb9347e187642 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query42.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query42.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query43.out b/regression-test/data/shape_check/tpcds_sf100/shape/query43.out index 37ab89010ef0a9..38ee41c557e4dd 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query43.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query43.out @@ -10,9 +10,12 @@ PhysicalResultSink --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ----------------------PhysicalProject ------------------------filter((date_dim.d_year = 2000)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query52.out b/regression-test/data/shape_check/tpcds_sf100/shape/query52.out index ddcc09c49f974a..0d3bcc7688306c 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query52.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query52.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query55.out b/regression-test/data/shape_check/tpcds_sf100/shape/query55.out index e24470e9606c8b..94b0bfd66b3823 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query55.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query55.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 100)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query59.out b/regression-test/data/shape_check/tpcds_sf100/shape/query59.out index f28f49bf99a493..f5fc81e7ddb98c 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query59.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query59.out @@ -6,9 +6,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------PhysicalProject -----------------PhysicalOlapScan[store_sales] apply RFs: RF0 +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] --PhysicalResultSink diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query64.out b/regression-test/data/shape_check/tpcds_sf100/shape/query64.out index 9c9971d7429f9b..9b91b5a6891b8f 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query64.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query64.out @@ -7,86 +7,85 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) --------PhysicalDistribute[DistributionSpecHash] ----------hashAgg[LOCAL] ------------PhysicalProject ---------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[cr_item_sk,cs_item_sk,sr_item_sk,ss_item_sk] +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF19 d_date_sk->[c_first_shipto_date_sk] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() build RFs:RF18 ib_income_band_sk->[hd_income_band_sk] +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[c_first_sales_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() build RFs:RF17 ib_income_band_sk->[hd_income_band_sk] +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) build RFs:RF17 ss_customer_sk->[c_customer_sk] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() build RFs:RF16 ca_address_sk->[c_current_addr_sk] +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() build RFs:RF16 ca_address_sk->[c_current_addr_sk] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() build RFs:RF15 ca_address_sk->[ss_addr_sk] +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=() build RFs:RF15 cd_demo_sk->[c_current_cdemo_sk] --------------------------------PhysicalProject ----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_hdemo_sk = hd2.hd_demo_sk)) otherCondition=() build RFs:RF14 hd_demo_sk->[c_current_hdemo_sk] ------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() build RFs:RF13 hd_demo_sk->[ss_hdemo_sk] +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF14 RF15 RF16 RF17 RF18 RF19 +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() build RFs:RF13 ib_income_band_sk->[hd_income_band_sk] ----------------------------------------PhysicalProject -------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF12 p_promo_sk->[ss_promo_sk] ---------------------------------------------PhysicalProject -----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) build RFs:RF11 cd_demo_sk->[c_current_cdemo_sk] -------------------------------------------------PhysicalProject ---------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF10 cd_demo_sk->[ss_cdemo_sk] -----------------------------------------------------PhysicalProject -------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[c_first_shipto_date_sk] ---------------------------------------------------------PhysicalProject -----------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[c_first_sales_date_sk] -------------------------------------------------------------PhysicalProject ---------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] -----------------------------------------------------------------PhysicalProject -------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF6 s_store_sk->[ss_store_sk] ---------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] -------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[sr_item_sk,ss_item_sk] -----------------------------------------------------------------------------PhysicalProject -------------------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF2 sr_item_sk->[ss_item_sk];RF3 sr_ticket_number->[ss_ticket_number] ---------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF4 RF5 RF6 RF7 RF10 RF12 RF13 RF15 RF19 ---------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF4 RF19 -----------------------------------------------------------------------------PhysicalProject -------------------------------------------------------------------------------filter((sale > (2 * refund))) ---------------------------------------------------------------------------------hashAgg[GLOBAL] -----------------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] -------------------------------------------------------------------------------------hashAgg[LOCAL] ---------------------------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF0 cr_item_sk->[cs_item_sk];RF1 cr_order_number->[cs_order_number] -------------------------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF19 -------------------------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF19 -------------------------------------------------------------------------PhysicalProject ---------------------------------------------------------------------------filter(d_year IN (2001, 2002)) -----------------------------------------------------------------------------PhysicalOlapScan[date_dim(d1)] ---------------------------------------------------------------------PhysicalProject -----------------------------------------------------------------------PhysicalOlapScan[store] -----------------------------------------------------------------PhysicalProject -------------------------------------------------------------------PhysicalOlapScan[customer] apply RFs: RF8 RF9 RF11 RF14 RF16 -------------------------------------------------------------PhysicalProject ---------------------------------------------------------------PhysicalOlapScan[date_dim(d2)] ---------------------------------------------------------PhysicalProject -----------------------------------------------------------PhysicalOlapScan[date_dim(d3)] -----------------------------------------------------PhysicalProject -------------------------------------------------------PhysicalOlapScan[customer_demographics(cd1)] -------------------------------------------------PhysicalProject ---------------------------------------------------PhysicalOlapScan[customer_demographics(cd2)] ---------------------------------------------PhysicalProject -----------------------------------------------PhysicalOlapScan[promotion] +------------------------------------------PhysicalOlapScan[household_demographics(hd2)] apply RFs: RF13 ----------------------------------------PhysicalProject -------------------------------------------PhysicalOlapScan[household_demographics(hd1)] apply RFs: RF17 -------------------------------------PhysicalProject ---------------------------------------PhysicalOlapScan[household_demographics(hd2)] apply RFs: RF18 +------------------------------------------PhysicalOlapScan[income_band(ib2)] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[customer_address(ad1)] +----------------------------------PhysicalOlapScan[customer_demographics(cd2)] ----------------------------PhysicalProject ------------------------------PhysicalOlapScan[customer_address(ad2)] ------------------------PhysicalProject ---------------------------PhysicalOlapScan[income_band(ib1)] +--------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF11 ss_item_sk->[sr_item_sk];RF12 ss_ticket_number->[sr_ticket_number] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_returns] apply RFs: RF11 RF12 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() build RFs:RF10 ss_addr_sk->[ca_address_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer_address(ad1)] apply RFs: RF10 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF9 ss_cdemo_sk->[cd_demo_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer_demographics(cd1)] apply RFs: RF9 +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF8 i_item_sk->[cr_item_sk,cs_item_sk,ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF7 p_promo_sk->[ss_promo_sk] +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF6 s_store_sk->[ss_store_sk] +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() build RFs:RF5 ib_income_band_sk->[hd_income_band_sk] +--------------------------------------------------PhysicalProject +----------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() build RFs:RF4 hd_demo_sk->[ss_hdemo_sk] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF3 cs_item_sk->[ss_item_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF4 RF6 RF7 RF8 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter(d_year IN (2001, 2002)) +------------------------------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((sale > (2 * refund))) +--------------------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF0 cr_item_sk->[cs_item_sk];RF1 cr_order_number->[cs_order_number] +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF8 +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF8 +------------------------------------------------------PhysicalProject +--------------------------------------------------------PhysicalOlapScan[household_demographics(hd1)] apply RFs: RF5 +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[income_band(ib1)] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[promotion] +--------------------------------------PhysicalProject +----------------------------------------filter((item.i_current_price <= 33.00) and (item.i_current_price >= 24.00) and i_color IN ('blanched', 'brown', 'burlywood', 'chocolate', 'drab', 'medium')) +------------------------------------------PhysicalOlapScan[item] --------------------PhysicalProject -----------------------PhysicalOlapScan[income_band(ib2)] +----------------------PhysicalOlapScan[date_dim(d2)] ----------------PhysicalProject -------------------filter((item.i_current_price <= 33.00) and (item.i_current_price >= 24.00) and i_color IN ('blanched', 'brown', 'burlywood', 'chocolate', 'drab', 'medium')) ---------------------PhysicalOlapScan[item] +------------------PhysicalOlapScan[date_dim(d3)] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query2.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query2.out index 197d38b7c71d8f..e9bce4b8168faa 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query2.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query2.out @@ -8,12 +8,16 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) ----------PhysicalProject ------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] --------------PhysicalUnion -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[web_sales] apply RFs: RF0 -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalProject ---------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] --PhysicalResultSink diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query31.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query31.out index f4922710b5cc95..4bbfc877903b37 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query31.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query31.out @@ -9,9 +9,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------PhysicalProject --------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] ----------------PhysicalProject -------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------------PhysicalProject -----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 --------------------PhysicalProject ----------------------filter((ss.d_year = 1999) and d_qoy IN (1, 2, 3)) ------------------------PhysicalOlapScan[date_dim] @@ -26,9 +29,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_bill_addr_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 ----------------------PhysicalProject ------------------------filter((ws.d_year = 1999) and d_qoy IN (1, 2, 3)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query42.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query42.out index a150f3bf0bfbe2..db30fd50e7466c 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query42.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query42.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query43.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query43.out index f92452269bcd32..3e470a62065850 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query43.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query43.out @@ -10,9 +10,12 @@ PhysicalResultSink --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ----------------------PhysicalProject ------------------------filter((date_dim.d_year = 2000)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query52.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query52.out index 229d035db52d7d..be5a368feafb41 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query52.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query52.out @@ -11,9 +11,12 @@ PhysicalResultSink ----------------PhysicalProject ------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ------------------------PhysicalProject --------------------------filter((item.i_manager_id = 1)) ----------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query59.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query59.out index 3f740535c8bb6a..3f87d620090469 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query59.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query59.out @@ -6,9 +6,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] ---------------PhysicalProject -----------------PhysicalOlapScan[store_sales] apply RFs: RF0 +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] --PhysicalResultSink diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query14.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query14.out index a69d5958d677f2..f64ea0c891c64c 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query14.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query14.out @@ -82,18 +82,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF11 ss_item_sk->[ss_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[ss_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[i_item_sk,ss_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF12 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -104,18 +108,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[cs_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[cs_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk,i_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[cs_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF15 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -126,18 +134,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF18 i_item_sk->[ss_item_sk,ws_item_sk] ---------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 ss_item_sk->[ws_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] 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 RF18 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF18 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ss_item_sk->[i_item_sk,ws_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[ws_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 RF18 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF18 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out index 2522a1a9f3f342..41ad24ad066406 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query2.out @@ -10,18 +10,16 @@ PhysicalCteAnchor ( cteId=CTEId#1 ) --------------PhysicalProject ----------------PhysicalOlapScan[date_dim] apply RFs: RF0 --------------PhysicalUnion -----------------PhysicalProject -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute[DistributionSpecHash] -----------------------hashAgg[LOCAL] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[web_sales] -----------------PhysicalProject -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute[DistributionSpecHash] -----------------------hashAgg[LOCAL] -------------------------PhysicalProject ---------------------------PhysicalOlapScan[catalog_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] --PhysicalResultSink ----PhysicalQuickSort[MERGE_SORT] ------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out index c38ee45f762950..f514575b3964ce 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query23.out @@ -53,29 +53,29 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --------------hashAgg[LOCAL] ----------------PhysicalUnion ------------------PhysicalProject ---------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF5 item_sk->[cs_item_sk] +--------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF5 cs_item_sk->[item_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 ----------------------PhysicalProject ------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] ------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4 RF5 +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4 ------------------------------PhysicalProject --------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) ----------------------------------PhysicalOlapScan[date_dim] --------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) -----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) ------------------PhysicalProject ---------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF8 item_sk->[ws_item_sk] +--------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF8 ws_item_sk->[item_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 ----------------------PhysicalProject ------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ws_bill_customer_sk] --------------------------PhysicalProject ----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk] ------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 RF8 +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 ------------------------------PhysicalProject --------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) ----------------------------------PhysicalOlapScan[date_dim] --------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) -----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) diff --git a/regression-test/data/shape_check/tpcds_sf1000/shape/query43.out b/regression-test/data/shape_check/tpcds_sf1000/shape/query43.out index 37ab89010ef0a9..38ee41c557e4dd 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/shape/query43.out +++ b/regression-test/data/shape_check/tpcds_sf1000/shape/query43.out @@ -10,9 +10,12 @@ PhysicalResultSink --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] -----------------------PhysicalProject -------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 ----------------------PhysicalProject ------------------------filter((date_dim.d_year = 2000)) --------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query1.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query1.out new file mode 100644 index 00000000000000..469e6bf7aa10ff --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query1.out @@ -0,0 +1,37 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_1 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[store_returns] apply RFs: RF0 +----------------PhysicalProject +------------------filter((date_dim.d_year = 2000)) +--------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 ctr_customer_sk->[c_customer_sk] +--------------PhysicalProject +----------------PhysicalOlapScan[customer] apply RFs: RF3 +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk)) otherCondition=((cast(ctr_total_return as DECIMALV3(38, 5)) > (avg(ctr_total_return) * 1.2))) build RFs:RF2 ctr_store_sk->[ctr_store_sk,s_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ctr_store_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2 +----------------------PhysicalProject +------------------------filter((store.s_state = 'TN')) +--------------------------PhysicalOlapScan[store] apply RFs: RF2 +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query10.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query10.out new file mode 100644 index 00000000000000..d740d8a47904bc --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query10.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_10 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter(OR[ifnull($c$1, FALSE),ifnull($c$2, FALSE)]) +--------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2001)) +--------------------------------PhysicalOlapScan[date_dim] +------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2001)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF1 c_current_cdemo_sk->[cd_demo_sk] +------------------------------PhysicalOlapScan[customer_demographics] apply RFs: RF1 +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer(c)] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter(ca_county IN ('Campbell County', 'Cleburne County', 'Escambia County', 'Fairfield County', 'Washtenaw County')) +--------------------------------------PhysicalOlapScan[customer_address(ca)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query11.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query11.out new file mode 100644 index 00000000000000..455d0c83c64d55 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query11.out @@ -0,0 +1,63 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_11 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1998, 1999)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ws_bill_customer_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1998, 1999)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), 0.000000) > if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), 0.000000))) build RFs:RF6 customer_id->[customer_id,customer_id,customer_id] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF5 customer_id->[customer_id,customer_id] +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF4 customer_id->[customer_id] +--------------------PhysicalProject +----------------------filter((t_s_secyear.dyear = 1999) and (t_s_secyear.sale_type = 's')) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 RF6 +--------------------PhysicalProject +----------------------filter((t_s_firstyear.dyear = 1998) and (t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.00)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 +------------------PhysicalProject +--------------------filter((t_w_firstyear.dyear = 1998) and (t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year_total > 0.00)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 +--------------PhysicalProject +----------------filter((t_w_secyear.dyear = 1999) and (t_w_secyear.sale_type = 'w')) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query12.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query12.out new file mode 100644 index 00000000000000..f46e97e8a5b3c6 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query12.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_12 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ws_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '2001-07-15') and (date_dim.d_date >= '2001-06-15')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter(i_category IN ('Books', 'Electronics', 'Men')) +------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query13.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query13.out new file mode 100644 index 00000000000000..027cb5f01acff1 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query13.out @@ -0,0 +1,34 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_13 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=(OR[AND[ca_state IN ('IL', 'TN', 'TX'),(store_sales.ss_net_profit >= 100.00),(store_sales.ss_net_profit <= 200.00)],AND[ca_state IN ('ID', 'OH', 'WY'),(store_sales.ss_net_profit >= 150.00)],AND[ca_state IN ('IA', 'MS', 'SC'),(store_sales.ss_net_profit <= 250.00)]]) build RFs:RF3 ss_addr_sk->[ca_address_sk] +----------------PhysicalProject +------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('IA', 'ID', 'IL', 'MS', 'OH', 'SC', 'TN', 'TX', 'WY')) +--------------------PhysicalOlapScan[customer_address] apply RFs: RF3 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=(OR[AND[(household_demographics.hd_dep_count = 1),OR[AND[(customer_demographics.cd_marital_status = 'D'),(customer_demographics.cd_education_status = 'Primary'),(store_sales.ss_sales_price <= 100.00)],AND[(customer_demographics.cd_marital_status = 'W'),(customer_demographics.cd_education_status = '2 yr Degree'),(store_sales.ss_sales_price >= 150.00)]]],AND[(customer_demographics.cd_marital_status = 'M'),(customer_demographics.cd_education_status = 'College'),(store_sales.ss_sales_price >= 100.00),(store_sales.ss_sales_price <= 150.00),(household_demographics.hd_dep_count = 3)]]) build RFs:RF1 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = store_sales.ss_cdemo_sk)) otherCondition=() build RFs:RF0 cd_demo_sk->[ss_cdemo_sk] +----------------------------PhysicalProject +------------------------------filter((store_sales.ss_net_profit <= 300.00) and (store_sales.ss_net_profit >= 50.00) and (store_sales.ss_sales_price <= 200.00) and (store_sales.ss_sales_price >= 50.00)) +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF4 +----------------------------PhysicalProject +------------------------------filter(OR[AND[(customer_demographics.cd_marital_status = 'D'),(customer_demographics.cd_education_status = 'Primary')],AND[(customer_demographics.cd_marital_status = 'W'),(customer_demographics.cd_education_status = '2 yr Degree')],AND[(customer_demographics.cd_marital_status = 'M'),(customer_demographics.cd_education_status = 'College')]] and cd_education_status IN ('2 yr Degree', 'College', 'Primary') and cd_marital_status IN ('D', 'M', 'W')) +--------------------------------PhysicalOlapScan[customer_demographics] +------------------------PhysicalProject +--------------------------filter(hd_dep_count IN (1, 3)) +----------------------------PhysicalOlapScan[household_demographics] +--------------------PhysicalProject +----------------------filter((date_dim.d_year = 2001)) +------------------------PhysicalOlapScan[date_dim] +------------PhysicalProject +--------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query14.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query14.out new file mode 100644 index 00000000000000..f64ea0c891c64c --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query14.out @@ -0,0 +1,170 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_14 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_brand_id = t.brand_id) and (item.i_category_id = t.category_id) and (item.i_class_id = t.class_id)) otherCondition=() build RFs:RF6 brand_id->[i_brand_id];RF7 class_id->[i_class_id];RF8 category_id->[i_category_id] +--------PhysicalProject +----------PhysicalOlapScan[item] apply RFs: RF6 RF7 RF8 +--------PhysicalIntersect RFV2: RF19[brand_id->i_brand_id] RF20[brand_id->i_brand_id] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = iss.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((d1.d_year <= 2001) and (d1.d_year >= 1999)) +----------------------------PhysicalOlapScan[date_dim(d1)] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item(iss)] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[cs_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +------------------------PhysicalProject +--------------------------filter((d2.d_year <= 2001) and (d2.d_year >= 1999)) +----------------------------PhysicalOlapScan[date_dim(d2)] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item(ics)] RFV2: RF19 +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[ws_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +------------------------PhysicalProject +--------------------------filter((d3.d_year <= 2001) and (d3.d_year >= 1999)) +----------------------------PhysicalOlapScan[date_dim(d3)] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item(iws)] RFV2: RF20 +--PhysicalCteAnchor ( cteId=CTEId#1 ) +----PhysicalCteProducer ( cteId=CTEId#1 ) +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[cs_sold_date_sk,ss_sold_date_sk,ws_sold_date_sk] +----------------PhysicalUnion +------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] apply RFs: RF9 +------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------PhysicalProject +----------------------PhysicalOlapScan[catalog_sales] apply RFs: RF9 +------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_sales] apply RFs: RF9 +----------------PhysicalProject +------------------filter((date_dim.d_year <= 2001) and (date_dim.d_year >= 1999)) +--------------------PhysicalOlapScan[date_dim] +----PhysicalCteAnchor ( cteId=CTEId#4 ) +------PhysicalCteProducer ( cteId=CTEId#4 ) +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------NestedLoopJoin[INNER_JOIN](cast(sales as DECIMALV3(38, 4)) > avg_sales.average_sales) +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[i_item_sk,ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF12 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------------PhysicalAssertNumRows +----------------------PhysicalDistribute[DistributionSpecGather] +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) +----------------PhysicalProject +------------------NestedLoopJoin[INNER_JOIN](cast(sales as DECIMALV3(38, 4)) > avg_sales.average_sales) +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk,i_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[cs_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF15 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------------PhysicalAssertNumRows +----------------------PhysicalDistribute[DistributionSpecGather] +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) +----------------PhysicalProject +------------------NestedLoopJoin[INNER_JOIN](cast(sales as DECIMALV3(38, 4)) > avg_sales.average_sales) +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ss_item_sk->[i_item_sk,ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[ws_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 RF18 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF18 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------------PhysicalAssertNumRows +----------------------PhysicalDistribute[DistributionSpecGather] +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) +------PhysicalResultSink +--------PhysicalTopN[MERGE_SORT] +----------PhysicalDistribute[DistributionSpecGather] +------------PhysicalTopN[LOCAL_SORT] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalRepeat +--------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------PhysicalCteConsumer ( cteId=CTEId#4 ) +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalCteConsumer ( cteId=CTEId#4 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query15.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query15.out new file mode 100644 index 00000000000000..06c1b08293ef85 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query15.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_15 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=(OR[substring(ca_zip, 1, 5) IN ('80348', '81792', '83405', '85392', '85460', '85669', '86197', '86475', '88274'),ca_state IN ('CA', 'GA', 'WA'),(catalog_sales.cs_sales_price > 500.00)]) build RFs:RF2 c_customer_sk->[cs_bill_customer_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF1 RF2 +----------------------PhysicalProject +------------------------filter((date_dim.d_qoy = 2) and (date_dim.d_year = 2001)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] apply RFs: RF0 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query16.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query16.out new file mode 100644 index 00000000000000..30da2ea81f8a2a --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query16.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_16 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[DISTINCT_GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[DISTINCT_LOCAL] +------------hashAgg[GLOBAL] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((cs1.cs_order_number = cs2.cs_order_number)) otherCondition=(( not (cs_warehouse_sk = cs_warehouse_sk))) build RFs:RF4 cs_order_number->[cs_order_number] +--------------------PhysicalProject +----------------------PhysicalOlapScan[catalog_sales(cs2)] apply RFs: RF4 +--------------------hashJoin[RIGHT_ANTI_JOIN shuffle] hashCondition=((cs1.cs_order_number = cr1.cr_order_number)) otherCondition=() build RFs:RF3 cs_order_number->[cr_order_number] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_returns(cr1)] apply RFs: RF3 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF2 cc_call_center_sk->[cs_call_center_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_ship_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[cs_ship_addr_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[catalog_sales(cs1)] apply RFs: RF0 RF1 RF2 +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_state = 'PA')) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '2002-05-31') and (date_dim.d_date >= '2002-04-01')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((call_center.cc_county = 'Williamson County')) +------------------------------PhysicalOlapScan[call_center] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query17.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query17.out new file mode 100644 index 00000000000000..82a1cff667d402 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query17.out @@ -0,0 +1,44 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_17 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF8 sr_customer_sk->[cs_bill_customer_sk];RF9 sr_item_sk->[cs_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF7 RF8 RF9 +------------------------PhysicalProject +--------------------------filter(d_quarter_name IN ('2001Q1', '2001Q2', '2001Q3')) +----------------------------PhysicalOlapScan[date_dim(d3)] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[sr_item_sk,ss_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF2 sr_customer_sk->[ss_customer_sk];RF3 sr_item_sk->[ss_item_sk];RF4 sr_ticket_number->[ss_ticket_number] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 RF5 RF6 +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_quarter_name = '2001Q1')) +----------------------------------------PhysicalOlapScan[date_dim(d1)] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF6 +------------------------------------PhysicalProject +--------------------------------------filter(d_quarter_name IN ('2001Q1', '2001Q2', '2001Q3')) +----------------------------------------PhysicalOlapScan[date_dim(d2)] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query18.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query18.out new file mode 100644 index 00000000000000..0701882afd123e --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query18.out @@ -0,0 +1,42 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_18 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[cs_item_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF2 cd_demo_sk->[cs_bill_cdemo_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 RF4 RF5 +----------------------------------PhysicalProject +------------------------------------filter((cd1.cd_education_status = 'Primary') and (cd1.cd_gender = 'F')) +--------------------------------------PhysicalOlapScan[customer_demographics(cd1)] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=() build RFs:RF1 c_current_cdemo_sk->[cd_demo_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer_demographics(cd2)] apply RFs: RF1 +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +--------------------------------------PhysicalProject +----------------------------------------filter(c_birth_month IN (1, 10, 11, 3, 4, 7)) +------------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +--------------------------------------PhysicalProject +----------------------------------------filter(ca_state IN ('AL', 'CA', 'GA', 'IN', 'MO', 'MT', 'TN')) +------------------------------------------PhysicalOlapScan[customer_address] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query19.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query19.out new file mode 100644 index 00000000000000..addae12e92893c --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query19.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_19 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=(( not (substring(ca_zip, 1, 5) = substring(s_zip, 1, 5)))) build RFs:RF4 c_current_addr_sk->[ca_address_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[customer_address] apply RFs: RF4 +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 ss_customer_sk->[c_customer_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer] apply RFs: RF3 +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------filter((item.i_manager_id = 14)) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query2.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query2.out new file mode 100644 index 00000000000000..41ad24ad066406 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query2.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_2 -- +PhysicalCteAnchor ( cteId=CTEId#1 ) +--PhysicalCteProducer ( cteId=CTEId#1 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 sold_date_sk->[d_date_sk] +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] apply RFs: RF0 +--------------PhysicalUnion +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(cast(d_week_seq2 as BIGINT) - 53))) otherCondition=() build RFs:RF3 expr_(cast(d_week_seq2 as BIGINT) - 53)->[cast(d_week_seq as BIGINT)] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq] +------------------PhysicalProject +--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2 RF3 +------------------PhysicalProject +--------------------filter((date_dim.d_year = 1998)) +----------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((date_dim.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq] +------------------PhysicalProject +--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1 +------------------PhysicalProject +--------------------filter((date_dim.d_year = 1999)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query20.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query20.out new file mode 100644 index 00000000000000..8728415de8b335 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query20.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_20 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[cs_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '2002-07-18') and (date_dim.d_date >= '2002-06-18')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter(i_category IN ('Books', 'Music', 'Sports')) +------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query21.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query21.out new file mode 100644 index 00000000000000..ea9e85c3155cdd --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query21.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_21 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter(((cast(inv_after as DOUBLE) / cast(inv_before as DOUBLE)) <= 1.5) and (if((inv_before > 0), (cast(inv_after as DOUBLE) / cast(inv_before as DOUBLE)), NULL) >= cast((2.000000 / 3.0) as DOUBLE)) and (x.inv_before > 0)) +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF2 w_warehouse_sk->[inv_warehouse_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((item.i_item_sk = inventory.inv_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +----------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 RF2 +----------------------------PhysicalProject +------------------------------filter((item.i_current_price <= 1.49) and (item.i_current_price >= 0.99)) +--------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter((date_dim.d_date <= '1999-07-22') and (date_dim.d_date >= '1999-05-23')) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalOlapScan[warehouse] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query22.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query22.out new file mode 100644 index 00000000000000..93c02aab1654c3 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query22.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_22 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[inv_item_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[inv_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1211) and (date_dim.d_month_seq >= 1200)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query23.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query23.out new file mode 100644 index 00000000000000..425b24b9863ee5 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query23.out @@ -0,0 +1,89 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_23 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------filter((cnt > 4)) +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------filter(d_year IN (2000, 2001, 2002, 2003)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] +--PhysicalCteAnchor ( cteId=CTEId#2 ) +----PhysicalCteProducer ( cteId=CTEId#2 ) +------PhysicalProject +--------NestedLoopJoin[INNER_JOIN](cast(ssales as DECIMALV3(38, 6)) > (0.9500 * tpcds_cmax)) +----------PhysicalProject +------------hashAgg[GLOBAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ss_customer_sk] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 +------------------PhysicalProject +--------------------PhysicalOlapScan[customer] +----------PhysicalProject +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ss_customer_sk] +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer] +--------------------------PhysicalProject +----------------------------filter(d_year IN (2000, 2001, 2002, 2003)) +------------------------------PhysicalOlapScan[date_dim] +----PhysicalResultSink +------PhysicalLimit[GLOBAL] +--------PhysicalLimit[LOCAL] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalUnion +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF7 cs_item_sk->[item_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF7 +----------------------PhysicalProject +------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[cs_bill_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF10 ws_item_sk->[item_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF10 +----------------------PhysicalProject +------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF9 c_customer_sk->[ws_bill_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query24.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query24.out new file mode 100644 index 00000000000000..ec4d93d573f2a3 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query24.out @@ -0,0 +1,52 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_24 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF5 sr_ticket_number->[ss_ticket_number];RF6 sr_item_sk->[i_item_sk,ss_item_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_zip = customer_address.ca_zip) and (store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 ca_zip->[s_zip];RF3 c_customer_sk->[ss_customer_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF3 RF4 RF5 RF6 +----------------------------PhysicalProject +------------------------------filter((store.s_market_id = 5)) +--------------------------------PhysicalOlapScan[store] apply RFs: RF2 +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=(( not (c_birth_country = upper(ca_country)))) build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_address] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item] apply RFs: RF6 +----------------PhysicalProject +------------------PhysicalOlapScan[store_returns] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------NestedLoopJoin[INNER_JOIN](cast(paid as DECIMALV3(38, 6)) > 0.05*avg(netpaid)) +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------PhysicalProject +--------------------------filter((ssales.i_color = 'aquamarine')) +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query25.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query25.out new file mode 100644 index 00000000000000..ee55420cf0125d --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query25.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_25 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF8 sr_customer_sk->[cs_bill_customer_sk];RF9 sr_item_sk->[cs_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF7 RF8 RF9 +----------------------PhysicalProject +------------------------filter((d3.d_moy <= 10) and (d3.d_moy >= 4) and (d3.d_year = 1999)) +--------------------------PhysicalOlapScan[date_dim(d3)] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[sr_item_sk,ss_item_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF2 sr_customer_sk->[ss_customer_sk];RF3 sr_item_sk->[ss_item_sk];RF4 sr_ticket_number->[ss_ticket_number] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 RF5 RF6 +----------------------------------PhysicalProject +------------------------------------filter((d1.d_moy = 4) and (d1.d_year = 1999)) +--------------------------------------PhysicalOlapScan[date_dim(d1)] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF6 +----------------------------------PhysicalProject +------------------------------------filter((d2.d_moy <= 10) and (d2.d_moy >= 4) and (d2.d_year = 1999)) +--------------------------------------PhysicalOlapScan[date_dim(d2)] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store] +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query26.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query26.out new file mode 100644 index 00000000000000..383242890f9dd4 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query26.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_26 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[cs_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF2 p_promo_sk->[cs_promo_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF0 cd_demo_sk->[cs_bill_cdemo_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((customer_demographics.cd_education_status = 'Unknown') and (customer_demographics.cd_gender = 'M') and (customer_demographics.cd_marital_status = 'W')) +----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 2002)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter(OR[(promotion.p_channel_email = 'N'),(promotion.p_channel_event = 'N')]) +--------------------------PhysicalOlapScan[promotion] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query27.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query27.out new file mode 100644 index 00000000000000..47ceeb712c2a8c --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query27.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_27 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF0 cd_demo_sk->[ss_cdemo_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +----------------------------------PhysicalProject +------------------------------------filter((customer_demographics.cd_education_status = 'Secondary') and (customer_demographics.cd_gender = 'M') and (customer_demographics.cd_marital_status = 'W')) +--------------------------------------PhysicalOlapScan[customer_demographics] +------------------------------PhysicalProject +--------------------------------filter((store.s_state = 'TN')) +----------------------------------PhysicalOlapScan[store] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 1999)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query28.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query28.out new file mode 100644 index 00000000000000..c1d2341a2a776b --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query28.out @@ -0,0 +1,75 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_28 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------NestedLoopJoin[CROSS_JOIN] +--------PhysicalLimit[LOCAL] +----------NestedLoopJoin[CROSS_JOIN] +------------PhysicalLimit[LOCAL] +--------------NestedLoopJoin[CROSS_JOIN] +----------------PhysicalLimit[LOCAL] +------------------NestedLoopJoin[CROSS_JOIN] +--------------------PhysicalLimit[LOCAL] +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------PhysicalLimit[LOCAL] +--------------------------hashAgg[DISTINCT_GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[DISTINCT_LOCAL] +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------filter((store_sales.ss_quantity <= 5) and (store_sales.ss_quantity >= 0) and OR[AND[(store_sales.ss_list_price >= 107.00),(store_sales.ss_list_price <= 117.00)],AND[(store_sales.ss_coupon_amt >= 1319.00),(store_sales.ss_coupon_amt <= 2319.00)],AND[(store_sales.ss_wholesale_cost >= 60.00),(store_sales.ss_wholesale_cost <= 80.00)]]) +------------------------------------------PhysicalOlapScan[store_sales] +------------------------PhysicalLimit[LOCAL] +--------------------------hashAgg[DISTINCT_GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[DISTINCT_LOCAL] +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------filter((store_sales.ss_quantity <= 10) and (store_sales.ss_quantity >= 6) and OR[AND[(store_sales.ss_list_price >= 23.00),(store_sales.ss_list_price <= 33.00)],AND[(store_sales.ss_coupon_amt >= 825.00),(store_sales.ss_coupon_amt <= 1825.00)],AND[(store_sales.ss_wholesale_cost >= 43.00),(store_sales.ss_wholesale_cost <= 63.00)]]) +------------------------------------------PhysicalOlapScan[store_sales] +--------------------PhysicalLimit[LOCAL] +----------------------hashAgg[DISTINCT_GLOBAL] +------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------hashAgg[DISTINCT_LOCAL] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------filter((store_sales.ss_quantity <= 15) and (store_sales.ss_quantity >= 11) and OR[AND[(store_sales.ss_list_price >= 74.00),(store_sales.ss_list_price <= 84.00)],AND[(store_sales.ss_coupon_amt >= 4381.00),(store_sales.ss_coupon_amt <= 5381.00)],AND[(store_sales.ss_wholesale_cost >= 57.00),(store_sales.ss_wholesale_cost <= 77.00)]]) +--------------------------------------PhysicalOlapScan[store_sales] +----------------PhysicalLimit[LOCAL] +------------------hashAgg[DISTINCT_GLOBAL] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------hashAgg[DISTINCT_LOCAL] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 16) and OR[AND[(store_sales.ss_list_price >= 89.00),(store_sales.ss_list_price <= 99.00)],AND[(store_sales.ss_coupon_amt >= 3117.00),(store_sales.ss_coupon_amt <= 4117.00)],AND[(store_sales.ss_wholesale_cost >= 68.00),(store_sales.ss_wholesale_cost <= 88.00)]]) +----------------------------------PhysicalOlapScan[store_sales] +------------PhysicalLimit[LOCAL] +--------------hashAgg[DISTINCT_GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[DISTINCT_LOCAL] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------filter((store_sales.ss_quantity <= 25) and (store_sales.ss_quantity >= 21) and OR[AND[(store_sales.ss_list_price >= 58.00),(store_sales.ss_list_price <= 68.00)],AND[(store_sales.ss_coupon_amt >= 9402.00),(store_sales.ss_coupon_amt <= 10402.00)],AND[(store_sales.ss_wholesale_cost >= 38.00),(store_sales.ss_wholesale_cost <= 58.00)]]) +------------------------------PhysicalOlapScan[store_sales] +--------PhysicalLimit[LOCAL] +----------hashAgg[DISTINCT_GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[DISTINCT_LOCAL] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((store_sales.ss_quantity <= 30) and (store_sales.ss_quantity >= 26) and OR[AND[(store_sales.ss_list_price >= 64.00),(store_sales.ss_list_price <= 74.00)],AND[(store_sales.ss_coupon_amt >= 5792.00),(store_sales.ss_coupon_amt <= 6792.00)],AND[(store_sales.ss_wholesale_cost >= 73.00),(store_sales.ss_wholesale_cost <= 93.00)]]) +--------------------------PhysicalOlapScan[store_sales] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query29.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query29.out new file mode 100644 index 00000000000000..7505cb3ea50028 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query29.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_29 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF7 sr_customer_sk->[cs_bill_customer_sk];RF8 sr_item_sk->[cs_item_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF7 RF8 RF9 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[sr_item_sk,ss_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF2 sr_customer_sk->[ss_customer_sk];RF3 sr_item_sk->[ss_item_sk];RF4 sr_ticket_number->[ss_ticket_number] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 RF5 RF6 +--------------------------------------PhysicalProject +----------------------------------------filter((d1.d_moy = 4) and (d1.d_year = 1998)) +------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF6 +--------------------------------------PhysicalProject +----------------------------------------filter((d2.d_moy <= 7) and (d2.d_moy >= 4) and (d2.d_year = 1998)) +------------------------------------------PhysicalOlapScan[date_dim(d2)] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +------------------PhysicalProject +--------------------filter(d_year IN (1998, 1999, 2000)) +----------------------PhysicalOlapScan[date_dim(d3)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query3.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query3.out new file mode 100644 index 00000000000000..fae84ff1a42849 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query3.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_3 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((dt.d_moy = 11)) +----------------------------PhysicalOlapScan[date_dim(dt)] +--------------------PhysicalProject +----------------------filter((item.i_manufact_id = 816)) +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query30.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query30.out new file mode 100644 index 00000000000000..811d6cd3bf4466 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query30.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_30 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_returning_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[wr_returning_addr_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[wr_returned_date_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_returns] apply RFs: RF0 RF1 +--------------------PhysicalProject +----------------------filter((date_dim.d_year = 2000)) +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------PhysicalOlapScan[customer_address] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((ctr1.ctr_state = ctr2.ctr_state)) otherCondition=((cast(ctr_total_return as DECIMALV3(38, 5)) > (avg(ctr_total_return) * 1.2))) build RFs:RF4 ctr_state->[ctr_state] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[c_current_addr_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 ctr_customer_sk->[c_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] apply RFs: RF2 RF3 +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 +------------------PhysicalProject +--------------------filter((customer_address.ca_state = 'AR')) +----------------------PhysicalOlapScan[customer_address] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query31.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query31.out new file mode 100644 index 00000000000000..ddd91f4702c00c --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query31.out @@ -0,0 +1,73 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_31 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------PhysicalProject +----------------------filter((ss.d_year = 1999) and d_qoy IN (1, 2, 3)) +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------PhysicalOlapScan[customer_address] +--PhysicalCteAnchor ( cteId=CTEId#1 ) +----PhysicalCteProducer ( cteId=CTEId#1 ) +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_bill_addr_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------filter((ws.d_year = 1999) and d_qoy IN (1, 2, 3)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[customer_address] +----PhysicalResultSink +------PhysicalQuickSort[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalQuickSort[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ws1.ca_county = ws3.ca_county)) otherCondition=((if((web_sales > 0.00), (cast(web_sales as DECIMALV3(38, 8)) / web_sales), NULL) > if((store_sales > 0.00), (cast(store_sales as DECIMALV3(38, 8)) / store_sales), NULL))) build RFs:RF8 ca_county->[ca_county] +----------------PhysicalProject +------------------filter((ws3.d_qoy = 3) and (ws3.d_year = 1999)) +--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF8 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ws1.ca_county = ws2.ca_county)) otherCondition=((if((web_sales > 0.00), (cast(web_sales as DECIMALV3(38, 8)) / web_sales), NULL) > if((store_sales > 0.00), (cast(store_sales as DECIMALV3(38, 8)) / store_sales), NULL))) build RFs:RF7 ca_county->[ca_county] +--------------------PhysicalProject +----------------------filter((ws2.d_qoy = 2) and (ws2.d_year = 1999)) +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF7 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss1.ca_county = ws1.ca_county)) otherCondition=() build RFs:RF6 ca_county->[ca_county,ca_county] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss2.ca_county = ss3.ca_county)) otherCondition=() build RFs:RF5 ca_county->[ca_county,ca_county] +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss1.ca_county = ss2.ca_county)) otherCondition=() build RFs:RF4 ca_county->[ca_county] +----------------------------PhysicalProject +------------------------------filter((ss1.d_qoy = 1) and (ss1.d_year = 1999)) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 RF6 +----------------------------PhysicalProject +------------------------------filter((ss2.d_qoy = 2) and (ss2.d_year = 1999)) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 +--------------------------PhysicalProject +----------------------------filter((ss3.d_qoy = 3) and (ss3.d_year = 1999)) +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalProject +------------------------filter((ws1.d_qoy = 1) and (ws1.d_year = 1999)) +--------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query32.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query32.out new file mode 100644 index 00000000000000..cb7cc0e46364ed --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query32.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_32 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------filter((cast(cs_ext_discount_amt as DECIMALV3(38, 5)) > (1.3 * avg(cs_ext_discount_amt) OVER(PARTITION BY i_item_sk)))) +----------------PhysicalWindow +------------------PhysicalQuickSort[LOCAL_SORT] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter((item.i_manufact_id = 722)) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '2001-06-07') and (date_dim.d_date >= '2001-03-09')) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query33.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query33.out new file mode 100644 index 00000000000000..f1cd1e4c777310 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query33.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_33 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF3 i_manufact_id->[i_manufact_id] +--------------------PhysicalProject +----------------------filter((item.i_category = 'Books')) +------------------------PhysicalOlapScan[item] apply RFs: RF3 +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF7 i_manufact_id->[i_manufact_id] +--------------------PhysicalProject +----------------------filter((item.i_category = 'Books')) +------------------------PhysicalOlapScan[item] apply RFs: RF7 +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[cs_bill_addr_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF11 i_manufact_id->[i_manufact_id] +--------------------PhysicalProject +----------------------filter((item.i_category = 'Books')) +------------------------PhysicalOlapScan[item] apply RFs: RF11 +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF9 ca_address_sk->[ws_bill_addr_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 RF10 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query34.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query34.out new file mode 100644 index 00000000000000..b9f187a3aaabee --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query34.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_34 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 ss_customer_sk->[c_customer_sk] +------------PhysicalProject +--------------PhysicalOlapScan[customer] apply RFs: RF3 +------------filter((dn.cnt <= 20) and (dn.cnt >= 15)) +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------PhysicalProject +----------------------------------filter((store.s_county = 'Williamson County')) +------------------------------------PhysicalOlapScan[store] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_dom <= 28) and (date_dim.d_dom >= 1) and OR[(date_dim.d_dom <= 3),(date_dim.d_dom >= 25)] and d_year IN (2000, 2001, 2002)) +--------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------filter(((cast(hd_dep_count as DOUBLE) / cast(hd_vehicle_count as DOUBLE)) > 1.2) and (household_demographics.hd_vehicle_count > 0) and hd_buy_potential IN ('0-500', '1001-5000')) +----------------------------PhysicalOlapScan[household_demographics] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query35.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query35.out new file mode 100644 index 00000000000000..35be2410a0e78f --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query35.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_35 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter(OR[ifnull($c$1, FALSE),ifnull($c$2, FALSE)]) +--------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 1999)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[c_current_cdemo_sk] +--------------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 1999)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ss_customer_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 +----------------------------------PhysicalProject +------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 1999)) +--------------------------------------PhysicalOlapScan[date_dim] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer(c)] apply RFs: RF0 RF4 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer_address(ca)] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer_demographics] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query36.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query36.out new file mode 100644 index 00000000000000..f75ea80df28def --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query36.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_36 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------filter((store.s_state = 'TN')) +--------------------------------------------PhysicalOlapScan[store] +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim(d1)] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query37.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query37.out new file mode 100644 index 00000000000000..99e27bee90be73 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query37.out @@ -0,0 +1,27 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_37 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = inventory.inv_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalProject +----------------------------filter((inventory.inv_quantity_on_hand <= 500) and (inventory.inv_quantity_on_hand >= 100)) +------------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((item.i_current_price <= 59.00) and (item.i_current_price >= 29.00) and i_manufact_id IN (705, 742, 777, 944)) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_date <= '2002-05-28') and (date_dim.d_date >= '2002-03-29')) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query38.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query38.out new file mode 100644 index 00000000000000..fc988652648dc2 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query38.out @@ -0,0 +1,53 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_38 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------PhysicalIntersect +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ws_bill_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1200) and (date_dim.d_month_seq >= 1189)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1200) and (date_dim.d_month_seq >= 1189)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1200) and (date_dim.d_month_seq >= 1189)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query39.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query39.out new file mode 100644 index 00000000000000..936364b59ddc11 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query39.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_39 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------filter(( not (mean = 0.0)) and ((foo.stdev / foo.mean) > 1.0)) +--------hashAgg[GLOBAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[inv_item_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF1 w_warehouse_sk->[inv_warehouse_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[inv_date_sk] +----------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 RF2 +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 2000) and d_moy IN (1, 2)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[warehouse] +--------------PhysicalProject +----------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------hashJoin[INNER_JOIN shuffle] hashCondition=((inv1.i_item_sk = inv2.i_item_sk) and (inv1.w_warehouse_sk = inv2.w_warehouse_sk)) otherCondition=() build RFs:RF3 i_item_sk->[i_item_sk];RF4 w_warehouse_sk->[w_warehouse_sk] +------------filter((inv1.d_moy = 1)) +--------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 +------------filter((inv2.d_moy = 2)) +--------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query4.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query4.out new file mode 100644 index 00000000000000..ba49181568defe --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query4.out @@ -0,0 +1,91 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_4 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = catalog_sales.cs_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ws_bill_customer_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL) > if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL))) build RFs:RF10 customer_id->[customer_id,customer_id,customer_id,customer_id,customer_id] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF9 customer_id->[customer_id,customer_id,customer_id,customer_id] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) otherCondition=((if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL) > if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL))) build RFs:RF8 customer_id->[customer_id,customer_id,customer_id] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_c_firstyear.customer_id)) otherCondition=() build RFs:RF7 customer_id->[customer_id,customer_id] +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF6 customer_id->[customer_id] +----------------------------PhysicalProject +------------------------------filter((t_s_secyear.dyear = 2000) and (t_s_secyear.sale_type = 's')) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 RF7 RF8 RF9 RF10 +----------------------------PhysicalProject +------------------------------filter((t_s_firstyear.dyear = 1999) and (t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000)) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF7 RF8 RF9 RF10 +--------------------------PhysicalProject +----------------------------filter((t_c_firstyear.dyear = 1999) and (t_c_firstyear.sale_type = 'c') and (t_c_firstyear.year_total > 0.000000)) +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 RF9 RF10 +----------------------PhysicalProject +------------------------filter((t_c_secyear.dyear = 2000) and (t_c_secyear.sale_type = 'c')) +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF9 RF10 +------------------PhysicalProject +--------------------filter((t_w_firstyear.dyear = 1999) and (t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year_total > 0.000000)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF10 +--------------PhysicalProject +----------------filter((t_w_secyear.dyear = 2000) and (t_w_secyear.sale_type = 'w')) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query40.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query40.out new file mode 100644 index 00000000000000..9ecf8a19e0cae1 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query40.out @@ -0,0 +1,30 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_40 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF3 cs_order_number->[cr_order_number];RF4 cs_item_sk->[cr_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_returns] apply RFs: RF3 RF4 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF2 w_warehouse_sk->[cs_warehouse_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +------------------------------PhysicalProject +--------------------------------filter((item.i_current_price <= 1.49) and (item.i_current_price >= 0.99)) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '2001-06-01') and (date_dim.d_date >= '2001-04-02')) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[warehouse] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query41.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query41.out new file mode 100644 index 00000000000000..92045bb79faf37 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query41.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_41 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_manufact = i1.i_manufact)) otherCondition=() build RFs:RF0 i_manufact->[i_manufact] +------------------PhysicalProject +--------------------filter((i1.i_manufact_id <= 744) and (i1.i_manufact_id >= 704)) +----------------------PhysicalOlapScan[item(i1)] apply RFs: RF0 +------------------PhysicalProject +--------------------filter((item_cnt > 0)) +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(OR[AND[(item.i_category = 'Men'),i_size IN ('N/A', 'economy', 'large', 'small'),OR[AND[i_size IN ('economy', 'small'),i_color IN ('firebrick', 'maroon', 'sienna', 'smoke'),i_units IN ('Case', 'Cup', 'Each', 'Ounce'),OR[AND[i_color IN ('maroon', 'smoke'),i_units IN ('Case', 'Ounce')],AND[i_color IN ('firebrick', 'sienna'),i_units IN ('Cup', 'Each')]]],AND[i_size IN ('N/A', 'large'),i_color IN ('papaya', 'peach', 'powder', 'sky'),i_units IN ('Bundle', 'Carton', 'Dozen', 'Lb'),OR[AND[i_color IN ('powder', 'sky'),i_units IN ('Dozen', 'Lb')],AND[i_color IN ('papaya', 'peach'),i_units IN ('Bundle', 'Carton')]]]]],AND[(item.i_category = 'Women'),i_size IN ('economy', 'extra large', 'petite', 'small'),OR[AND[i_size IN ('economy', 'small'),i_color IN ('aquamarine', 'dark', 'forest', 'lime'),i_units IN ('Pallet', 'Pound', 'Tbl', 'Ton'),OR[AND[i_color IN ('forest', 'lime'),i_units IN ('Pallet', 'Pound')],AND[i_color IN ('aquamarine', 'dark'),i_units IN ('Tbl', 'Ton')]]],AND[i_size IN ('extra large', 'petite'),i_color IN ('frosted', 'navy', 'plum', 'slate'),i_units IN ('Box', 'Bunch', 'Dram', 'Gross'),OR[AND[i_color IN ('navy', 'slate'),i_units IN ('Bunch', 'Gross')],AND[i_color IN ('frosted', 'plum'),i_units IN ('Box', 'Dram')]]]]]] and i_category IN ('Men', 'Women')) +--------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query42.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query42.out new file mode 100644 index 00000000000000..68f93698b9a036 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query42.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_42 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((item.i_manager_id = 1)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------filter((dt.d_moy = 11) and (dt.d_year = 1998)) +------------------------PhysicalOlapScan[date_dim(dt)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query43.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query43.out new file mode 100644 index 00000000000000..38ee41c557e4dd --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query43.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_43 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 2000)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter((store.s_gmt_offset = -5.00)) +----------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query44.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query44.out new file mode 100644 index 00000000000000..b733c203a720df --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query44.out @@ -0,0 +1,71 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_44 -- +PhysicalResultSink +--PhysicalProject +----PhysicalLazyMaterialize[materializedSlots:(asceding.rnk) lazySlots:(best_performing,worst_performing)] +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] +--------------------PhysicalProject +----------------------PhysicalLazyMaterializeOlapScan[item lazySlots:(i2.i_product_name)] apply RFs: RF1 +--------------------PhysicalProject +----------------------filter((V21.rnk < 11)) +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[MERGE_SORT] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------PhysicalPartitionTopN +----------------------------------PhysicalProject +------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DECIMALV3(38, 5)) > (0.9 * rank_col)) +--------------------------------------PhysicalProject +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------filter((ss1.ss_store_sk = 4)) +--------------------------------------------------PhysicalOlapScan[store_sales(ss1)] +--------------------------------------PhysicalProject +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------hashAgg[GLOBAL] +------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------hashAgg[LOCAL] +----------------------------------------------------PhysicalProject +------------------------------------------------------filter((store_sales.ss_store_sk = 4) and ss_hdemo_sk IS NULL) +--------------------------------------------------------PhysicalOlapScan[store_sales] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +--------------------PhysicalProject +----------------------PhysicalLazyMaterializeOlapScan[item lazySlots:(i1.i_product_name)] apply RFs: RF0 +--------------------PhysicalProject +----------------------filter((V11.rnk < 11)) +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[MERGE_SORT] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------PhysicalPartitionTopN +----------------------------------PhysicalProject +------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DECIMALV3(38, 5)) > (0.9 * rank_col)) +--------------------------------------PhysicalProject +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------filter((ss1.ss_store_sk = 4)) +--------------------------------------------------PhysicalOlapScan[store_sales(ss1)] +--------------------------------------PhysicalProject +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------hashAgg[GLOBAL] +------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------hashAgg[LOCAL] +----------------------------------------------------PhysicalProject +------------------------------------------------------filter((store_sales.ss_store_sk = 4) and ss_hdemo_sk IS NULL) +--------------------------------------------------------PhysicalOlapScan[store_sales] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query45.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query45.out new file mode 100644 index 00000000000000..dcc2e202e23752 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query45.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_45 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------filter(OR[substring(ca_zip, 1, 5) IN ('80348', '81792', '83405', '85392', '85460', '85669', '86197', '86475', '88274'),$c$1]) +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ws_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ws_bill_customer_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_qoy = 1) and (date_dim.d_year = 2000)) +--------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_address] +--------------------PhysicalProject +----------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter(i_item_sk IN (11, 13, 17, 19, 2, 23, 29, 3, 5, 7)) +----------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query46.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query46.out new file mode 100644 index 00000000000000..b54a98e5dcb88b --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query46.out @@ -0,0 +1,38 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_46 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = current_addr.ca_address_sk)) otherCondition=(( not (ca_city = bought_city))) build RFs:RF5 ca_address_sk->[c_current_addr_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 ss_customer_sk->[c_customer_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ss_addr_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter(s_city IN ('Fairview', 'Midway')) +----------------------------------------PhysicalOlapScan[store] +--------------------------------PhysicalProject +----------------------------------filter(d_dow IN (0, 6) and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(OR[(household_demographics.hd_dep_count = 8),(household_demographics.hd_vehicle_count = 0)]) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_address] +------------PhysicalProject +--------------PhysicalOlapScan[customer_address(current_addr)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query47.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query47.out new file mode 100644 index 00000000000000..096bc2502ec644 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query47.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_47 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------PhysicalWindow +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------PhysicalProject +----------------------------------filter(OR[(date_dim.d_year = 2000),AND[(date_dim.d_year = 1999),(date_dim.d_moy = 12)],AND[(date_dim.d_year = 2001),(date_dim.d_moy = 1)]] and d_year IN (1999, 2000, 2001)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalProject +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((v1.i_brand = v1_lead.i_brand) and (v1.i_category = v1_lead.i_category) and (v1.rn = expr_(rn - 1)) and (v1.s_company_name = v1_lead.s_company_name) and (v1.s_store_name = v1_lead.s_store_name)) otherCondition=() build RFs:RF8 i_category->[i_category,i_category];RF9 i_brand->[i_brand,i_brand];RF10 s_store_name->[s_store_name,s_store_name];RF11 s_company_name->[s_company_name,s_company_name];RF12 expr_(rn - 1)->[(rn + 1),rn] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((v1.i_brand = v1_lag.i_brand) and (v1.i_category = v1_lag.i_category) and (v1.rn = expr_(rn + 1)) and (v1.s_company_name = v1_lag.s_company_name) and (v1.s_store_name = v1_lag.s_store_name)) otherCondition=() build RFs:RF3 i_category->[i_category];RF4 i_brand->[i_brand];RF5 s_store_name->[s_store_name];RF6 s_company_name->[s_company_name];RF7 rn->[(rn + 1)] +--------------------PhysicalProject +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 RF5 RF6 RF7 RF8 RF9 RF10 RF11 RF12 +--------------------filter(((cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / v2.avg_monthly_sales) > 0.100000) and (v2.avg_monthly_sales > 0.0000) and (v2.d_year = 2000)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 RF9 RF10 RF11 RF12 +----------------PhysicalProject +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query48.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query48.out new file mode 100644 index 00000000000000..d11dadeae0b923 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query48.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_48 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=(OR[AND[ca_state IN ('ND', 'NY', 'SD'),(store_sales.ss_net_profit <= 2000.00)],AND[ca_state IN ('GA', 'KS', 'MD'),(store_sales.ss_net_profit >= 150.00),(store_sales.ss_net_profit <= 3000.00)],AND[ca_state IN ('CO', 'MN', 'NC'),(store_sales.ss_net_profit >= 50.00)]]) build RFs:RF1 ca_address_sk->[ss_addr_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = store_sales.ss_cdemo_sk)) otherCondition=(OR[AND[(customer_demographics.cd_marital_status = 'S'),(customer_demographics.cd_education_status = 'Secondary'),(store_sales.ss_sales_price >= 100.00),(store_sales.ss_sales_price <= 150.00)],AND[(customer_demographics.cd_marital_status = 'M'),(customer_demographics.cd_education_status = '2 yr Degree'),(store_sales.ss_sales_price <= 100.00)],AND[(customer_demographics.cd_marital_status = 'D'),(customer_demographics.cd_education_status = 'Advanced Degree'),(store_sales.ss_sales_price >= 150.00)]]) build RFs:RF0 cd_demo_sk->[ss_cdemo_sk] +------------------------PhysicalProject +--------------------------filter((store_sales.ss_net_profit <= 25000.00) and (store_sales.ss_net_profit >= 0.00) and (store_sales.ss_sales_price <= 200.00) and (store_sales.ss_sales_price >= 50.00)) +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------PhysicalProject +--------------------------filter(OR[AND[(customer_demographics.cd_marital_status = 'S'),(customer_demographics.cd_education_status = 'Secondary')],AND[(customer_demographics.cd_marital_status = 'M'),(customer_demographics.cd_education_status = '2 yr Degree')],AND[(customer_demographics.cd_marital_status = 'D'),(customer_demographics.cd_education_status = 'Advanced Degree')]] and cd_education_status IN ('2 yr Degree', 'Advanced Degree', 'Secondary') and cd_marital_status IN ('D', 'M', 'S')) +----------------------------PhysicalOlapScan[customer_demographics] +--------------------PhysicalProject +----------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('CO', 'GA', 'KS', 'MD', 'MN', 'NC', 'ND', 'NY', 'SD')) +------------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------filter((date_dim.d_year = 2001)) +--------------------PhysicalOlapScan[date_dim] +------------PhysicalProject +--------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query49.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query49.out new file mode 100644 index 00000000000000..2c3bc534c872d3 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query49.out @@ -0,0 +1,107 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_49 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(OR[(web.return_rank <= 10),(web.currency_rank <= 10)]) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number = wr.wr_order_number)) otherCondition=() build RFs:RF1 ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((wr.wr_return_amt > 10000.00)) +--------------------------------------------------------------PhysicalOlapScan[web_returns(wr)] apply RFs: RF1 RF2 +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((ws.ws_net_paid > 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[web_sales(ws)] apply RFs: RF0 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1998)) +------------------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(OR[(catalog.return_rank <= 10),(catalog.currency_rank <= 10)]) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number = cr.cr_order_number)) otherCondition=() build RFs:RF4 cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((cr.cr_return_amount > 10000.00)) +--------------------------------------------------------------PhysicalOlapScan[catalog_returns(cr)] apply RFs: RF4 RF5 +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((cs.cs_net_paid > 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[catalog_sales(cs)] apply RFs: RF3 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1998)) +------------------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(OR[(store.return_rank <= 10),(store.currency_rank <= 10)]) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number = sr.sr_ticket_number)) otherCondition=() build RFs:RF7 ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((sr.sr_return_amt > 10000.00)) +--------------------------------------------------------------PhysicalOlapScan[store_returns(sr)] apply RFs: RF7 RF8 +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((sts.ss_net_paid > 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[store_sales(sts)] apply RFs: RF6 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1998)) +------------------------------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query5.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query5.out new file mode 100644 index 00000000000000..c74e0d87496087 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query5.out @@ -0,0 +1,77 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_5 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[sr_store_sk,ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk,ss_sold_date_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF1 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF3 cp_catalog_page_sk->[cr_catalog_page_sk,cs_catalog_page_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cr_returned_date_sk,cs_sold_date_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_page] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF7 web_site_sk->[ws_web_site_sk,ws_web_site_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk,ws_sold_date_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 +--------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_returns.wr_item_sk = web_sales.ws_item_sk) and (web_returns.wr_order_number = web_sales.ws_order_number)) otherCondition=() build RFs:RF4 wr_item_sk->[ws_item_sk];RF5 wr_order_number->[ws_order_number] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 RF7 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query50.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query50.out new file mode 100644 index 00000000000000..d391b632b30f2e --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query50.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_50 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF1 sr_ticket_number->[ss_ticket_number];RF2 sr_item_sk->[ss_item_sk];RF3 sr_customer_sk->[ss_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 RF5 +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 +------------------------------PhysicalProject +--------------------------------filter((d2.d_moy = 8) and (d2.d_year = 2001)) +----------------------------------PhysicalOlapScan[date_dim(d2)] +----------------------PhysicalProject +------------------------PhysicalOlapScan[date_dim(d1)] +------------------PhysicalProject +--------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query51.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query51.out new file mode 100644 index 00000000000000..5acf6623389d03 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query51.out @@ -0,0 +1,40 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_51 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter((y.web_cumulative > y.store_cumulative)) +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashJoin[FULL_OUTER_JOIN colocated] hashCondition=((web.d_date = store.d_date) and (web.item_sk = store.item_sk)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_month_seq <= 1223) and (date_dim.d_month_seq >= 1212)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_month_seq <= 1223) and (date_dim.d_month_seq >= 1212)) +------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query52.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query52.out new file mode 100644 index 00000000000000..5401ac3a92a539 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query52.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_52 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((item.i_manager_id = 1)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------filter((dt.d_moy = 12) and (dt.d_year = 2000)) +------------------------PhysicalOlapScan[date_dim(dt)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query53.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query53.out new file mode 100644 index 00000000000000..390906ce2f8165 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query53.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_53 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter(((cast(abs((sum_sales - cast(avg_quarterly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / tmp1.avg_quarterly_sales) > 0.100000) and (tmp1.avg_quarterly_sales > 0.0000)) +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------filter(OR[AND[i_category IN ('Books', 'Children', 'Electronics'),i_class IN ('personal', 'portable', 'reference', 'self-help'),i_brand IN ('exportiunivamalg #9', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9')],AND[i_category IN ('Men', 'Music', 'Women'),i_class IN ('accessories', 'classical', 'fragrances', 'pants'),i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1')]] and i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'exportiunivamalg #9', 'importoamalg #1', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9') and i_category IN ('Books', 'Children', 'Electronics', 'Men', 'Music', 'Women') and i_class IN ('accessories', 'classical', 'fragrances', 'pants', 'personal', 'portable', 'reference', 'self-help')) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter(d_month_seq IN (1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query54.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query54.out new file mode 100644 index 00000000000000..e8e53738331886 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query54.out @@ -0,0 +1,74 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_54 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF16 d_date_sk->[ss_sold_date_sk];RF17 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((my_customers.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF14 c_customer_sk->[ss_customer_sk];RF15 c_customer_sk->[ss_customer_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF14 RF15 RF16 RF17 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_county = store.s_county) and (customer_address.ca_state = store.s_state)) otherCondition=() build RFs:RF10 s_county->[ca_county];RF11 s_county->[ca_county];RF12 s_state->[ca_state];RF13 s_state->[ca_state] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((my_customers.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF8 c_current_addr_sk->[ca_address_sk];RF9 c_current_addr_sk->[ca_address_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[customer_address] apply RFs: RF8 RF9 RF10 RF11 RF12 RF13 +----------------------------------------PhysicalProject +------------------------------------------hashAgg[GLOBAL] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_customer_sk = cs_or_ws_sales.customer_sk)) otherCondition=() build RFs:RF6 customer_sk->[c_customer_sk];RF7 customer_sk->[c_customer_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[customer] apply RFs: RF6 RF7 +------------------------------------------------PhysicalProject +--------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs_or_ws_sales.sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk];RF5 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] +----------------------------------------------------PhysicalProject +------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs_or_ws_sales.item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk,ws_item_sk];RF3 i_item_sk->[cs_item_sk,ws_item_sk] +--------------------------------------------------------PhysicalUnion +----------------------------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 RF4 RF5 +----------------------------------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 RF4 RF5 +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((item.i_category = 'Music') and (item.i_class = 'country')) +------------------------------------------------------------PhysicalOlapScan[item] +----------------------------------------------------PhysicalProject +------------------------------------------------------filter((date_dim.d_moy = 1) and (date_dim.d_year = 1999)) +--------------------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +----------------------------PhysicalProject +------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as BIGINT) <= d_month_seq+3) build RFs:RF1 d_month_seq+3->[cast(d_month_seq as BIGINT)] +--------------------------------PhysicalProject +----------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as BIGINT) >= d_month_seq+1) build RFs:RF0 d_month_seq+1->[cast(d_month_seq as BIGINT)] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 RF1 +------------------------------------PhysicalAssertNumRows +--------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_moy = 1) and (date_dim.d_year = 1999)) +--------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalAssertNumRows +----------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------hashAgg[LOCAL] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy = 1) and (date_dim.d_year = 1999)) +----------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query55.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query55.out new file mode 100644 index 00000000000000..b21e9d417e36dc --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query55.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_55 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((item.i_manager_id = 52)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2000)) +------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query56.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query56.out new file mode 100644 index 00000000000000..9c20cb7fbf24ec --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query56.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_56 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ss_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF0 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('orchid', 'pink', 'powder')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +--------------------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF7 ca_address_sk->[cs_bill_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF4 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF4 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('orchid', 'pink', 'powder')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +--------------------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF11 ws_bill_addr_sk->[ca_address_sk] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +--------------------------------PhysicalOlapScan[customer_address] apply RFs: RF11 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF9 RF10 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF8 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('orchid', 'pink', 'powder')) +--------------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query57.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query57.out new file mode 100644 index 00000000000000..add64f10604206 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query57.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_57 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------PhysicalWindow +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((call_center.cc_call_center_sk = catalog_sales.cs_call_center_sk)) otherCondition=() build RFs:RF1 cc_call_center_sk->[cs_call_center_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +--------------------------------PhysicalProject +----------------------------------filter(OR[(date_dim.d_year = 2001),AND[(date_dim.d_year = 2000),(date_dim.d_moy = 12)],AND[(date_dim.d_year = 2002),(date_dim.d_moy = 1)]] and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[call_center] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalProject +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((v1.cc_name = v1_lead.cc_name) and (v1.i_brand = v1_lead.i_brand) and (v1.i_category = v1_lead.i_category) and (v1.rn = expr_(rn - 1))) otherCondition=() build RFs:RF7 i_category->[i_category,i_category];RF8 i_brand->[i_brand,i_brand];RF9 cc_name->[cc_name,cc_name];RF10 expr_(rn - 1)->[(rn + 1),rn] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((v1.cc_name = v1_lag.cc_name) and (v1.i_brand = v1_lag.i_brand) and (v1.i_category = v1_lag.i_category) and (v1.rn = expr_(rn + 1))) otherCondition=() build RFs:RF3 i_category->[i_category];RF4 i_brand->[i_brand];RF5 cc_name->[cc_name];RF6 rn->[(rn + 1)] +--------------------PhysicalProject +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 RF5 RF6 RF7 RF8 RF9 RF10 +--------------------filter(((cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / v2.avg_monthly_sales) > 0.100000) and (v2.avg_monthly_sales > 0.0000) and (v2.d_year = 2001)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF7 RF8 RF9 RF10 +----------------PhysicalProject +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query58.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query58.out new file mode 100644 index 00000000000000..5a44c1cc3d2ca6 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query58.out @@ -0,0 +1,86 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_58 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN colocated] hashCondition=((ss_items.item_id = ws_items.item_id)) otherCondition=((cast(cs_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(cs_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * cs_items.cs_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * ss_items.ss_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * cs_items.cs_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * ss_items.ss_item_rev))) build RFs:RF13 item_id->[i_item_id] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF12 i_item_sk->[ws_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF11 RF12 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF10 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF10 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF9 d_week_seq->[d_week_seq] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF9 +------------------------------------PhysicalAssertNumRows +--------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date = '2001-06-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] apply RFs: RF13 +------------PhysicalProject +--------------hashJoin[INNER_JOIN colocated] hashCondition=((ss_items.item_id = cs_items.item_id)) otherCondition=((cast(cs_item_rev as DECIMALV3(38, 3)) <= (1.1 * ss_items.ss_item_rev)) and (cast(cs_item_rev as DECIMALV3(38, 3)) >= (0.9 * ss_items.ss_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) <= (1.1 * cs_items.cs_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) >= (0.9 * cs_items.cs_item_rev))) build RFs:RF8 item_id->[i_item_id] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF7 i_item_sk->[cs_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[cs_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF6 RF7 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF5 d_date->[d_date] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF5 +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF4 d_week_seq->[d_week_seq] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF4 +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------filter((date_dim.d_date = '2001-06-16')) +------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF1 d_date->[d_date] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF1 +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF0 d_week_seq->[d_week_seq] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------filter((date_dim.d_date = '2001-06-16')) +------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query59.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query59.out new file mode 100644 index 00000000000000..050957da0f0a7a --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query59.out @@ -0,0 +1,45 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_59 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store_sales] apply RFs: RF0 +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(cast(d_week_seq2 as BIGINT) - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF5 s_store_id2->[s_store_id];RF6 expr_(cast(d_week_seq2 as BIGINT) - 52)->[cast(d_week_seq as BIGINT)] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF4 d_week_seq->[d_week_seq] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 RF6 +----------------------PhysicalProject +------------------------PhysicalOlapScan[store] apply RFs: RF5 +------------------PhysicalProject +--------------------filter((d.d_month_seq <= 1206) and (d.d_month_seq >= 1195)) +----------------------PhysicalOlapScan[date_dim(d)] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2 +----------------------PhysicalProject +------------------------PhysicalOlapScan[store] +------------------PhysicalProject +--------------------filter((d.d_month_seq <= 1218) and (d.d_month_seq >= 1207)) +----------------------PhysicalOlapScan[date_dim(d)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query6.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query6.out new file mode 100644 index 00000000000000..9eead41add48b7 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query6.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_6 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter((cnt >= 10)) +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((a.ca_address_sk = c.c_current_addr_sk)) otherCondition=() build RFs:RF5 c_current_addr_sk->[ca_address_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer_address(a)] apply RFs: RF5 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((c.c_customer_sk = s.ss_customer_sk)) otherCondition=() build RFs:RF4 ss_customer_sk->[c_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer(c)] apply RFs: RF4 +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((s.ss_item_sk = i.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((s.ss_sold_date_sk = d.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales(s)] apply RFs: RF2 RF3 +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_month_seq = date_dim.d_month_seq)) otherCondition=() build RFs:RF1 d_month_seq->[d_month_seq] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[date_dim(d)] apply RFs: RF1 +--------------------------------------PhysicalAssertNumRows +----------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------hashAgg[GLOBAL] +--------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------hashAgg[LOCAL] +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2002)) +----------------------------------------------------PhysicalOlapScan[date_dim] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((j.i_category = i.i_category)) otherCondition=((cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * avg(j.i_current_price)))) build RFs:RF0 i_category->[i_category] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item(i)] apply RFs: RF0 +----------------------------------hashAgg[GLOBAL] +------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------hashAgg[LOCAL] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item(j)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query60.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query60.out new file mode 100644 index 00000000000000..f024124050e0f8 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query60.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_60 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ss_addr_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +------------------------------------PhysicalOlapScan[customer_address] +----------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF0 i_item_id->[i_item_id] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] apply RFs: RF0 +------------------------------PhysicalProject +--------------------------------filter((item.i_category = 'Jewelry')) +----------------------------------PhysicalOlapScan[item] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF7 i_item_sk->[cs_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF6 ca_address_sk->[cs_bill_addr_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +------------------------------------PhysicalOlapScan[customer_address] +----------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF4 i_item_id->[i_item_id] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] apply RFs: RF4 +------------------------------PhysicalProject +--------------------------------filter((item.i_category = 'Jewelry')) +----------------------------------PhysicalOlapScan[item] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF11 ca_address_sk->[ws_bill_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF9 RF10 RF11 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF8 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Jewelry')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query61.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query61.out new file mode 100644 index 00000000000000..654f58923a6f2b --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query61.out @@ -0,0 +1,70 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_61 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----PhysicalProject +------NestedLoopJoin[CROSS_JOIN] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF10 c_current_addr_sk->[ca_address_sk] +------------------PhysicalProject +--------------------filter((customer_address.ca_gmt_offset = -7.00)) +----------------------PhysicalOlapScan[customer_address] apply RFs: RF10 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF9 ss_customer_sk->[c_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] apply RFs: RF9 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF8 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF7 p_promo_sk->[ss_promo_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[ss_item_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF5 RF6 RF7 RF8 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] +------------------------------PhysicalProject +--------------------------------filter(OR[(promotion.p_channel_dmail = 'Y'),(promotion.p_channel_email = 'Y'),(promotion.p_channel_tv = 'Y')]) +----------------------------------PhysicalOlapScan[promotion] +--------------------------PhysicalProject +----------------------------filter((store.s_gmt_offset = -7.00)) +------------------------------PhysicalOlapScan[store] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((item.i_category = 'Home')) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] apply RFs: RF0 +--------------------------PhysicalProject +----------------------------filter((customer_address.ca_gmt_offset = -7.00)) +------------------------------PhysicalOlapScan[customer_address] +------------------PhysicalProject +--------------------filter((store.s_gmt_offset = -7.00)) +----------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query62.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query62.out new file mode 100644 index 00000000000000..00e7e385d016fe --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query62.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_62 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF2 sm_ship_mode_sk->[ws_ship_mode_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF1 w_warehouse_sk->[ws_warehouse_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_ship_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1234) and (date_dim.d_month_seq >= 1223)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[warehouse] +----------------------PhysicalProject +------------------------PhysicalOlapScan[ship_mode] +------------------PhysicalProject +--------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query63.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query63.out new file mode 100644 index 00000000000000..e6acab66744562 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query63.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_63 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter(((cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / tmp1.avg_monthly_sales) > 0.100000) and (tmp1.avg_monthly_sales > 0.0000)) +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------filter(OR[AND[i_category IN ('Books', 'Children', 'Electronics'),i_class IN ('personal', 'portable', 'reference', 'self-help'),i_brand IN ('exportiunivamalg #9', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9')],AND[i_category IN ('Men', 'Music', 'Women'),i_class IN ('accessories', 'classical', 'fragrances', 'pants'),i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1')]] and i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'exportiunivamalg #9', 'importoamalg #1', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9') and i_category IN ('Books', 'Children', 'Electronics', 'Men', 'Music', 'Women') and i_class IN ('accessories', 'classical', 'fragrances', 'pants', 'personal', 'portable', 'reference', 'self-help')) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter(d_month_seq IN (1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query64.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query64.out new file mode 100644 index 00000000000000..13e1bc08953a35 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query64.out @@ -0,0 +1,102 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_64 -- +PhysicalCteAnchor ( cteId=CTEId#1 ) +--PhysicalCteProducer ( cteId=CTEId#1 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[cr_item_sk,cs_item_sk,sr_item_sk,ss_item_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() build RFs:RF18 ib_income_band_sk->[hd_income_band_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() build RFs:RF17 ib_income_band_sk->[hd_income_band_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() build RFs:RF16 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() build RFs:RF15 ca_address_sk->[ss_addr_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_hdemo_sk = hd2.hd_demo_sk)) otherCondition=() build RFs:RF14 hd_demo_sk->[c_current_hdemo_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() build RFs:RF13 hd_demo_sk->[ss_hdemo_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF12 p_promo_sk->[ss_promo_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) build RFs:RF11 cd_demo_sk->[c_current_cdemo_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF10 cd_demo_sk->[ss_cdemo_sk] +----------------------------------------------------PhysicalProject +------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[c_first_shipto_date_sk] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[c_first_sales_date_sk] +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] +----------------------------------------------------------------PhysicalProject +------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF6 s_store_sk->[ss_store_sk] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF4 sr_item_sk->[cr_item_sk,cs_item_sk,ss_item_sk];RF5 sr_ticket_number->[ss_ticket_number] +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF3 cs_item_sk->[ss_item_sk] +----------------------------------------------------------------------------PhysicalProject +------------------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF4 RF5 RF6 RF7 RF10 RF12 RF13 RF15 RF19 +--------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------filter(d_year IN (1999, 2000)) +------------------------------------------------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------------------------------------------------PhysicalProject +------------------------------------------------------------------------------filter((sale > (2 * refund))) +--------------------------------------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF0 cr_item_sk->[cs_item_sk];RF1 cr_order_number->[cs_order_number] +------------------------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF4 RF19 +------------------------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF4 RF19 +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF19 +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------PhysicalOlapScan[store] +----------------------------------------------------------------PhysicalProject +------------------------------------------------------------------PhysicalOlapScan[customer] apply RFs: RF8 RF9 RF11 RF14 RF16 +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------PhysicalOlapScan[date_dim(d2)] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------PhysicalOlapScan[date_dim(d3)] +----------------------------------------------------PhysicalProject +------------------------------------------------------PhysicalOlapScan[customer_demographics(cd1)] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[customer_demographics(cd2)] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[promotion] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[household_demographics(hd1)] apply RFs: RF17 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[household_demographics(hd2)] apply RFs: RF18 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer_address(ad1)] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_address(ad2)] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[income_band(ib1)] +--------------------PhysicalProject +----------------------PhysicalOlapScan[income_band(ib2)] +----------------PhysicalProject +------------------filter((item.i_current_price <= 58.00) and (item.i_current_price >= 49.00) and i_color IN ('blush', 'lace', 'lawn', 'misty', 'orange', 'pink')) +--------------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((cs1.item_sk = cs2.item_sk) and (cs1.store_name = cs2.store_name) and (cs1.store_zip = cs2.store_zip)) otherCondition=((cs2.cnt <= cs1.cnt)) build RFs:RF20 item_sk->[item_sk];RF21 store_name->[store_name];RF22 store_zip->[store_zip] +--------------PhysicalProject +----------------filter((cs1.syear = 1999)) +------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF20 RF21 RF22 +--------------PhysicalProject +----------------filter((cs2.syear = 2000)) +------------------PhysicalCteConsumer ( cteId=CTEId#1 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query65.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query65.out new file mode 100644 index 00000000000000..267b157be5ff10 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query65.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_65 -- +PhysicalResultSink +--PhysicalProject +----PhysicalLazyMaterialize[materializedSlots:(store.s_store_name,item.i_item_desc,sc.revenue) lazySlots:(item.i_brand,item.i_current_price,item.i_wholesale_cost)] +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((sb.ss_store_sk = sc.ss_store_sk)) otherCondition=((cast(revenue as DECIMALV3(38, 5)) <= (0.1 * sb.ave))) build RFs:RF4 ss_store_sk->[s_store_sk,ss_store_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = sc.ss_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((item.i_item_sk = sc.ss_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 +----------------------------------PhysicalProject +------------------------------------filter((date_dim.d_month_seq <= 1187) and (date_dim.d_month_seq >= 1176)) +--------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------PhysicalLazyMaterializeOlapScan[item lazySlots:(item.i_current_price,item.i_wholesale_cost,item.i_brand)] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store] apply RFs: RF4 +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter((date_dim.d_month_seq <= 1187) and (date_dim.d_month_seq >= 1176)) +--------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query66.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query66.out new file mode 100644 index 00000000000000..fb7a3400881984 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query66.out @@ -0,0 +1,61 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_66 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------PhysicalUnion +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF3 w_warehouse_sk->[ws_warehouse_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF2 t_time_sk->[ws_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF0 sm_ship_mode_sk->[ws_ship_mode_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------------------PhysicalProject +--------------------------------------------filter(sm_carrier IN ('BOXBUNDLES', 'ORIENTAL')) +----------------------------------------------PhysicalOlapScan[ship_mode] +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_time <= 71770) and (time_dim.t_time >= 42970)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[warehouse] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF7 w_warehouse_sk->[cs_warehouse_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF6 t_time_sk->[cs_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF4 sm_ship_mode_sk->[cs_ship_mode_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7 +------------------------------------------PhysicalProject +--------------------------------------------filter(sm_carrier IN ('BOXBUNDLES', 'ORIENTAL')) +----------------------------------------------PhysicalOlapScan[ship_mode] +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_time <= 71770) and (time_dim.t_time >= 42970)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[warehouse] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query67.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query67.out new file mode 100644 index 00000000000000..7913aec7a93a82 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query67.out @@ -0,0 +1,42 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_67 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------PhysicalProject +------------------------filter((date_dim.d_month_seq <= 1228) and (date_dim.d_month_seq >= 1217)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[store] +--------------PhysicalProject +----------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------filter((dw2.rk <= 100)) +------------PhysicalWindow +--------------PhysicalPartitionTopN +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalPartitionTopN +--------------------PhysicalUnion +----------------------PhysicalProject +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalRepeat +--------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query68.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query68.out new file mode 100644 index 00000000000000..e25d34e80cdd66 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query68.out @@ -0,0 +1,40 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_68 -- +PhysicalResultSink +--PhysicalProject +----PhysicalLazyMaterialize[materializedSlots:(customer.c_last_name,current_addr.ca_city,dn.bought_city,dn.ss_ticket_number,dn.extended_price,dn.extended_tax,dn.list_price) lazySlots:(customer.c_first_name)] +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = current_addr.ca_address_sk)) otherCondition=(( not (ca_city = bought_city))) build RFs:RF5 c_current_addr_sk->[ca_address_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[customer_address(current_addr)] apply RFs: RF5 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 ss_customer_sk->[c_customer_sk] +--------------------PhysicalProject +----------------------PhysicalLazyMaterializeOlapScan[customer lazySlots:(customer.c_first_name)] apply RFs: RF4 +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ss_addr_sk->[ca_address_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_address] apply RFs: RF3 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_dom <= 2) and (date_dim.d_dom >= 1) and d_year IN (1998, 1999, 2000)) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------filter(s_city IN ('Fairview', 'Midway')) +----------------------------------------PhysicalOlapScan[store] +--------------------------------PhysicalProject +----------------------------------filter(OR[(household_demographics.hd_dep_count = 3),(household_demographics.hd_vehicle_count = 4)]) +------------------------------------PhysicalOlapScan[household_demographics] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query69.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query69.out new file mode 100644 index 00000000000000..953d0237ca5512 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query69.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_69 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 +------------------------PhysicalProject +--------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2002)) +----------------------------PhysicalOlapScan[date_dim] +--------------------hashJoin[RIGHT_ANTI_JOIN shuffle] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[cs_ship_customer_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2002)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF3 c_current_cdemo_sk->[cd_demo_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer_demographics] apply RFs: RF3 +--------------------------hashJoin[RIGHT_ANTI_JOIN shuffle] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ws_bill_customer_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy <= 3) and (date_dim.d_moy >= 1) and (date_dim.d_year = 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer(c)] apply RFs: RF0 +--------------------------------PhysicalProject +----------------------------------filter(ca_state IN ('IL', 'ME', 'TX')) +------------------------------------PhysicalOlapScan[customer_address(ca)] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query7.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query7.out new file mode 100644 index 00000000000000..2d63af9e61b19e --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query7.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_7 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF2 p_promo_sk->[ss_promo_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF0 cd_demo_sk->[ss_cdemo_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((customer_demographics.cd_education_status = 'College') and (customer_demographics.cd_gender = 'F') and (customer_demographics.cd_marital_status = 'W')) +----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter(OR[(promotion.p_channel_email = 'N'),(promotion.p_channel_event = 'N')]) +--------------------------PhysicalOlapScan[promotion] +------------------PhysicalProject +--------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query70.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query70.out new file mode 100644 index 00000000000000..6f7209d31b58eb --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query70.out @@ -0,0 +1,44 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_70 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 RF4 +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_month_seq <= 1231) and (d1.d_month_seq >= 1220)) +----------------------------------------PhysicalOlapScan[date_dim(d1)] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((store.s_state = tmp1.s_state)) otherCondition=() build RFs:RF2 s_state->[s_state] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store] apply RFs: RF2 +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------hashAgg[LOCAL] +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_month_seq <= 1231) and (date_dim.d_month_seq >= 1220)) +------------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query71.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query71.out new file mode 100644 index 00000000000000..88a4aed8de2b2f --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query71.out @@ -0,0 +1,36 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_71 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((tmp.time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF2 t_time_sk->[cs_sold_time_sk,ss_sold_time_sk,ws_sold_time_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk,ss_sold_date_sk,ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((tmp.sold_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk,ss_item_sk,ws_item_sk] +----------------------------PhysicalUnion +------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 +------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +------------------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------PhysicalProject +------------------------------filter((item.i_manager_id = 1)) +--------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2002)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------filter(t_meal_time IN ('breakfast', 'dinner')) +------------------------PhysicalOlapScan[time_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out new file mode 100644 index 00000000000000..e3b47aad8ef6de --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out @@ -0,0 +1,58 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_72 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[LEFT_OUTER_JOIN bucketShuffle] hashCondition=((catalog_returns.cr_item_sk = catalog_sales.cs_item_sk) and (catalog_returns.cr_order_number = catalog_sales.cs_order_number)) otherCondition=() +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((warehouse.w_warehouse_sk = inventory.inv_warehouse_sk)) otherCondition=() build RFs:RF8 w_warehouse_sk->[inv_warehouse_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk) and (inventory.inv_date_sk = d2.d_date_sk)) otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity)) build RFs:RF6 d_date_sk->[inv_date_sk];RF7 cs_item_sk->[inv_item_sk] +--------------------------PhysicalOlapScan[inventory] apply RFs: RF6 RF7 RF8 +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_week_seq = d2.d_week_seq)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[date_dim(d2)] apply RFs: RF5 +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF3 cd_demo_sk->[cs_bill_cdemo_sk] +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[cs_bill_hdemo_sk] +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_date_sk = d3.d_date_sk) and (catalog_sales.cs_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_ship_date_sk];RF1 d_date_sk->[cs_sold_date_sk] +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +--------------------------------------------------PhysicalProject +----------------------------------------------------NestedLoopJoin[INNER_JOIN](d3.d_date > days_add(d_date, 5)) +------------------------------------------------------PhysicalProject +--------------------------------------------------------PhysicalOlapScan[date_dim(d3)] +------------------------------------------------------PhysicalProject +--------------------------------------------------------filter((d1.d_year = 1998)) +----------------------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------------------PhysicalProject +------------------------------------------------filter((household_demographics.hd_buy_potential = '1001-5000')) +--------------------------------------------------PhysicalOlapScan[household_demographics] +------------------------------------------PhysicalProject +--------------------------------------------filter((customer_demographics.cd_marital_status = 'S')) +----------------------------------------------PhysicalOlapScan[customer_demographics] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[promotion] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------PhysicalOlapScan[warehouse] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_returns] + + + + group expression count exceeds memo_max_group_expression_size(10000) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query73.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query73.out new file mode 100644 index 00000000000000..6b13afc6aa87cd --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query73.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_73 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((dj.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 ss_customer_sk->[c_customer_sk] +------------PhysicalProject +--------------PhysicalOlapScan[customer] apply RFs: RF3 +------------filter((dj.cnt <= 5) and (dj.cnt >= 1)) +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_dom <= 2) and (date_dim.d_dom >= 1) and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter((store.s_county = 'Williamson County')) +--------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------filter(((cast(hd_dep_count as DOUBLE) / cast(hd_vehicle_count as DOUBLE)) > 1.0) and (household_demographics.hd_vehicle_count > 0) and hd_buy_potential IN ('1001-5000', '5001-10000')) +----------------------------PhysicalOlapScan[household_demographics] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query74.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query74.out new file mode 100644 index 00000000000000..1c089f592aeb68 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query74.out @@ -0,0 +1,63 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_74 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ss_customer_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------filter(d_year IN (1999, 2000)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[customer] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ws_bill_customer_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------filter(d_year IN (1999, 2000)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[customer] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.00), (cast(year_total as DECIMALV3(13, 8)) / year_total), NULL) > if((year_total > 0.00), (cast(year_total as DECIMALV3(13, 8)) / year_total), NULL))) build RFs:RF6 customer_id->[customer_id,customer_id,customer_id] +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF5 customer_id->[customer_id,customer_id] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF4 customer_id->[customer_id] +--------------------PhysicalProject +----------------------filter((t_s_firstyear.sale_type = 's') and (t_s_firstyear.year = 1999) and (t_s_firstyear.year_total > 0.00)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 RF6 +--------------------PhysicalProject +----------------------filter((t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year = 1999) and (t_w_firstyear.year_total > 0.00)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 +----------------PhysicalProject +------------------filter((t_s_secyear.sale_type = 's') and (t_s_secyear.year = 2000)) +--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 +--------------PhysicalProject +----------------filter((t_w_secyear.sale_type = 'w') and (t_w_secyear.year = 2000)) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query75.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query75.out new file mode 100644 index 00000000000000..cb7767db6f41ad --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query75.out @@ -0,0 +1,68 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_75 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalUnion +--------------PhysicalProject +----------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF2 cs_order_number->[cr_order_number];RF3 cs_item_sk->[cr_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2 RF3 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((item.i_category = 'Sports')) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter(d_year IN (2001, 2002)) +--------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF6 ss_ticket_number->[sr_ticket_number];RF7 ss_item_sk->[sr_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_returns] apply RFs: RF6 RF7 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ss_item_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 +--------------------------PhysicalProject +----------------------------filter((item.i_category = 'Sports')) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter(d_year IN (2001, 2002)) +--------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF10 ws_order_number->[wr_order_number];RF11 ws_item_sk->[wr_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[web_returns] apply RFs: RF10 RF11 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[ws_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF8 i_item_sk->[ws_item_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 +--------------------------PhysicalProject +----------------------------filter((item.i_category = 'Sports')) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter(d_year IN (2001, 2002)) +--------------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((curr_yr.i_brand_id = prev_yr.i_brand_id) and (curr_yr.i_category_id = prev_yr.i_category_id) and (curr_yr.i_class_id = prev_yr.i_class_id) and (curr_yr.i_manufact_id = prev_yr.i_manufact_id)) otherCondition=(((cast(cast(sales_cnt as DECIMALV3(17, 2)) as DECIMALV3(23, 8)) / cast(sales_cnt as DECIMALV3(17, 2))) < 0.900000)) build RFs:RF12 i_brand_id->[i_brand_id];RF13 i_class_id->[i_class_id];RF14 i_category_id->[i_category_id];RF15 i_manufact_id->[i_manufact_id] +--------------filter((curr_yr.d_year = 2002)) +----------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 RF13 RF14 RF15 +--------------filter((prev_yr.d_year = 2001)) +----------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query76.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query76.out new file mode 100644 index 00000000000000..13989b9aed9734 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query76.out @@ -0,0 +1,38 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_76 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk,ss_sold_date_sk,ws_sold_date_sk] +------------------PhysicalUnion +--------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +--------------------------PhysicalProject +----------------------------filter(ss_customer_sk IS NULL) +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF3 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 ws_item_sk->[i_item_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] apply RFs: RF1 +------------------------PhysicalProject +--------------------------filter(ws_promo_sk IS NULL) +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 +--------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk] +--------------------------PhysicalProject +----------------------------filter(cs_bill_customer_sk IS NULL) +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +------------------PhysicalProject +--------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query77.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query77.out new file mode 100644 index 00000000000000..3659671c869dc8 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query77.out @@ -0,0 +1,101 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_77 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ss.s_store_sk = sr.s_store_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[sr_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF1 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +----------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cr_returned_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF4 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ws.wp_web_page_sk = wr.wp_web_page_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF9 wp_web_page_sk->[ws_web_page_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_page] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF7 wp_web_page_sk->[wr_web_page_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 RF7 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-09') and (date_dim.d_date >= '2000-08-10')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_page] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query78.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query78.out new file mode 100644 index 00000000000000..5affa616f83ae3 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query78.out @@ -0,0 +1,57 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_78 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter(OR[(coalesce(ws_qty, 0) > 0),(coalesce(cs_qty, 0) > 0)]) +------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((cs.cs_customer_sk = ss.ss_customer_sk) and (cs.cs_item_sk = ss.ss_item_sk) and (cs.cs_sold_year = ss.ss_sold_year)) otherCondition=() +--------------PhysicalProject +----------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ws.ws_customer_sk = ss.ss_customer_sk) and (ws.ws_item_sk = ss.ss_item_sk) and (ws.ws_sold_year = ss.ss_sold_year)) otherCondition=() +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((store_returns.sr_ticket_number = store_sales.ss_ticket_number) and (store_sales.ss_item_sk = store_returns.sr_item_sk)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_returns] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_year = 1998)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((web_returns.wr_order_number = web_sales.ws_order_number) and (web_sales.ws_item_sk = web_returns.wr_item_sk)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_returns] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_year = 1998)) +----------------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((catalog_returns.cr_order_number = catalog_sales.cs_order_number) and (catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)) otherCondition=() +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_returns] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 1998)) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query79.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query79.out new file mode 100644 index 00000000000000..605562961aa019 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query79.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_79 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ms.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF1 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_dow = 1) and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(OR[(household_demographics.hd_dep_count = 7),(household_demographics.hd_vehicle_count > -1)]) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------filter((store.s_number_employees <= 295) and (store.s_number_employees >= 200)) +----------------------------PhysicalOlapScan[store] +------------PhysicalProject +--------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query8.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query8.out new file mode 100644 index 00000000000000..837e29a358bace --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query8.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_8 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((expr_substring(s_zip, 1, 2) = expr_substring(ca_zip, 1, 2))) otherCondition=() +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_qoy = 2) and (date_dim.d_year = 1998)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store] +------------------PhysicalProject +--------------------PhysicalIntersect RFV2: RF3[ca_zip->substring(ca_zip, 1, 5)] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(substring(ca_zip, 1, 5) IN ('10298', '10374', '10425', '11340', '11489', '11618', '11652', '11686', '11855', '11912', '12197', '12318', '12320', '12350', '13086', '13123', '13261', '13338', '13376', '13378', '13443', '13844', '13869', '13918', '14073', '14155', '14196', '14242', '14312', '14440', '14530', '14851', '15371', '15475', '15543', '15734', '15751', '15782', '15794', '16005', '16226', '16364', '16515', '16704', '16791', '16891', '17167', '17193', '17291', '17672', '17819', '17879', '17895', '18218', '18360', '18367', '18410', '18421', '18434', '18569', '18700', '18767', '18829', '18884', '19326', '19444', '19489', '19753', '19833', '19988', '20244', '20317', '20534', '20601', '20712', '21060', '21094', '21204', '21231', '21343', '21727', '21800', '21814', '22728', '22815', '22911', '23065', '23952', '24227', '24255', '24286', '24594', '24660', '24891', '24987', '25115', '25178', '25214', '25264', '25333', '25494', '25717', '25973', '26217', '26689', '27052', '27116', '27156', '27287', '27369', '27385', '27413', '27642', '27700', '28055', '28239', '28571', '28577', '28810', '29086', '29392', '29450', '29752', '29818', '30106', '30415', '30621', '31013', '31016', '31655', '31830', '32489', '32669', '32754', '32919', '32958', '32961', '33113', '33122', '33159', '33467', '33562', '33773', '33869', '34306', '34473', '34594', '34948', '34972', '35076', '35390', '35834', '35863', '35926', '36201', '36335', '36430', '36479', '37119', '37788', '37914', '38353', '38607', '38919', '39214', '39459', '39500', '39503', '40146', '40936', '40979', '41162', '41232', '41255', '41331', '41351', '41352', '41419', '41807', '41836', '41967', '42361', '43432', '43639', '43830', '43933', '44529', '45266', '45484', '45533', '45645', '45676', '45859', '46081', '46131', '46507', '47289', '47369', '47529', '47602', '47770', '48017', '48162', '48333', '48530', '48567', '49101', '49130', '49140', '49211', '49230', '49254', '49472', '50412', '50632', '50636', '50679', '50788', '51089', '51184', '51195', '51634', '51717', '51766', '51782', '51793', '51933', '52094', '52301', '52389', '52868', '53163', '53535', '53565', '54010', '54207', '54364', '54558', '54585', '55233', '55349', '56224', '56355', '56436', '56455', '56600', '56877', '57025', '57553', '57631', '57649', '57839', '58032', '58058', '58062', '58117', '58218', '58412', '58454', '58581', '59004', '59080', '59130', '59226', '59345', '59386', '59494', '59852', '60083', '60298', '60560', '60624', '60736', '61527', '61794', '61860', '61997', '62361', '62585', '62878', '63073', '63180', '63193', '63294', '63792', '63991', '64592', '65148', '65177', '65501', '66057', '66943', '67881', '67975', '67998', '68101', '68293', '68341', '68605', '68730', '68770', '68843', '68852', '68908', '69280', '69952', '69998', '70041', '70070', '70073', '70450', '71144', '71256', '71286', '71836', '71948', '71954', '71997', '72592', '72991', '73021', '73108', '73134', '73146', '73219', '73873', '74686', '75660', '75675', '75742', '75752', '77454', '77817', '78093', '78366', '79077', '79658', '80332', '80846', '81003', '81070', '81084', '81335', '81504', '81755', '81963', '82080', '82602', '82620', '83041', '83086', '83583', '83647', '83833', '83910', '83986', '84247', '84680', '84844', '84919', '85066', '85761', '86057', '86379', '86709', '88086', '88137', '88217', '89193', '89338', '90209', '90229', '90669', '91110', '91894', '92292', '92380', '92645', '92696', '93498', '94791', '94835', '94898', '95042', '95430', '95464', '95694', '96435', '96560', '97173', '97462', '98069', '98072', '98338', '98533', '98569', '98584', '98862', '99060', '99132')) +--------------------------------PhysicalOlapScan[customer_address] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter((cnt > 10)) +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +------------------------------------------PhysicalProject +--------------------------------------------filter((customer.c_preferred_cust_flag = 'Y')) +----------------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +------------------------------------------PhysicalProject +--------------------------------------------filter(substring(ca_zip, 1, 5) IN ('10298', '10374', '10425', '11340', '11489', '11618', '11652', '11686', '11855', '11912', '12197', '12318', '12320', '12350', '13086', '13123', '13261', '13338', '13376', '13378', '13443', '13844', '13869', '13918', '14073', '14155', '14196', '14242', '14312', '14440', '14530', '14851', '15371', '15475', '15543', '15734', '15751', '15782', '15794', '16005', '16226', '16364', '16515', '16704', '16791', '16891', '17167', '17193', '17291', '17672', '17819', '17879', '17895', '18218', '18360', '18367', '18410', '18421', '18434', '18569', '18700', '18767', '18829', '18884', '19326', '19444', '19489', '19753', '19833', '19988', '20244', '20317', '20534', '20601', '20712', '21060', '21094', '21204', '21231', '21343', '21727', '21800', '21814', '22728', '22815', '22911', '23065', '23952', '24227', '24255', '24286', '24594', '24660', '24891', '24987', '25115', '25178', '25214', '25264', '25333', '25494', '25717', '25973', '26217', '26689', '27052', '27116', '27156', '27287', '27369', '27385', '27413', '27642', '27700', '28055', '28239', '28571', '28577', '28810', '29086', '29392', '29450', '29752', '29818', '30106', '30415', '30621', '31013', '31016', '31655', '31830', '32489', '32669', '32754', '32919', '32958', '32961', '33113', '33122', '33159', '33467', '33562', '33773', '33869', '34306', '34473', '34594', '34948', '34972', '35076', '35390', '35834', '35863', '35926', '36201', '36335', '36430', '36479', '37119', '37788', '37914', '38353', '38607', '38919', '39214', '39459', '39500', '39503', '40146', '40936', '40979', '41162', '41232', '41255', '41331', '41351', '41352', '41419', '41807', '41836', '41967', '42361', '43432', '43639', '43830', '43933', '44529', '45266', '45484', '45533', '45645', '45676', '45859', '46081', '46131', '46507', '47289', '47369', '47529', '47602', '47770', '48017', '48162', '48333', '48530', '48567', '49101', '49130', '49140', '49211', '49230', '49254', '49472', '50412', '50632', '50636', '50679', '50788', '51089', '51184', '51195', '51634', '51717', '51766', '51782', '51793', '51933', '52094', '52301', '52389', '52868', '53163', '53535', '53565', '54010', '54207', '54364', '54558', '54585', '55233', '55349', '56224', '56355', '56436', '56455', '56600', '56877', '57025', '57553', '57631', '57649', '57839', '58032', '58058', '58062', '58117', '58218', '58412', '58454', '58581', '59004', '59080', '59130', '59226', '59345', '59386', '59494', '59852', '60083', '60298', '60560', '60624', '60736', '61527', '61794', '61860', '61997', '62361', '62585', '62878', '63073', '63180', '63193', '63294', '63792', '63991', '64592', '65148', '65177', '65501', '66057', '66943', '67881', '67975', '67998', '68101', '68293', '68341', '68605', '68730', '68770', '68843', '68852', '68908', '69280', '69952', '69998', '70041', '70070', '70073', '70450', '71144', '71256', '71286', '71836', '71948', '71954', '71997', '72592', '72991', '73021', '73108', '73134', '73146', '73219', '73873', '74686', '75660', '75675', '75742', '75752', '77454', '77817', '78093', '78366', '79077', '79658', '80332', '80846', '81003', '81070', '81084', '81335', '81504', '81755', '81963', '82080', '82602', '82620', '83041', '83086', '83583', '83647', '83833', '83910', '83986', '84247', '84680', '84844', '84919', '85066', '85761', '86057', '86379', '86709', '88086', '88137', '88217', '89193', '89338', '90209', '90229', '90669', '91110', '91894', '92292', '92380', '92645', '92696', '93498', '94791', '94835', '94898', '95042', '95430', '95464', '95694', '96435', '96560', '97173', '97462', '98069', '98072', '98338', '98533', '98569', '98584', '98862', '99060', '99132')) +----------------------------------------------PhysicalOlapScan[customer_address] RFV2: RF3 + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query80.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query80.out new file mode 100644 index 00000000000000..6661e34bc17afc --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query80.out @@ -0,0 +1,100 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_80 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF4 ss_item_sk->[sr_item_sk];RF5 ss_ticket_number->[sr_ticket_number] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_returns] apply RFs: RF4 RF5 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF1 p_promo_sk->[ss_promo_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_date <= '2002-09-13') and (date_dim.d_date >= '2002-08-14')) +----------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------filter((promotion.p_channel_tv = 'N')) +------------------------------------------------PhysicalOlapScan[promotion] +----------------------------------------PhysicalProject +------------------------------------------filter((item.i_current_price > 50.00)) +--------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF11 cp_catalog_page_sk->[cs_catalog_page_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF9 cs_item_sk->[cr_item_sk];RF10 cs_order_number->[cr_order_number] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF9 RF10 +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF8 i_item_sk->[cs_item_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF7 p_promo_sk->[cs_promo_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[cs_sold_date_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF6 RF7 RF8 RF11 +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_date <= '2002-09-13') and (date_dim.d_date >= '2002-08-14')) +----------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------filter((promotion.p_channel_tv = 'N')) +------------------------------------------------PhysicalOlapScan[promotion] +----------------------------------------PhysicalProject +------------------------------------------filter((item.i_current_price > 50.00)) +--------------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_page] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF16 ws_item_sk->[wr_item_sk];RF17 ws_order_number->[wr_order_number] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_returns] apply RFs: RF16 RF17 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF15 web_site_sk->[ws_web_site_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF14 i_item_sk->[ws_item_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF13 p_promo_sk->[ws_promo_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ws_sold_date_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF12 RF13 RF14 RF15 +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_date <= '2002-09-13') and (date_dim.d_date >= '2002-08-14')) +----------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------filter((promotion.p_channel_tv = 'N')) +------------------------------------------------PhysicalOlapScan[promotion] +----------------------------------------PhysicalProject +------------------------------------------filter((item.i_current_price > 50.00)) +--------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query81.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query81.out new file mode 100644 index 00000000000000..ddcb393e26ebad --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query81.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_81 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_returns.cr_returning_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[cr_returning_addr_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cr_returned_date_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[catalog_returns] apply RFs: RF0 RF1 +--------------------PhysicalProject +----------------------filter((date_dim.d_year = 2001)) +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------PhysicalOlapScan[customer_address] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((ctr1.ctr_state = ctr2.ctr_state)) otherCondition=((cast(ctr_total_return as DECIMALV3(38, 5)) > (avg(ctr_total_return) * 1.2))) build RFs:RF4 ctr_state->[ctr_state] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[c_current_addr_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2 RF4 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] apply RFs: RF3 +------------------PhysicalProject +--------------------filter((customer_address.ca_state = 'TN')) +----------------------PhysicalOlapScan[customer_address] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query82.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query82.out new file mode 100644 index 00000000000000..336d4fd5175339 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query82.out @@ -0,0 +1,27 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_82 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales] apply RFs: RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = inventory.inv_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalProject +----------------------------filter((inventory.inv_quantity_on_hand <= 500) and (inventory.inv_quantity_on_hand >= 100)) +------------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((item.i_current_price <= 88.00) and (item.i_current_price >= 58.00) and i_manufact_id IN (259, 485, 559, 580)) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_date <= '2001-03-14') and (date_dim.d_date >= '2001-01-13')) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query83.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query83.out new file mode 100644 index 00000000000000..bb6216b2f45c7e --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query83.out @@ -0,0 +1,80 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_83 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN colocated] hashCondition=((sr_items.item_id = wr_items.item_id)) otherCondition=() build RFs:RF13 item_id->[i_item_id,i_item_id] +------------PhysicalProject +--------------hashJoin[INNER_JOIN colocated] hashCondition=((sr_items.item_id = cr_items.item_id)) otherCondition=() build RFs:RF12 item_id->[i_item_id] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF11 i_item_sk->[sr_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[sr_returned_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_returns] apply RFs: RF10 RF11 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF9 d_date->[d_date] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF9 +------------------------------------PhysicalProject +--------------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF8 d_week_seq->[d_week_seq] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF8 +----------------------------------------PhysicalProject +------------------------------------------filter(d_date IN ('2001-07-13', '2001-09-10', '2001-11-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] apply RFs: RF12 RF13 +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_returns.cr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF7 i_item_sk->[cr_item_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[cr_returned_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF6 RF7 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF5 d_date->[d_date] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF5 +------------------------------------PhysicalProject +--------------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF4 d_week_seq->[d_week_seq] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF4 +----------------------------------------PhysicalProject +------------------------------------------filter(d_date IN ('2001-07-13', '2001-09-10', '2001-11-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] apply RFs: RF13 +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[wr_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[wr_returned_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] apply RFs: RF2 RF3 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF1 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF1 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF0 d_week_seq->[d_week_seq] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 +------------------------------------PhysicalProject +--------------------------------------filter(d_date IN ('2001-07-13', '2001-09-10', '2001-11-16')) +----------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query84.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query84.out new file mode 100644 index 00000000000000..46602027cd3688 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query84.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_84 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[sr_cdemo_sk] +------------PhysicalProject +--------------PhysicalOlapScan[store_returns] apply RFs: RF4 +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = customer.c_current_cdemo_sk)) otherCondition=() build RFs:RF3 c_current_cdemo_sk->[cd_demo_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[customer_demographics] apply RFs: RF3 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((household_demographics.hd_demo_sk = customer.c_current_hdemo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[c_current_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[c_current_addr_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer] apply RFs: RF1 RF2 +------------------------PhysicalProject +--------------------------filter((customer_address.ca_city = 'Woodland')) +----------------------------PhysicalOlapScan[customer_address] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((income_band.ib_income_band_sk = household_demographics.hd_income_band_sk)) otherCondition=() build RFs:RF0 ib_income_band_sk->[hd_income_band_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[household_demographics] apply RFs: RF0 +------------------------PhysicalProject +--------------------------filter((income_band.ib_lower_bound >= 60306) and (income_band.ib_upper_bound <= 110306)) +----------------------------PhysicalOlapScan[income_band] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query85.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query85.out new file mode 100644 index 00000000000000..27f904f559e587 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query85.out @@ -0,0 +1,46 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_85 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((reason.r_reason_sk = web_returns.wr_reason_sk)) otherCondition=() build RFs:RF9 r_reason_sk->[wr_reason_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cd1.cd_education_status = cd2.cd_education_status) and (cd1.cd_marital_status = cd2.cd_marital_status) and (cd2.cd_demo_sk = web_returns.wr_returning_cdemo_sk)) otherCondition=() build RFs:RF6 wr_returning_cdemo_sk->[cd_demo_sk];RF7 cd_marital_status->[cd_marital_status];RF8 cd_education_status->[cd_education_status] +------------------------PhysicalProject +--------------------------filter(cd_education_status IN ('Advanced Degree', 'College', 'Primary') and cd_marital_status IN ('D', 'S', 'U')) +----------------------------PhysicalOlapScan[customer_demographics(cd2)] apply RFs: RF6 RF7 RF8 +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF5 wp_web_page_sk->[ws_web_page_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = web_returns.wr_refunded_addr_sk)) otherCondition=(OR[AND[ca_state IN ('IA', 'NC', 'TX'),(web_sales.ws_net_profit >= 100.00),(web_sales.ws_net_profit <= 200.00)],AND[ca_state IN ('GA', 'WI', 'WV'),(web_sales.ws_net_profit >= 150.00)],AND[ca_state IN ('KY', 'OK', 'VA'),(web_sales.ws_net_profit <= 250.00)]]) build RFs:RF4 wr_refunded_addr_sk->[ca_address_sk] +--------------------------------PhysicalProject +----------------------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('GA', 'IA', 'KY', 'NC', 'OK', 'TX', 'VA', 'WI', 'WV')) +------------------------------------PhysicalOlapScan[customer_address] apply RFs: RF4 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cd1.cd_demo_sk = web_returns.wr_refunded_cdemo_sk)) otherCondition=(OR[AND[(cd1.cd_marital_status = 'D'),(cd1.cd_education_status = 'Primary'),(web_sales.ws_sales_price >= 100.00),(web_sales.ws_sales_price <= 150.00)],AND[(cd1.cd_marital_status = 'S'),(cd1.cd_education_status = 'College'),(web_sales.ws_sales_price <= 100.00)],AND[(cd1.cd_marital_status = 'U'),(cd1.cd_education_status = 'Advanced Degree'),(web_sales.ws_sales_price >= 150.00)]]) build RFs:RF3 cd_demo_sk->[wr_refunded_cdemo_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF1 ws_item_sk->[wr_item_sk];RF2 ws_order_number->[wr_order_number] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF1 RF2 RF3 RF9 +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +--------------------------------------------PhysicalProject +----------------------------------------------filter((web_sales.ws_net_profit <= 300.00) and (web_sales.ws_net_profit >= 50.00) and (web_sales.ws_sales_price <= 200.00) and (web_sales.ws_sales_price >= 50.00)) +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF5 +--------------------------------------------PhysicalProject +----------------------------------------------filter((date_dim.d_year = 1998)) +------------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------filter(OR[AND[(cd1.cd_marital_status = 'D'),(cd1.cd_education_status = 'Primary')],AND[(cd1.cd_marital_status = 'S'),(cd1.cd_education_status = 'College')],AND[(cd1.cd_marital_status = 'U'),(cd1.cd_education_status = 'Advanced Degree')]] and cd_education_status IN ('Advanced Degree', 'College', 'Primary') and cd_marital_status IN ('D', 'S', 'U')) +----------------------------------------PhysicalOlapScan[customer_demographics(cd1)] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_page] +--------------------PhysicalProject +----------------------PhysicalOlapScan[reason] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query86.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query86.out new file mode 100644 index 00000000000000..1633f90b97fbc0 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query86.out @@ -0,0 +1,28 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_86 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_month_seq <= 1197) and (d1.d_month_seq >= 1186)) +----------------------------------------PhysicalOlapScan[date_dim(d1)] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query87.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query87.out new file mode 100644 index 00000000000000..9f5547c4459a45 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query87.out @@ -0,0 +1,51 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_87 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------PhysicalExcept +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ss_customer_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1213) and (date_dim.d_month_seq >= 1202)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1213) and (date_dim.d_month_seq >= 1202)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1213) and (date_dim.d_month_seq >= 1202)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query88.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query88.out new file mode 100644 index 00000000000000..5da04ad61d3f42 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query88.out @@ -0,0 +1,171 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_88 -- +PhysicalResultSink +--NestedLoopJoin[CROSS_JOIN] +----NestedLoopJoin[CROSS_JOIN] +------NestedLoopJoin[CROSS_JOIN] +--------NestedLoopJoin[CROSS_JOIN] +----------NestedLoopJoin[CROSS_JOIN] +------------NestedLoopJoin[CROSS_JOIN] +--------------NestedLoopJoin[CROSS_JOIN] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF23 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF22 hd_demo_sk->[ss_hdemo_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF21 t_time_sk->[ss_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF21 RF22 RF23 +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_hour = 8) and (time_dim.t_minute >= 30)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +----------------------------------PhysicalOlapScan[household_demographics] +--------------------------PhysicalProject +----------------------------filter((store.s_store_name = 'ese')) +------------------------------PhysicalOlapScan[store] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF20 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF19 hd_demo_sk->[ss_hdemo_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF18 t_time_sk->[ss_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF18 RF19 RF20 +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_hour = 9) and (time_dim.t_minute < 30)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +----------------------------------PhysicalOlapScan[household_demographics] +--------------------------PhysicalProject +----------------------------filter((store.s_store_name = 'ese')) +------------------------------PhysicalOlapScan[store] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF17 s_store_sk->[ss_store_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF16 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF15 t_time_sk->[ss_sold_time_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF15 RF16 RF17 +--------------------------------PhysicalProject +----------------------------------filter((time_dim.t_hour = 9) and (time_dim.t_minute >= 30)) +------------------------------------PhysicalOlapScan[time_dim] +----------------------------PhysicalProject +------------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------filter((store.s_store_name = 'ese')) +----------------------------PhysicalOlapScan[store] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF14 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF13 hd_demo_sk->[ss_hdemo_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF12 t_time_sk->[ss_sold_time_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14 +------------------------------PhysicalProject +--------------------------------filter((time_dim.t_hour = 10) and (time_dim.t_minute < 30)) +----------------------------------PhysicalOlapScan[time_dim] +--------------------------PhysicalProject +----------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +------------------------------PhysicalOlapScan[household_demographics] +----------------------PhysicalProject +------------------------filter((store.s_store_name = 'ese')) +--------------------------PhysicalOlapScan[store] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF11 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF10 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF9 t_time_sk->[ss_sold_time_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF9 RF10 RF11 +----------------------------PhysicalProject +------------------------------filter((time_dim.t_hour = 10) and (time_dim.t_minute >= 30)) +--------------------------------PhysicalOlapScan[time_dim] +------------------------PhysicalProject +--------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +----------------------------PhysicalOlapScan[household_demographics] +--------------------PhysicalProject +----------------------filter((store.s_store_name = 'ese')) +------------------------PhysicalOlapScan[store] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF8 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF7 hd_demo_sk->[ss_hdemo_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF6 t_time_sk->[ss_sold_time_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 RF8 +--------------------------PhysicalProject +----------------------------filter((time_dim.t_hour = 11) and (time_dim.t_minute < 30)) +------------------------------PhysicalOlapScan[time_dim] +----------------------PhysicalProject +------------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((store.s_store_name = 'ese')) +----------------------PhysicalOlapScan[store] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF4 hd_demo_sk->[ss_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF3 t_time_sk->[ss_sold_time_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 RF4 RF5 +------------------------PhysicalProject +--------------------------filter((time_dim.t_hour = 11) and (time_dim.t_minute >= 30)) +----------------------------PhysicalOlapScan[time_dim] +--------------------PhysicalProject +----------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +------------------------PhysicalOlapScan[household_demographics] +----------------PhysicalProject +------------------filter((store.s_store_name = 'ese')) +--------------------PhysicalOlapScan[store] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF1 hd_demo_sk->[ss_hdemo_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF0 t_time_sk->[ss_sold_time_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------PhysicalProject +------------------------filter((time_dim.t_hour = 12) and (time_dim.t_minute < 30)) +--------------------------PhysicalOlapScan[time_dim] +------------------PhysicalProject +--------------------filter((household_demographics.hd_vehicle_count <= 5) and OR[AND[(household_demographics.hd_dep_count = 0),(household_demographics.hd_vehicle_count <= 2)],AND[(household_demographics.hd_dep_count = -1),(household_demographics.hd_vehicle_count <= 1)],(household_demographics.hd_dep_count = 3)] and hd_dep_count IN (-1, 0, 3)) +----------------------PhysicalOlapScan[household_demographics] +--------------PhysicalProject +----------------filter((store.s_store_name = 'ese')) +------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query89.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query89.out new file mode 100644 index 00000000000000..feceda97a51452 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query89.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_89 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------filter(( not (avg_monthly_sales = 0.0000)) and ((cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / tmp1.avg_monthly_sales) > 0.100000)) +--------------PhysicalWindow +----------------PhysicalQuickSort[LOCAL_SORT] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------filter(OR[AND[i_category IN ('Books', 'Children', 'Electronics'),i_class IN ('audio', 'history', 'school-uniforms')],AND[i_category IN ('Men', 'Shoes', 'Sports'),i_class IN ('pants', 'tennis', 'womens')]] and i_category IN ('Books', 'Children', 'Electronics', 'Men', 'Shoes', 'Sports') and i_class IN ('audio', 'history', 'pants', 'school-uniforms', 'tennis', 'womens')) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_year = 2001)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query9.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query9.out new file mode 100644 index 00000000000000..06cd8f92785e08 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query9.out @@ -0,0 +1,115 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_9 -- +PhysicalResultSink +--PhysicalDistribute[DistributionSpecGather] +----PhysicalProject +------NestedLoopJoin[CROSS_JOIN] +--------NestedLoopJoin[CROSS_JOIN] +----------NestedLoopJoin[CROSS_JOIN] +------------NestedLoopJoin[CROSS_JOIN] +--------------NestedLoopJoin[CROSS_JOIN] +----------------NestedLoopJoin[CROSS_JOIN] +------------------NestedLoopJoin[CROSS_JOIN] +--------------------NestedLoopJoin[CROSS_JOIN] +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------NestedLoopJoin[CROSS_JOIN] +--------------------------NestedLoopJoin[CROSS_JOIN] +----------------------------NestedLoopJoin[CROSS_JOIN] +------------------------------NestedLoopJoin[CROSS_JOIN] +--------------------------------NestedLoopJoin[CROSS_JOIN] +----------------------------------PhysicalProject +------------------------------------NestedLoopJoin[CROSS_JOIN] +--------------------------------------PhysicalProject +----------------------------------------filter((reason.r_reason_sk = 1)) +------------------------------------------PhysicalOlapScan[reason] +--------------------------------------hashAgg[GLOBAL] +----------------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------------hashAgg[LOCAL] +--------------------------------------------PhysicalProject +----------------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +------------------------------------------------PhysicalOlapScan[store_sales] +----------------------------------hashAgg[GLOBAL] +------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------hashAgg[LOCAL] +----------------------------------------PhysicalProject +------------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +--------------------------------------------PhysicalOlapScan[store_sales] +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +------------------------------------------PhysicalOlapScan[store_sales] +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +----------------------------------------PhysicalOlapScan[store_sales] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +--------------------------------------PhysicalOlapScan[store_sales] +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +------------------------------------PhysicalOlapScan[store_sales] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +----------------------------------PhysicalOlapScan[store_sales] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +--------------------------------PhysicalOlapScan[store_sales] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecGather] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +------------------------------PhysicalOlapScan[store_sales] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +----------------------------PhysicalOlapScan[store_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +--------------------------PhysicalOlapScan[store_sales] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +------------------------PhysicalOlapScan[store_sales] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +----------------------PhysicalOlapScan[store_sales] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +--------------------PhysicalOlapScan[store_sales] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +------------------PhysicalOlapScan[store_sales] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query90.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query90.out new file mode 100644 index 00000000000000..e5f91ba2a61448 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query90.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_90 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----PhysicalProject +------NestedLoopJoin[CROSS_JOIN] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF5 wp_web_page_sk->[ws_web_page_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF4 hd_demo_sk->[ws_ship_hdemo_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF3 t_time_sk->[ws_sold_time_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 RF4 RF5 +--------------------------PhysicalProject +----------------------------filter((time_dim.t_hour <= 13) and (time_dim.t_hour >= 12)) +------------------------------PhysicalOlapScan[time_dim] +----------------------PhysicalProject +------------------------filter((household_demographics.hd_dep_count = 6)) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((web_page.wp_char_count <= 5200) and (web_page.wp_char_count >= 5000)) +----------------------PhysicalOlapScan[web_page] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF2 wp_web_page_sk->[ws_web_page_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF1 hd_demo_sk->[ws_ship_hdemo_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF0 t_time_sk->[ws_sold_time_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 +--------------------------PhysicalProject +----------------------------filter((time_dim.t_hour <= 15) and (time_dim.t_hour >= 14)) +------------------------------PhysicalOlapScan[time_dim] +----------------------PhysicalProject +------------------------filter((household_demographics.hd_dep_count = 6)) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((web_page.wp_char_count <= 5200) and (web_page.wp_char_count >= 5000)) +----------------------PhysicalOlapScan[web_page] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query91.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query91.out new file mode 100644 index 00000000000000..25542328573fbd --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query91.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_91 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF5 cc_call_center_sk->[cr_call_center_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cr_returned_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returning_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cr_returning_customer_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF3 RF4 RF5 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 c_current_addr_sk->[ca_address_sk] +--------------------------------PhysicalProject +----------------------------------filter((customer_address.ca_gmt_offset = -7.00)) +------------------------------------PhysicalOlapScan[customer_address] apply RFs: RF2 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((household_demographics.hd_demo_sk = customer.c_current_hdemo_sk)) otherCondition=() build RFs:RF1 hd_demo_sk->[c_current_hdemo_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = customer.c_current_cdemo_sk)) otherCondition=() build RFs:RF0 cd_demo_sk->[c_current_cdemo_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 RF1 +----------------------------------------PhysicalProject +------------------------------------------filter(OR[AND[(customer_demographics.cd_marital_status = 'M'),(customer_demographics.cd_education_status = 'Unknown')],AND[(customer_demographics.cd_marital_status = 'W'),(customer_demographics.cd_education_status = 'Advanced Degree')]] and cd_education_status IN ('Advanced Degree', 'Unknown') and cd_marital_status IN ('M', 'W')) +--------------------------------------------PhysicalOlapScan[customer_demographics] +------------------------------------PhysicalProject +--------------------------------------filter((hd_buy_potential like 'Unknown%')) +----------------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalOlapScan[call_center] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query92.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query92.out new file mode 100644 index 00000000000000..f44949b6b8cece --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query92.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_92 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------filter((cast(ws_ext_discount_amt as DECIMALV3(38, 5)) > (1.3 * avg(ws_ext_discount_amt) OVER(PARTITION BY i_item_sk)))) +--------------PhysicalWindow +----------------PhysicalQuickSort[LOCAL_SORT] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ws_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +----------------------------PhysicalProject +------------------------------filter((item.i_manufact_id = 714)) +--------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter((date_dim.d_date <= '2000-05-01') and (date_dim.d_date >= '2000-02-01')) +----------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query93.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query93.out new file mode 100644 index 00000000000000..5a99fd09e06b91 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query93.out @@ -0,0 +1,21 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_93 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_returns.sr_item_sk = store_sales.ss_item_sk) and (store_returns.sr_ticket_number = store_sales.ss_ticket_number)) otherCondition=() build RFs:RF1 sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_reason_sk = reason.r_reason_sk)) otherCondition=() build RFs:RF0 r_reason_sk->[sr_reason_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 +----------------------PhysicalProject +------------------------filter((reason.r_reason_desc = 'reason 58')) +--------------------------PhysicalOlapScan[reason] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query94.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query94.out new file mode 100644 index 00000000000000..78bc76f63ea747 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query94.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_94 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[DISTINCT_GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[DISTINCT_LOCAL] +------------hashAgg[GLOBAL] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[RIGHT_SEMI_JOIN shuffleBucket] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF4 ws_order_number->[ws_order_number] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_sales(ws2)] apply RFs: RF4 +--------------------hashJoin[RIGHT_ANTI_JOIN shuffle] hashCondition=((ws1.ws_order_number = wr1.wr_order_number)) otherCondition=() build RFs:RF3 ws_order_number->[wr_order_number] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_returns(wr1)] apply RFs: RF3 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF2 web_site_sk->[ws_web_site_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[ws_ship_addr_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales(ws1)] apply RFs: RF0 RF1 RF2 +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_state = 'OK')) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '2002-06-30') and (date_dim.d_date >= '2002-05-01')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((web_site.web_company_name = 'pri')) +------------------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query95.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query95.out new file mode 100644 index 00000000000000..058b68aa677160 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query95.out @@ -0,0 +1,44 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_95 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashJoin[INNER_JOIN shuffle] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number] +--------PhysicalProject +----------PhysicalOlapScan[web_sales(ws1)] apply RFs: RF0 RF7 +--------PhysicalProject +----------PhysicalOlapScan[web_sales(ws2)] apply RFs: RF7 +--PhysicalResultSink +----PhysicalLimit[GLOBAL] +------PhysicalLimit[LOCAL] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------hashJoin[RIGHT_SEMI_JOIN colocated] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[wr_order_number,ws_order_number] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number] +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 +--------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales(ws1)] apply RFs: RF1 RF2 RF3 +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_state = 'VA')) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '2001-05-31') and (date_dim.d_date >= '2001-04-01')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((web_site.web_company_name = 'pri')) +------------------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query96.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query96.out new file mode 100644 index 00000000000000..7e3d08cf2617a5 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query96.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_96 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF1 hd_demo_sk->[ss_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF0 t_time_sk->[ss_sold_time_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------PhysicalProject +--------------------------filter((time_dim.t_hour = 8) and (time_dim.t_minute >= 30)) +----------------------------PhysicalOlapScan[time_dim] +--------------------PhysicalProject +----------------------filter((household_demographics.hd_dep_count = 0)) +------------------------PhysicalOlapScan[household_demographics] +----------------PhysicalProject +------------------filter((store.s_store_name = 'ese')) +--------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query97.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query97.out new file mode 100644 index 00000000000000..d3a845763241f7 --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query97.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_97 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[FULL_OUTER_JOIN colocated] hashCondition=((ssci.customer_sk = csci.customer_sk) and (ssci.item_sk = csci.item_sk)) otherCondition=() +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------filter(( not ss_sold_date_sk IS NULL)) +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +----------------------------PhysicalProject +------------------------------filter(( not cs_sold_date_sk IS NULL)) +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) +--------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query98.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query98.out new file mode 100644 index 00000000000000..beb47b1d23d9dd --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query98.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_98 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_date <= '1999-03-07') and (date_dim.d_date >= '1999-02-05')) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter(i_category IN ('Jewelry', 'Men', 'Sports')) +------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query99.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query99.out new file mode 100644 index 00000000000000..de639b9015342e --- /dev/null +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query99.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_99 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF3 cc_call_center_sk->[cs_call_center_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF2 sm_ship_mode_sk->[cs_ship_mode_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF1 w_warehouse_sk->[cs_warehouse_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_ship_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1205) and (date_dim.d_month_seq >= 1194)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[warehouse] +----------------------PhysicalProject +------------------------PhysicalOlapScan[ship_mode] +------------------PhysicalProject +--------------------PhysicalOlapScan[call_center] + diff --git a/regression-test/data/shape_check/tpch_sf1000/hint/q10.out b/regression-test/data/shape_check/tpch_sf1000/hint/q10.out index 6401919d9fa3e0..4c51f9cfec6ae4 100644 --- a/regression-test/data/shape_check/tpch_sf1000/hint/q10.out +++ b/regression-test/data/shape_check/tpch_sf1000/hint/q10.out @@ -9,9 +9,10 @@ PhysicalResultSink ------------hashAgg[LOCAL] --------------PhysicalProject ----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() -------------------PhysicalProject ---------------------filter((lineitem.l_returnflag = 'R')) -----------------------PhysicalOlapScan[lineitem] +------------------hashAgg[GLOBAL] +--------------------PhysicalProject +----------------------filter((lineitem.l_returnflag = 'R')) +------------------------PhysicalOlapScan[lineitem] ------------------PhysicalProject --------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_nationkey = nation.n_nationkey)) otherCondition=() ----------------------PhysicalProject diff --git a/regression-test/data/shape_check/tpch_sf1000/hint/q3.out b/regression-test/data/shape_check/tpch_sf1000/hint/q3.out index d4cf366b41a7d2..fa0190006f1946 100644 --- a/regression-test/data/shape_check/tpch_sf1000/hint/q3.out +++ b/regression-test/data/shape_check/tpch_sf1000/hint/q3.out @@ -7,9 +7,10 @@ PhysicalResultSink --------hashAgg[GLOBAL] ----------PhysicalProject ------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() ---------------PhysicalProject -----------------filter((lineitem.l_shipdate > '1995-03-15')) -------------------PhysicalOlapScan[lineitem] +--------------hashAgg[GLOBAL] +----------------PhysicalProject +------------------filter((lineitem.l_shipdate > '1995-03-15')) +--------------------PhysicalOlapScan[lineitem] --------------PhysicalProject ----------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() ------------------PhysicalProject diff --git a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q10.out b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q10.out index 860280d12dd4cb..dd24288ff8772a 100644 --- a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q10.out +++ b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q10.out @@ -5,20 +5,23 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------hashAgg[GLOBAL] -----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_nationkey = nation.n_nationkey)) otherCondition=() +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] --------------PhysicalProject -----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF1 o_custkey->[c_custkey] +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_nationkey = nation.n_nationkey)) otherCondition=() ------------------PhysicalProject ---------------------PhysicalOlapScan[customer] apply RFs: RF1 -------------------PhysicalProject ---------------------hashJoin[INNER_JOIN colocated] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF0 o_orderkey->[l_orderkey] -----------------------PhysicalProject -------------------------filter((lineitem.l_returnflag = 'R')) ---------------------------PhysicalOlapScan[lineitem] apply RFs: RF0 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF1 o_orderkey->[l_orderkey] +----------------------hashAgg[GLOBAL] +------------------------PhysicalProject +--------------------------filter((lineitem.l_returnflag = 'R')) +----------------------------PhysicalOlapScan[lineitem] apply RFs: RF1 ----------------------PhysicalProject -------------------------filter((orders.o_orderdate < '1994-01-01') and (orders.o_orderdate >= '1993-10-01')) ---------------------------PhysicalOlapScan[orders] ---------------PhysicalProject -----------------PhysicalOlapScan[nation] +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF0 o_custkey->[c_custkey] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] apply RFs: RF0 +--------------------------PhysicalProject +----------------------------filter((orders.o_orderdate < '1994-01-01') and (orders.o_orderdate >= '1993-10-01')) +------------------------------PhysicalOlapScan[orders] +------------------PhysicalProject +--------------------PhysicalOlapScan[nation] diff --git a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q3.out b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q3.out index 3474f8dcf010c3..4b45fb5d8de73b 100644 --- a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q3.out +++ b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q3.out @@ -7,9 +7,10 @@ PhysicalResultSink --------hashAgg[GLOBAL] ----------PhysicalProject ------------hashJoin[INNER_JOIN colocated] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF1 o_orderkey->[l_orderkey] ---------------PhysicalProject -----------------filter((lineitem.l_shipdate > '1995-03-15')) -------------------PhysicalOlapScan[lineitem] apply RFs: RF1 +--------------hashAgg[GLOBAL] +----------------PhysicalProject +------------------filter((lineitem.l_shipdate > '1995-03-15')) +--------------------PhysicalOlapScan[lineitem] apply RFs: RF1 --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF0 c_custkey->[o_custkey] ------------------PhysicalProject diff --git a/regression-test/data/shape_check/tpch_sf1000/shape/q10.out b/regression-test/data/shape_check/tpch_sf1000/shape/q10.out index 952ec22ca66935..cf4f3a3ed8d63d 100644 --- a/regression-test/data/shape_check/tpch_sf1000/shape/q10.out +++ b/regression-test/data/shape_check/tpch_sf1000/shape/q10.out @@ -5,20 +5,23 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------hashAgg[GLOBAL] -----------PhysicalProject -------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_nationkey = nation.n_nationkey)) otherCondition=() build RFs:RF2 n_nationkey->[c_nationkey] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] --------------PhysicalProject -----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF1 o_custkey->[c_custkey] +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_nationkey = nation.n_nationkey)) otherCondition=() build RFs:RF2 n_nationkey->[c_nationkey] ------------------PhysicalProject ---------------------PhysicalOlapScan[customer] apply RFs: RF1 RF2 -------------------PhysicalProject ---------------------hashJoin[INNER_JOIN colocated] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF0 o_orderkey->[l_orderkey] -----------------------PhysicalProject -------------------------filter((lineitem.l_returnflag = 'R')) ---------------------------PhysicalOlapScan[lineitem] apply RFs: RF0 +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF1 o_orderkey->[l_orderkey] +----------------------hashAgg[GLOBAL] +------------------------PhysicalProject +--------------------------filter((lineitem.l_returnflag = 'R')) +----------------------------PhysicalOlapScan[lineitem] apply RFs: RF1 ----------------------PhysicalProject -------------------------filter((orders.o_orderdate < '1994-01-01') and (orders.o_orderdate >= '1993-10-01')) ---------------------------PhysicalOlapScan[orders] ---------------PhysicalProject -----------------PhysicalOlapScan[nation] +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF0 o_custkey->[c_custkey] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] apply RFs: RF0 RF2 +--------------------------PhysicalProject +----------------------------filter((orders.o_orderdate < '1994-01-01') and (orders.o_orderdate >= '1993-10-01')) +------------------------------PhysicalOlapScan[orders] +------------------PhysicalProject +--------------------PhysicalOlapScan[nation] diff --git a/regression-test/data/shape_check/tpch_sf1000/shape/q13.out b/regression-test/data/shape_check/tpch_sf1000/shape/q13.out index ab30427a698a90..a9c26e203f3c44 100644 --- a/regression-test/data/shape_check/tpch_sf1000/shape/q13.out +++ b/regression-test/data/shape_check/tpch_sf1000/shape/q13.out @@ -10,10 +10,13 @@ PhysicalResultSink --------------PhysicalProject ----------------hashAgg[GLOBAL] ------------------PhysicalProject ---------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF0 c_custkey->[o_custkey] -----------------------PhysicalProject -------------------------filter(( not (o_comment like '%special%requests%'))) ---------------------------PhysicalOlapScan[orders] apply RFs: RF0 +--------------------hashJoin[LEFT_OUTER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() ----------------------PhysicalProject ------------------------PhysicalOlapScan[customer] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(( not (o_comment like '%special%requests%'))) +--------------------------------PhysicalOlapScan[orders] diff --git a/regression-test/data/shape_check/tpch_sf1000/shape/q3.out b/regression-test/data/shape_check/tpch_sf1000/shape/q3.out index 3474f8dcf010c3..4b45fb5d8de73b 100644 --- a/regression-test/data/shape_check/tpch_sf1000/shape/q3.out +++ b/regression-test/data/shape_check/tpch_sf1000/shape/q3.out @@ -7,9 +7,10 @@ PhysicalResultSink --------hashAgg[GLOBAL] ----------PhysicalProject ------------hashJoin[INNER_JOIN colocated] hashCondition=((lineitem.l_orderkey = orders.o_orderkey)) otherCondition=() build RFs:RF1 o_orderkey->[l_orderkey] ---------------PhysicalProject -----------------filter((lineitem.l_shipdate > '1995-03-15')) -------------------PhysicalOlapScan[lineitem] apply RFs: RF1 +--------------hashAgg[GLOBAL] +----------------PhysicalProject +------------------filter((lineitem.l_shipdate > '1995-03-15')) +--------------------PhysicalOlapScan[lineitem] apply RFs: RF1 --------------PhysicalProject ----------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() build RFs:RF0 c_custkey->[o_custkey] ------------------PhysicalProject diff --git a/regression-test/suites/nereids_p0/eager_agg/eager_agg.groovy b/regression-test/suites/nereids_p0/eager_agg/eager_agg.groovy new file mode 100644 index 00000000000000..83b2e531c7bcb2 --- /dev/null +++ b/regression-test/suites/nereids_p0/eager_agg/eager_agg.groovy @@ -0,0 +1,435 @@ +// 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("eager_agg") { + sql """ + set eager_aggregation_mode=1; + set eager_aggregation_on_join=true; + set runtime_filter_mode=OFF; + set broadcast_row_count_limit=-1; + set disable_nereids_rules="SALT_JOIN"; + """ + + // push to ss-join-ws + qt_a """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price) brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_a_exe""" + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price) brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push to ss-join-ws + qt_a2 """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price + ss_sales_price) brand + + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_a2_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price + ss_sales_price) brand + + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push sum/min/max aggFunc + qt_sum_min_max """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price) brand + ,min(ss_sales_price) min_agg + ,max(ss_sales_price) max_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_sum_min_max_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,sum(ws_list_price) brand + ,min(ss_sales_price) min_agg + ,max(ss_sales_price) max_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // do not push avg aggFunc + qt_avg """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,avg(ws_list_price) + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_avg_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,avg(ws_list_price) + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push count(column) - count should be pushed down and converted to sum at top level + qt_count_column """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(ws_list_price) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + order_qt_count_column_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(ws_list_price) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push count(*) - count(*) should be pushed down and converted to sum at top level + qt_count_star """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(*) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_count_star_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(*) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // do not push count(distinct column) - distinct aggregation should not be pushed + qt_count_distinct """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(distinct ws_list_price) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + order_qt_count_distinct_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(distinct ws_list_price) cnt + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push count with sum - mixed aggregation + qt_count_sum_mixed """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(ws_list_price) cnt + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + qt_count_sum_mixed_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(ws_list_price) cnt + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // push count(*) with sum - both should be pushed down + qt_count_star_sum_mixed """ + explain shape plan + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(*) cnt + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + order_qt_count_star_sum_mixed_exe """ + select /*+leading({ss ws} dt)*/ dt.d_year + ,count(*) cnt + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales ss + ,web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year + """ + + // agg push to ss-d + qt_groupkey_push_SS_JOIN_D """ + explain shape plan + select /*+leading({ss dt} ws)*/ dt.d_year + ,sum(ss_wholesale_cost) brand + ,sum(ss_sales_price + d_moy) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year, ss_hdemo_sk + ws_quantity + """ + + order_qt_groupkey_push_SS_JOIN_D_exe """ + select /*+leading({ss dt} ws)*/ dt.d_year + ,sum(ss_wholesale_cost) brand + ,sum(ss_sales_price + d_moy) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year, ss_hdemo_sk + ws_quantity + """ + + // group key: ss_hdemo_sk + d_moy => push to ss-d + qt_groupkey_push """ + explain shape plan + select /*+leading({ss dt} ws)*/ dt.d_year + ,sum(ss_wholesale_cost) brand + ,sum(ss_sales_price) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year, ss_hdemo_sk + d_moy + """ + + order_qt_groupkey_push_exe """ + select /*+leading({ss dt} ws)*/ dt.d_year + ,sum(ss_wholesale_cost) brand + ,sum(ss_sales_price) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by dt.d_year, ss_hdemo_sk + d_moy + """ + + qt_sum_if_push """ + explain shape plan + select /*+leading({web_sales item} date_dim)*/ d_week_seq, + sum(case when (d_day_name='Monday') then ws_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ws_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ws_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ws_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ws_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ws_sales_price else null end) sat_sales + from web_sales join item on ws_item_sk = i_item_sk + join date_dim on d_date_sk = ws_sold_date_sk + group by d_week_seq, ws_item_sk; + """ + + order_qt_sum_if_push_exe """ + select /*+leading({web_sales item} date_dim)*/ d_week_seq, + sum(case when (d_day_name='Monday') then ws_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ws_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ws_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ws_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ws_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ws_sales_price else null end) sat_sales + from web_sales join item on ws_item_sk = i_item_sk + join date_dim on d_date_sk = ws_sold_date_sk + group by d_week_seq, ws_item_sk; + """ + + qt_check_case_when_outer_join_not_push """ + explain shape plan + select /*+SET_VAR(eager_aggregation_mode=1, disable_join_reorder = true)*/ a + ss_sales_price + from ( + select sum(case when ss_item_sk =1 then 1 else 0 end) a, ss_sales_price + from store_sales + right join date_dim on d_date_sk = ss_sold_date_sk + group by ss_sales_price + )t; + """ + + qt_check_no_case_when_outer_join_push """ + explain shape plan + select /*+SET_VAR(eager_aggregation_mode=1, disable_join_reorder = true)*/ a + ss_sales_price + from ( + select sum(ss_item_sk =1) a, ss_sales_price + from store_sales + right join date_dim on d_date_sk = ss_sold_date_sk + group by ss_sales_price + )t; + """ + + qt_check_no_push_value_slots_contains_if_slots """ + explain shape plan + select /*+SET_VAR(eager_aggregation_mode=1, disable_join_reorder = false)*/ + sum(case when ss_item_sk =1 then ss_item_sk else 0 end) a + from store_sales + join date_dim on d_date_sk = ss_sold_date_sk + group by d_year; + """ + + + qt_min_sum_same_slot """ + explain shape plan + select /*+leading({ss dt} ws)*/ dt.d_moy + ,min(d_year) brand + ,sum(d_year) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by d_moy + having brand is null; + """ + + order_qt_min_sum_same_slot_exe """ + select /*+leading({ss dt} ws)*/ dt.d_moy + ,min(d_year) brand + ,sum(d_year) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by d_moy + having brand is null; + """ + + order_qt_sum_min_same_slot_exe """ + select /*+leading({ss dt} ws)*/ dt.d_moy + ,sum(d_year) sum_agg + ,min(d_year) brand + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by d_moy + having brand is null; + """ + + qt_no_push_aggkey_groupKey_overlap """ + explain shape plan + select /*+leading({ss dt} ws)*/ dt.d_year + ,min(d_year) brand + ,sum(d_year) sum_agg + from store_sales ss + join date_dim dt + join web_sales ws + where dt.d_date_sk = ss_sold_date_sk + and ss_item_sk = ws_item_sk + group by d_year + """ + + // if any union child can not push, do not push for all union children + qt_no_push_not_all_union_children_push """ + explain shape plan + select d_year + ,min(d_moy) + ,sum(d_moy) + from ( + select /*+leading({ss dt})*/ d_year, d_moy + from store_sales ss + join date_dim dt on dt.d_date_sk = ss_sold_date_sk + union all + select d_year, d_moy + from date_dim + ) t + group by d_year; + """ +} diff --git a/regression-test/suites/nereids_p0/eager_agg/load.groovy b/regression-test/suites/nereids_p0/eager_agg/load.groovy new file mode 100644 index 00000000000000..6a1ae59cd4ed3f --- /dev/null +++ b/regression-test/suites/nereids_p0/eager_agg/load.groovy @@ -0,0 +1,299 @@ + +// 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("load") { + sql """ + drop table if exists store_sales; + drop table if exists date_dim; + drop table if exists web_sales; + + CREATE TABLE `store_sales` ( + `ss_sold_date_sk` bigint NULL, + `ss_sold_time_sk` bigint NULL, + `ss_item_sk` bigint NULL, + `ss_customer_sk` bigint NULL, + `ss_cdemo_sk` bigint NULL, + `ss_hdemo_sk` bigint NULL, + `ss_addr_sk` bigint NULL, + `ss_store_sk` bigint NULL, + `ss_promo_sk` bigint NULL, + `ss_ticket_number` bigint NULL, + `ss_quantity` int NULL, + `ss_wholesale_cost` decimal(7,2) NULL, + `ss_list_price` decimal(7,2) NULL, + `ss_sales_price` decimal(7,2) NULL, + `ss_ext_discount_amt` decimal(7,2) NULL, + `ss_ext_sales_price` decimal(7,2) NULL, + `ss_ext_wholesale_cost` decimal(7,2) NULL, + `ss_ext_list_price` decimal(7,2) NULL, + `ss_ext_tax` decimal(7,2) NULL, + `ss_coupon_amt` decimal(7,2) NULL, + `ss_net_paid` decimal(7,2) NULL, + `ss_net_paid_inc_tax` decimal(7,2) NULL, + `ss_net_profit` decimal(7,2) NULL +) ENGINE=OLAP +DUPLICATE KEY(`ss_sold_date_sk`, `ss_sold_time_sk`, `ss_item_sk`, `ss_customer_sk`) +DISTRIBUTED BY HASH(`ss_customer_sk`) BUCKETS 3 +PROPERTIES ( +"replication_allocation" = "tag.location.default: 1", +"min_load_replica_num" = "-1", +"is_being_synced" = "false", +"storage_medium" = "hdd", +"storage_format" = "V2", +"inverted_index_storage_format" = "V3", +"light_schema_change" = "true", +"disable_auto_compaction" = "false", +"enable_single_replica_compaction" = "false", +"group_commit_interval_ms" = "10000", +"group_commit_data_bytes" = "134217728" +); + +CREATE TABLE `date_dim` ( + `d_date_sk` bigint NULL, + `d_date_id` char(16) NULL, + `d_date` date NULL, + `d_month_seq` int NULL, + `d_week_seq` int NULL, + `d_quarter_seq` int NULL, + `d_year` int NULL, + `d_dow` int NULL, + `d_moy` int NULL, + `d_dom` int NULL, + `d_qoy` int NULL, + `d_fy_year` int NULL, + `d_fy_quarter_seq` int NULL, + `d_fy_week_seq` int NULL, + `d_day_name` char(9) NULL, + `d_quarter_name` char(6) NULL, + `d_holiday` char(1) NULL, + `d_weekend` char(1) NULL, + `d_following_holiday` char(1) NULL, + `d_first_dom` int NULL, + `d_last_dom` int NULL, + `d_same_day_ly` int NULL, + `d_same_day_lq` int NULL, + `d_current_day` char(1) NULL, + `d_current_week` char(1) NULL, + `d_current_month` char(1) NULL, + `d_current_quarter` char(1) NULL, + `d_current_year` char(1) NULL +) ENGINE=OLAP +DUPLICATE KEY(`d_date_sk`, `d_date_id`) +DISTRIBUTED BY RANDOM BUCKETS 3 +PROPERTIES ( +"replication_allocation" = "tag.location.default: 1" +); + +CREATE TABLE `web_sales` ( + `ws_sold_date_sk` bigint NULL, + `ws_sold_time_sk` bigint NULL, + `ws_ship_date_sk` bigint NULL, + `ws_item_sk` bigint NULL, + `ws_bill_customer_sk` bigint NULL, + `ws_bill_cdemo_sk` bigint NULL, + `ws_bill_hdemo_sk` bigint NULL, + `ws_bill_addr_sk` bigint NULL, + `ws_ship_customer_sk` bigint NULL, + `ws_ship_cdemo_sk` bigint NULL, + `ws_ship_hdemo_sk` bigint NULL, + `ws_ship_addr_sk` bigint NULL, + `ws_web_page_sk` bigint NULL, + `ws_web_site_sk` bigint NULL, + `ws_ship_mode_sk` bigint NULL, + `ws_warehouse_sk` bigint NULL, + `ws_promo_sk` bigint NULL, + `ws_order_number` bigint NULL, + `ws_quantity` int NULL, + `ws_wholesale_cost` decimal(7,2) NULL, + `ws_list_price` decimal(7,2) NULL, + `ws_sales_price` decimal(7,2) NULL, + `ws_ext_discount_amt` decimal(7,2) NULL, + `ws_ext_sales_price` decimal(7,2) NULL, + `ws_ext_wholesale_cost` decimal(7,2) NULL, + `ws_ext_list_price` decimal(7,2) NULL, + `ws_ext_tax` decimal(7,2) NULL, + `ws_coupon_amt` decimal(7,2) NULL, + `ws_ext_ship_cost` decimal(7,2) NULL, + `ws_net_paid` decimal(7,2) NULL, + `ws_net_paid_inc_tax` decimal(7,2) NULL, + `ws_net_paid_inc_ship` decimal(7,2) NULL, + `ws_net_paid_inc_ship_tax` decimal(7,2) NULL, + `ws_net_profit` decimal(7,2) NULL +) ENGINE=OLAP +DUPLICATE KEY(`ws_sold_date_sk`, `ws_sold_time_sk`, `ws_ship_date_sk`, `ws_item_sk`) +DISTRIBUTED BY RANDOM BUCKETS 4 +PROPERTIES ( +"replication_allocation" = "tag.location.default: 1" +); + +drop table if exists item; +CREATE TABLE `item` ( + `i_item_sk` bigint NULL, + `i_item_id` char(16) NULL, + `i_rec_start_date` date NULL, + `i_rec_end_date` date NULL, + `i_item_desc` varchar(200) NULL, + `i_current_price` decimal(7,2) NULL, + `i_wholesale_cost` decimal(7,2) NULL, + `i_brand_id` int NULL, + `i_brand` char(50) NULL, + `i_class_id` int NULL, + `i_class` char(50) NULL, + `i_category_id` int NULL, + `i_category` char(50) NULL, + `i_manufact_id` int NULL, + `i_manufact` char(50) NULL, + `i_size` char(20) NULL, + `i_formulation` char(20) NULL, + `i_color` char(20) NULL, + `i_units` char(10) NULL, + `i_container` char(10) NULL, + `i_manager_id` int NULL, + `i_product_name` char(50) NULL +) ENGINE=OLAP +DUPLICATE KEY(`i_item_sk`, `i_item_id`) +DISTRIBUTED BY RANDOM BUCKETS 5 +PROPERTIES ( +"replication_allocation" = "tag.location.default: 1" +); + +-- Insert store_sales data +-- Join conditions: dt.d_date_sk = ss_sold_date_sk AND ss_item_sk = ws_item_sk +INSERT INTO store_sales ( + ss_sold_date_sk, ss_sold_time_sk, ss_item_sk, ss_customer_sk, ss_cdemo_sk, ss_hdemo_sk, + ss_addr_sk, ss_store_sk, ss_promo_sk, ss_ticket_number, ss_quantity, + ss_wholesale_cost, ss_list_price, ss_sales_price, ss_ext_discount_amt, + ss_ext_sales_price, ss_ext_wholesale_cost, ss_ext_list_price, ss_ext_tax, + ss_coupon_amt, ss_net_paid, ss_net_paid_inc_tax, ss_net_profit +) VALUES + -- Row 1: d_year=2024, item_sk=1001 + (1, 36000, 1001, 501, 601, 701, + 801, 901, 10001, 55500001, 2, + 10.00, 12.00, 11.00, 2.00, + 22.00, 20.00, 24.00, 1.54, + 0.00, 22.00, 23.54, 3.54), + -- Row 2: d_year=2024, item_sk=1001 + (1, 36001, 1001, 502, 602, 702, + 802, 902, 10002, 55500002, 3, + 15.00, 18.00, 16.00, 3.00, + 48.00, 45.00, 54.00, 3.36, + 0.00, 48.00, 51.36, 6.36), + -- Row 3: d_year=2025, item_sk=1002 + (2, 36002, 1002, 503, 603, 703, + 803, 903, 10003, 55500003, 5, + 20.00, 25.00, 22.00, 5.00, + 110.00, 100.00, 125.00, 7.70, + 0.00, 110.00, 117.70, 17.70), + -- Row 4: d_year=2025, item_sk=1002 + (2, 36003, 1002, 504, 604, 704, + 804, 904, 10004, 55500004, 4, + 18.00, 22.00, 20.00, 4.00, + 80.00, 72.00, 88.00, 5.60, + 0.00, 80.00, 85.60, 13.60); + +-- Insert date_dim data with different d_year and d_day_name values +INSERT INTO date_dim ( + d_date_sk, d_date_id, d_date, d_month_seq, d_week_seq, d_quarter_seq, d_year, + d_dow, d_moy, d_dom, d_qoy, d_fy_year, d_fy_quarter_seq, d_fy_week_seq, + d_day_name, d_quarter_name, d_holiday, d_weekend, d_following_holiday, + d_first_dom, d_last_dom, d_same_day_ly, d_same_day_lq, + d_current_day, d_current_week, d_current_month, d_current_quarter, d_current_year +) VALUES + -- d_date_sk=1, d_year=2024, Monday + (1, '2024-01-01', '2024-01-01', 1, 1, 1, 2024, + 1, 1, 1, 1, 2024, 1, 1, + 'Monday', 'Q1', 'N', 'N', 'N', + 1, 31, 20230101, 20231001, + 'Y', 'Y', 'Y', 'Y', 'Y'), + -- d_date_sk=2, d_year=2025, Tuesday + (2, '2025-01-07', '2025-01-07', 13, 2, 5, 2025, + 2, 1, 7, 1, 2025, 5, 2, + 'Tuesday', 'Q1', 'N', 'N', 'N', + 1, 31, 20240107, 20241007, + 'Y', 'Y', 'Y', 'Y', 'Y'), + -- d_date_sk=3, d_year=2024, Wednesday + (3, '2024-01-03', '2024-01-03', 1, 1, 1, 2024, + 3, 1, 3, 1, 2024, 1, 1, + 'Wednesday', 'Q1', 'N', 'N', 'N', + 1, 31, 20230103, 20231003, + 'Y', 'Y', 'Y', 'Y', 'Y'); + +-- Insert web_sales data +-- Join conditions: ss_item_sk = ws_item_sk AND d_date_sk = ws_sold_date_sk +INSERT INTO web_sales ( + ws_sold_date_sk, ws_sold_time_sk, ws_ship_date_sk, ws_item_sk, + ws_bill_customer_sk, ws_bill_cdemo_sk, ws_bill_hdemo_sk, ws_bill_addr_sk, + ws_ship_customer_sk, ws_ship_cdemo_sk, ws_ship_hdemo_sk, ws_ship_addr_sk, + ws_web_page_sk, ws_web_site_sk, ws_ship_mode_sk, ws_warehouse_sk, ws_promo_sk, + ws_order_number, ws_quantity, ws_wholesale_cost, ws_list_price, ws_sales_price, + ws_ext_discount_amt, ws_ext_sales_price, ws_ext_wholesale_cost, ws_ext_list_price, + ws_ext_tax, ws_coupon_amt, ws_ext_ship_cost, ws_net_paid, ws_net_paid_inc_tax, + ws_net_paid_inc_ship, ws_net_paid_inc_ship_tax, ws_net_profit +) VALUES + -- Row 1: item_sk=1001 (matches store_sales), sold_date_sk=1 + (1, 43200, 3, 1001, + 601, 701, 801, 901, + 602, 702, 802, 902, + 3001, 4001, 5001, 6001, 7001, + 8800001, 3, 15.00, 18.00, 16.50, + 4.50, 49.50, 45.00, 54.00, + 3.47, 0.00, 5.00, 49.50, 52.97, + 54.50, 58.00, 7.97), + -- Row 2: item_sk=1001 (matches store_sales), sold_date_sk=1 + (1, 43201, 3, 1001, + 602, 702, 802, 902, + 603, 703, 803, 903, + 3002, 4002, 5002, 6002, 7002, + 8800002, 2, 12.00, 15.00, 14.00, + 2.00, 28.00, 24.00, 30.00, + 1.96, 0.00, 3.00, 28.00, 29.96, + 31.00, 33.00, 5.96), + -- Row 3: item_sk=1002 (matches store_sales row 3,4), sold_date_sk=2 + (2, 43202, 4, 1002, + 603, 703, 803, 903, + 604, 704, 804, 904, + 3003, 4003, 5003, 6003, 7003, + 8800003, 4, 20.00, 25.00, 22.00, + 6.00, 88.00, 80.00, 100.00, + 6.16, 0.00, 8.00, 88.00, 94.16, + 96.00, 102.00, 14.16); + +-- Insert item data +INSERT INTO item ( + i_item_sk, i_item_id, i_rec_start_date, i_rec_end_date, + i_item_desc, i_current_price, i_wholesale_cost, + i_brand_id, i_brand, i_class_id, i_class, + i_category_id, i_category, i_manufact_id, i_manufact, + i_size, i_formulation, i_color, i_units, i_container, + i_manager_id, i_product_name +) VALUES + (1001, 'ITEM-0001001', '2024-01-01', NULL, + 'Sample item 1001', 12.00, 10.00, + 10, 'BrandA', 101, 'ClassA', + 201, 'CategoryA', 301, 'ManufactA', + 'M', 'Std', 'Red', 'EA', 'BOX', + 1, 'Product 1001'), + (1002, 'ITEM-0001002', '2024-01-01', NULL, + 'Sample item 1002', 25.00, 20.00, + 10, 'BrandA', 101, 'ClassA', + 201, 'CategoryA', 301, 'ManufactA', + 'L', 'Std', 'Green', 'EA', 'BOX', + 1, 'Product 1002'); +""" +} + diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/basic.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/basic.groovy deleted file mode 100644 index e37e9a65da11cb..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/basic.groovy +++ /dev/null @@ -1,203 +0,0 @@ -// 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("basic") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - - sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" - sql "set disable_join_reorder=true;" - sql """ - DROP TABLE IF EXISTS shunt_log_com_dd_library; - """ - sql """ - DROP TABLE IF EXISTS com_dd_library; - """ - - sql""" - CREATE TABLE `shunt_log_com_dd_library` ( - `device_id` varchar(255) NOT NULL, - `experiment_id` varchar(255) NOT NULL, - `group_id` varchar(255) NOT NULL - ) ENGINE=OLAP - DUPLICATE KEY(`device_id`) - DISTRIBUTED BY HASH(`device_id`) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - sql""" - CREATE TABLE `com_dd_library` ( - `event_id` varchar(255) NULL, - `device_id` varchar(255) NULL DEFAULT "", - `time_stamp` datetime NULL - ) ENGINE=OLAP - DUPLICATE KEY(`event_id`) - DISTRIBUTED BY HASH(`device_id`) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - qt_1 """ - explain shape plan - select - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - a.event_id = "ad_click" - and b.experiment_id = 37 - group by - b.group_id; - """ - - qt_2 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_3 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id), - date_format(a.time_stamp, '%Y-%m-%d') as dayF - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id, - dayF; - """ - - qt_4 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_with_hint_1 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join, push_down_agg_through_join_one_side) */ - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - a.event_id = "ad_click" - and b.experiment_id = 37 - group by - b.group_id; - """ - - qt_with_hint_2 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join, push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_with_hint_3 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join, push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id), - date_format(a.time_stamp, '%Y-%m-%d') as dayF - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id, - dayF; - """ - - qt_with_hint_4 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join, push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library a - join shunt_log_com_dd_library b on - a.device_id = b.device_id - group by - b.group_id, - b.experiment_id, - a.event_id; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/basic_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/basic_one_side.groovy deleted file mode 100644 index 78503039d224be..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/basic_one_side.groovy +++ /dev/null @@ -1,204 +0,0 @@ -// 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("basic_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - - sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" - sql "set disable_join_reorder=true" - - sql """ - DROP TABLE IF EXISTS shunt_log_com_dd_library_one_side; - """ - sql """ - DROP TABLE IF EXISTS com_dd_library_one_side; - """ - - sql""" - CREATE TABLE `shunt_log_com_dd_library_one_side` ( - `device_id` varchar(255) NOT NULL, - `experiment_id` varchar(255) NOT NULL, - `group_id` varchar(255) NOT NULL - ) ENGINE=OLAP - DUPLICATE KEY(`device_id`) - DISTRIBUTED BY HASH(`device_id`) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - sql""" - CREATE TABLE `com_dd_library_one_side` ( - `event_id` varchar(255) NULL, - `device_id` varchar(255) NULL DEFAULT "", - `time_stamp` datetime NULL - ) ENGINE=OLAP - DUPLICATE KEY(`event_id`) - DISTRIBUTED BY HASH(`device_id`) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - qt_1 """ - explain shape plan - select - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - a.event_id = "ad_click" - and b.experiment_id = 37 - group by - b.group_id; - """ - - qt_2 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_3 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id), - date_format(a.time_stamp, '%Y-%m-%d') as dayF - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id, - dayF; - """ - - qt_4 """ - explain shape plan - select - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_with_hint_1 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - a.event_id = "ad_click" - and b.experiment_id = 37 - group by - b.group_id; - """ - - qt_with_hint_2 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id; - """ - - qt_with_hint_3 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id), - date_format(a.time_stamp, '%Y-%m-%d') as dayF - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - where - b.experiment_id = 73 - group by - b.group_id, - b.experiment_id, - a.event_id, - dayF; - """ - - qt_with_hint_4 """ - explain shape plan - select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ - a.event_id, - b.experiment_id, - b.group_id, - COUNT(a.event_id) - from - com_dd_library_one_side a - join shunt_log_com_dd_library_one_side b on - a.device_id = b.device_id - group by - b.group_id, - b.experiment_id, - a.event_id; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_aggr_distinct_through_join_one_side_cust.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_aggr_distinct_through_join_one_side_cust.groovy deleted file mode 100644 index 0dad9209972554..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_aggr_distinct_through_join_one_side_cust.groovy +++ /dev/null @@ -1,130 +0,0 @@ -// 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("push_down_aggr_distinct_through_join_one_side_cust") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "set be_number_for_test=1" - sql "set DISABLE_NEREIDS_RULES='PRUNE_EMPTY_PARTITION, ELIMINATE_GROUP_BY_KEY_BY_UNIFORM,CONSTANT_PROPAGATION'" - - sql """ - DROP TABLE IF EXISTS dwd_com_abtest_result_inc_ymds; - DROP TABLE IF EXISTS dwd_tracking_sensor_init_tmp_ymds; - """ - - sql """ - CREATE TABLE `dwd_com_abtest_result_inc_ymds` ( - `app_name` varchar(255) NULL, - `user_key` text NULL, - `group_name` text NULL, - `dt` date NOT NULL, - ) ENGINE=OLAP - DUPLICATE KEY(`app_name`) - AUTO PARTITION BY RANGE (date_trunc(`dt`, 'day')) - (PARTITION p20240813000000 VALUES [('2024-08-13'), ('2024-08-14')), - PARTITION p20240814000000 VALUES [('2024-08-14'), ('2024-08-15')), - PARTITION p20240815000000 VALUES [('2024-08-15'), ('2024-08-16')), - PARTITION p20240816000000 VALUES [('2024-08-16'), ('2024-08-17')), - PARTITION p20240817000000 VALUES [('2024-08-17'), ('2024-08-18')), - PARTITION p20240818000000 VALUES [('2024-08-18'), ('2024-08-19')), - PARTITION p20240819000000 VALUES [('2024-08-19'), ('2024-08-20'))) - DISTRIBUTED BY HASH(`app_name`) BUCKETS 1 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1", - "min_load_replica_num" = "-1", - "is_being_synced" = "false", - "storage_medium" = "hdd", - "storage_format" = "V2", - "inverted_index_storage_format" = "V2", - "light_schema_change" = "true", - "disable_auto_compaction" = "false", - "enable_single_replica_compaction" = "false", - "group_commit_interval_ms" = "10000", - "group_commit_data_bytes" = "134217728" - ); - - CREATE TABLE `dwd_tracking_sensor_init_tmp_ymds` ( - `ip` varchar(20) NULL, - `gz_user_id` text NULL, - `dt` date NOT NULL - ) ENGINE=OLAP - DUPLICATE KEY(`ip`) - AUTO PARTITION BY RANGE (date_trunc(`dt`, 'day')) - (PARTITION p20240813000000 VALUES [('2024-08-13'), ('2024-08-14')), - PARTITION p20240814000000 VALUES [('2024-08-14'), ('2024-08-15')), - PARTITION p20240815000000 VALUES [('2024-08-15'), ('2024-08-16')), - PARTITION p20240816000000 VALUES [('2024-08-16'), ('2024-08-17')), - PARTITION p20240817000000 VALUES [('2024-08-17'), ('2024-08-18')), - PARTITION p20240818000000 VALUES [('2024-08-18'), ('2024-08-19')), - PARTITION p20240819000000 VALUES [('2024-08-19'), ('2024-08-20'))) - DISTRIBUTED BY HASH(`ip`) BUCKETS 10 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1", - "min_load_replica_num" = "-1", - "is_being_synced" = "false", - "storage_medium" = "hdd", - "storage_format" = "V2", - "inverted_index_storage_format" = "V2", - "light_schema_change" = "true", - "disable_auto_compaction" = "false", - "enable_single_replica_compaction" = "false", - "group_commit_interval_ms" = "10000", - "group_commit_data_bytes" = "134217728" - ); - """ - - sql """ - set topn_opt_limit_threshold=1024; - """ - - explain { - sql("""physical PLAN SELECT /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ - COUNT(DISTINCT dwd_tracking_sensor_init_tmp_ymds.gz_user_id) AS a2c1a830_1, - dwd_com_abtest_result_inc_ymds.group_name AS ab1011d6, - dwd_tracking_sensor_init_tmp_ymds.dt AS ad466123 - FROM dwd_tracking_sensor_init_tmp_ymds - LEFT JOIN dwd_com_abtest_result_inc_ymds - ON dwd_tracking_sensor_init_tmp_ymds.gz_user_id = dwd_com_abtest_result_inc_ymds.user_key - AND dwd_tracking_sensor_init_tmp_ymds.dt = dwd_com_abtest_result_inc_ymds.dt - WHERE dwd_tracking_sensor_init_tmp_ymds.dt BETWEEN '2024-08-15' AND '2024-08-15' - AND dwd_com_abtest_result_inc_ymds.dt BETWEEN '2024-08-15' AND '2024-08-15' - GROUP BY 2, 3 ORDER BY 3 asc limit 10000;"""); - contains"groupByExpr=[gz_user_id#1, dt#2]" - contains"groupByExpr=[gz_user_id#1, dt#2, group_name#5], outputExpr=[gz_user_id#1, dt#2, group_name#5]" - contains"[group_name#5, dt#2]" - contains"groupByExpr=[group_name#5, dt#2], outputExpr=[group_name#5, dt#2, count(partial_count(gz_user_id)#12) AS `a2c1a830_1`#7]" - } - - explain { - sql("""physical PLAN SELECT /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ - COUNT(DISTINCT dwd_tracking_sensor_init_tmp_ymds.ip) AS a2c1a830_1, - dwd_com_abtest_result_inc_ymds.group_name AS ab1011d6, - dwd_tracking_sensor_init_tmp_ymds.dt AS ad466123 - FROM dwd_tracking_sensor_init_tmp_ymds - LEFT JOIN dwd_com_abtest_result_inc_ymds - ON dwd_tracking_sensor_init_tmp_ymds.gz_user_id = dwd_com_abtest_result_inc_ymds.user_key - AND dwd_tracking_sensor_init_tmp_ymds.dt = dwd_com_abtest_result_inc_ymds.dt - WHERE dwd_tracking_sensor_init_tmp_ymds.dt BETWEEN '2024-08-15' AND '2024-08-15' - AND dwd_com_abtest_result_inc_ymds.dt BETWEEN '2024-08-15' AND '2024-08-15' - GROUP BY 2, 3 ORDER BY 3 asc limit 10000;"""); - contains"groupByExpr=[ip#0, gz_user_id#1, dt#2], outputExpr=[ip#0, gz_user_id#1, dt#2]" - contains"groupByExpr=[ip#0, dt#2, group_name#5], outputExpr=[ip#0, dt#2, group_name#5]" - contains"groupByExpr=[group_name#5, dt#2], outputExpr=[group_name#5, dt#2, partial_count(ip#0) AS `partial_count(ip)`#12]" - contains"groupByExpr=[group_name#5, dt#2], outputExpr=[group_name#5, dt#2, count(partial_count(ip)#12) AS `a2c1a830_1`#7]" - } -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.groovy deleted file mode 100644 index 26d8a78512ff02..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_distinct_through_join_one_side.groovy +++ /dev/null @@ -1,259 +0,0 @@ -// 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("push_down_count_distinct_through_join_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "set be_number_for_test=1" - - sql """ - DROP TABLE IF EXISTS count_with_distinct_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS count_with_distinct_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into count_with_distinct_t values (1, 1, 'a')" - sql "insert into count_with_distinct_t values (2, null, 'a')" - sql "insert into count_with_distinct_t values (3, 1, null)" - sql "insert into count_with_distinct_t values (4, 2, 'b')" - sql "insert into count_with_distinct_t values (5, null, 'b')" - sql "insert into count_with_distinct_t values (6, 2, null)" - sql "insert into count_with_distinct_t values (7, 3, 'c')" - sql "insert into count_with_distinct_t values (8, null, 'c')" - sql "insert into count_with_distinct_t values (9, 3, null)" - sql "insert into count_with_distinct_t values (10, null, null)" - sql "analyze table count_with_distinct_t with full with sync;" - - order_qt_groupby_pushdown_basic """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_right_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 right join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_full_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 full join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_semi_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 inner join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_anti_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left anti join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_complex_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), avg(t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where score > 10) t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_outer_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_deep_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t) count_with_distinct_t where score > 10) t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_having """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name having count(distinct t1.score) > 100; - """ - - order_qt_groupby_pushdown_mixed_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), sum(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_multi_table_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id join count_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_groupby_pushdown_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ sum(distinct t1.score), count(distinct t2.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, count(distinct t1.score), count(distinct t2.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_where_clause """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_groupby_pushdown_varied_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), avg(t1.id), count(distinct t2.name) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by_limit """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name order by count(distinct t1.score) limit 10; - """ - - order_qt_groupby_pushdown_alias_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1_alias.score) from count_with_distinct_t t1_alias join count_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_groupby_pushdown_complex_join_condition """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_function_processed_columns """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct LENGTH(t1.name)) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_nested_queries """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where score > 20) t1 join (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_basic """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_right_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 right join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_full_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 full join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_semi_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 inner join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_anti_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left anti join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), avg(t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where score > 10) t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_outer_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 left join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_deep_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t) count_with_distinct_t where score > 10) t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_having """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name having count(distinct t1.score) > 100; - """ - - order_qt_with_hint_groupby_pushdown_mixed_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), sum(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multi_table_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id join count_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ sum(distinct t1.score), count(distinct t2.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, count(distinct t1.score), count(distinct t2.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_where_clause """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_varied_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score), avg(t1.id), count(distinct t2.name) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by_limit """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name order by count(distinct t1.score) limit 10; - """ - - order_qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1_alias.score) from count_with_distinct_t t1_alias join count_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_join_condition """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from count_with_distinct_t t1 join count_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_function_processed_columns """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct LENGTH(t1.name)) from count_with_distinct_t t1, count_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_nested_queries """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ count(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where score > 20) t1 join (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from count_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join.groovy deleted file mode 100644 index 742d3e1026fa98..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join.groovy +++ /dev/null @@ -1,429 +0,0 @@ -// 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("push_down_count_through_join") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - - sql """ - DROP TABLE IF EXISTS count_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS count_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into count_t values (1, 1, 'a')" - sql "insert into count_t values (2, null, 'a')" - sql "insert into count_t values (3, 1, null)" - sql "insert into count_t values (4, 2, 'b')" - sql "insert into count_t values (5, null, 'b')" - sql "insert into count_t values (6, 2, null)" - sql "insert into count_t values (7, 3, 'c')" - sql "insert into count_t values (8, null, 'c')" - sql "insert into count_t values (9, 3, null)" - sql "insert into count_t values (10, null, null)" - sql "analyze table count_t with sync;" - qt_groupby_pushdown_basic """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select count(t1.score) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select count(t1.score) from count_t t1 right join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select count(t1.score) from count_t t1 full join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select count(t1.score) from count_t t1 inner join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select count(t1.score) from count_t t1 left anti join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select count(t1.score), avg(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select count(t1.score) from (select * from count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select count(t1.score) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select count(t1.score) from (select * from (select * from count_t) count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name having count(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select count(t1.score), count(*), max(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join_1 """ - explain shape plan select count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id join count_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select max(t1.score), count(t2.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, count(t1.score), count(t2.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select count(t1.score), avg(t1.id), count(t2.name) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by count(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select count(t1_alias.score) from count_t t1_alias join count_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select count(LENGTH(t1.name)) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select count(t1.score) from (select * from count_t where score > 20) t1 join (select * from count_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - /* COUNT(*) */ - qt_groupby_pushdown_basic """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select count(*) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select count(*) from count_t t1 right join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select count(*) from count_t t1 full join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select count(*) from count_t t1 inner join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select count(*) from count_t t1 left anti join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select count(*) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select count(*) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select count(*) from (select * from count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select count(*) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select count(*) from (select * from (select * from count_t) count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name having count(*) > 100; - """ - - qt_groupby_pushdown_multi_table_join_2 """ - explain shape plan select count(*) from count_t t1 join count_t t2 on t1.id = t2.id join count_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select count(*), avg(t1.id), count(t2.name) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by count(*) limit 10; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select count(*) from count_t t1 join count_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select count(*) from (select * from count_t where score > 20) t1 join (select * from count_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 right join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 full join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 inner join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 left anti join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score), avg(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from (select * from count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from (select * from (select * from count_t) count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name having count(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score), count(*), max(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join_1 """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id join count_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ max(t1.score), count(t2.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ t1.name, count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ t1.name, count(t1.score), count(t2.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score), avg(t1.id), count(t2.name) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by count(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1_alias.score) from count_t t1_alias join count_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from count_t t1 join count_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(LENGTH(t1.name)) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(t1.score) from (select * from count_t where score > 20) t1 join (select * from count_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - /* COUNT(*) */ - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 right join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 full join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 inner join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 left anti join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 join count_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from (select * from count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 left join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from (select * from (select * from count_t) count_t where score > 10) t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name having count(*) > 100; - """ - - qt_with_hint_groupby_pushdown_multi_table_join_2 """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 join count_t t2 on t1.id = t2.id join count_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ t1.name, count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*), avg(t1.id), count(t2.name) from count_t t1 join count_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1, count_t t2 where t1.id = t2.id group by t1.name order by count(*) limit 10; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from count_t t1 join count_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ count(*) from (select * from count_t where score > 20) t1 join (select * from count_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.groovy deleted file mode 100644 index 79a9ae76e0d757..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_count_through_join_one_side.groovy +++ /dev/null @@ -1,524 +0,0 @@ -// 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("push_down_count_through_join_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql 'set be_number_for_test=3' - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - sql "set topn_opt_limit_threshold=1024" - sql """ - DROP TABLE IF EXISTS count_t_one_side; - """ - - sql """ - CREATE TABLE IF NOT EXISTS count_t_one_side( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into count_t_one_side values (1, 1, 'a')" - sql "insert into count_t_one_side values (2, null, 'a')" - sql "insert into count_t_one_side values (3, 1, null)" - sql "insert into count_t_one_side values (4, 2, 'b')" - sql "insert into count_t_one_side values (5, null, 'b')" - sql "insert into count_t_one_side values (6, 2, null)" - sql "insert into count_t_one_side values (7, 3, 'c')" - sql "insert into count_t_one_side values (8, null, 'c')" - sql "insert into count_t_one_side values (9, 3, null)" - sql "insert into count_t_one_side values (10, null, null)" - sql "analyze table count_t_one_side with sync;" - qt_groupby_pushdown_basic """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 right join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 full join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 inner join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 left anti join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select count(t1.score), avg(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select count(t1.score) from (select * from count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select count(t1.score) from (select * from (select * from count_t_one_side) count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name having count(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select count(t1.score), count(*), max(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id join count_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select max(t1.score), count(t2.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, count(t1.score), count(t2.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select count(t1.score), avg(t1.id), count(t2.name) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by count(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select count(t1_alias.score) from count_t_one_side t1_alias join count_t_one_side t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select count(LENGTH(t1.name)) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select count(t1.score) from (select * from count_t_one_side where score > 20) t1 join (select * from count_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - /* COUNT(*) */ - qt_groupby_pushdown_basic """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select count(*) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select count(*) from count_t_one_side t1 right join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select count(*) from count_t_one_side t1 full join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select count(*) from count_t_one_side t1 inner join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select count(*) from count_t_one_side t1 left anti join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select count(*) from (select * from count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select count(*) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select count(*) from (select * from (select * from count_t_one_side) count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name having count(*) > 100; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id join count_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select count(*), avg(t1.id), count(t2.name) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by count(*) limit 10; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select count(*) from (select * from count_t_one_side where score > 20) t1 join (select * from count_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 right join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 full join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 inner join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 left anti join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score), avg(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from (select * from count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from (select * from (select * from count_t_one_side) count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name having count(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score), count(*), max(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id join count_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score), count(t2.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, count(t1.score), count(t2.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score), avg(t1.id), count(t2.name) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by count(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1_alias.score) from count_t_one_side t1_alias join count_t_one_side t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(LENGTH(t1.name)) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(t1.score) from (select * from count_t_one_side where score > 20) t1 join (select * from count_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - /* COUNT(*) */ - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 right join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 full join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 inner join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 left anti join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from (select * from count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 left join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from (select * from (select * from count_t_one_side) count_t_one_side where score > 10) t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name having count(*) > 100; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id join count_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*), avg(t1.id), count(t2.name) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1, count_t_one_side t2 where t1.id = t2.id group by t1.name order by count(*) limit 10; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from count_t_one_side t1 join count_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ count(*) from (select * from count_t_one_side where score > 20) t1 join (select * from count_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - sql """ - drop table if exists dw_user_b2c_tracking_info_tmp_ymd; - create table dw_user_b2c_tracking_info_tmp_ymd ( - guid int, - dt varchar, - first_visit_time varchar - )Engine=Olap - DUPLICATE KEY(guid) - distributed by hash(dt) buckets 3 - properties('replication_num' = '1'); - - insert into dw_user_b2c_tracking_info_tmp_ymd values (1, '2024-08-19', '2024-08-19'); - - drop table if exists dwd_tracking_sensor_init_tmp_ymd; - create table dwd_tracking_sensor_init_tmp_ymd ( - guid int, - dt varchar, - tracking_type varchar - )Engine=Olap - DUPLICATE KEY(guid) - distributed by hash(dt) buckets 3 - properties('replication_num' = '1'); - - insert into dwd_tracking_sensor_init_tmp_ymd values(1, '2024-08-19', 'click'), (1, '2024-08-19', 'click'); - """ - sql """ - set disable_join_reorder=true; - """ - - qt_shape """ - explain shape plan - SELECT /*+use_cbo_rule(PUSH_DOWN_AGG_THROUGH_JOIN_ONE_SIDE)*/ - Count(*) AS accee593, - CASE - WHEN dwd_tracking_sensor_init_tmp_ymd.dt = - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, - 10) THEN - '是' - WHEN dwd_tracking_sensor_init_tmp_ymd.dt > - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, - 10) THEN - '否' - ELSE '-1' - end AS a1302fb2, - dwd_tracking_sensor_init_tmp_ymd.dt AS ad466123 - FROM dwd_tracking_sensor_init_tmp_ymd - LEFT JOIN dw_user_b2c_tracking_info_tmp_ymd - ON dwd_tracking_sensor_init_tmp_ymd.guid = - dw_user_b2c_tracking_info_tmp_ymd.guid - AND dwd_tracking_sensor_init_tmp_ymd.dt = - dw_user_b2c_tracking_info_tmp_ymd.dt - WHERE dwd_tracking_sensor_init_tmp_ymd.dt = '2024-08-19' - AND dw_user_b2c_tracking_info_tmp_ymd.dt = '2024-08-19' - AND dwd_tracking_sensor_init_tmp_ymd.dt >= - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, 10) - AND dwd_tracking_sensor_init_tmp_ymd.tracking_type = 'click' - GROUP BY 2, - 3 - ORDER BY 3 ASC - LIMIT 10000; - """ - - qt_agg_pushed """ - SELECT /*+use_cbo_rule(PUSH_DOWN_AGG_THROUGH_JOIN_ONE_SIDE)*/ - Count(*) AS accee593, - CASE - WHEN dwd_tracking_sensor_init_tmp_ymd.dt = - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, - 10) THEN - '是' - WHEN dwd_tracking_sensor_init_tmp_ymd.dt > - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, - 10) THEN - '否' - ELSE '-1' - end AS a1302fb2, - dwd_tracking_sensor_init_tmp_ymd.dt AS ad466123 - FROM dwd_tracking_sensor_init_tmp_ymd - LEFT JOIN dw_user_b2c_tracking_info_tmp_ymd - ON dwd_tracking_sensor_init_tmp_ymd.guid = - dw_user_b2c_tracking_info_tmp_ymd.guid - AND dwd_tracking_sensor_init_tmp_ymd.dt = - dw_user_b2c_tracking_info_tmp_ymd.dt - WHERE dwd_tracking_sensor_init_tmp_ymd.dt = '2024-08-19' - AND dw_user_b2c_tracking_info_tmp_ymd.dt = '2024-08-19' - AND dwd_tracking_sensor_init_tmp_ymd.dt >= - Substring(dw_user_b2c_tracking_info_tmp_ymd.first_visit_time, 1, 10) - AND dwd_tracking_sensor_init_tmp_ymd.tracking_type = 'click' - GROUP BY 2, - 3 - ORDER BY 3 ASC - LIMIT 10000; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_max_through_join.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_max_through_join.groovy deleted file mode 100644 index fb2df76cf206b7..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_max_through_join.groovy +++ /dev/null @@ -1,261 +0,0 @@ -// 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("push_down_max_through_join") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - - sql """ - DROP TABLE IF EXISTS max_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS max_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into max_t values (1, 1, 'a')" - sql "insert into max_t values (2, null, 'a')" - sql "insert into max_t values (3, 1, null)" - sql "insert into max_t values (4, 2, 'b')" - sql "insert into max_t values (5, null, 'b')" - sql "insert into max_t values (6, 2, null)" - sql "insert into max_t values (7, 3, 'c')" - sql "insert into max_t values (8, null, 'c')" - sql "insert into max_t values (9, 3, null)" - sql "insert into max_t values (10, null, null)" - sql "analyze table max_t with sync;" - - qt_groupby_pushdown_basic """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select max(t1.score) from max_t t1 left join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select max(t1.score) from max_t t1 right join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select max(t1.score) from max_t t1 full join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select max(t1.score) from max_t t1 inner join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select max(t1.score) from max_t t1 left anti join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select max(t1.score), avg(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select max(t1.score) from (select * from max_t where score > 10) t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select max(t1.score) from max_t t1 left join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select max(t1.score) from (select * from (select * from max_t) max_t where score > 10) t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name having max(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select max(t1.score), count(*), sum(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id join max_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select sum(t1.score), max(t2.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, max(t1.score), max(t2.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select max(t1.score), avg(t1.id), count(t2.name) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name order by max(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select max(t1_alias.score) from max_t t1_alias join max_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select max(LENGTH(t1.name)) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select max(t1.score) from (select * from max_t where score > 20) t1 join (select * from max_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 left join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 right join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 full join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 inner join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 left anti join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score), avg(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from (select * from max_t where score > 10) t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 left join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from (select * from (select * from max_t) max_t where score > 10) t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name having max(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score), count(*), sum(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id join max_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score), max(t2.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, max(t1.score), max(t2.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score), avg(t1.id), count(t2.name) from max_t t1 join max_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name order by max(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1_alias.score) from max_t t1_alias join max_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from max_t t1 join max_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(LENGTH(t1.name)) from max_t t1, max_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score) from (select * from max_t where score > 20) t1 join (select * from max_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.groovy deleted file mode 100644 index e88dd8cfe13bb5..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_distinct_through_join_one_side.groovy +++ /dev/null @@ -1,257 +0,0 @@ -// 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("push_down_min_distinct_through_join_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "set be_number_for_test=1" - sql """ - DROP TABLE IF EXISTS min_with_distinct_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS min_with_distinct_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into min_with_distinct_t values (1, 1, 'a')" - sql "insert into min_with_distinct_t values (2, null, 'a')" - sql "insert into min_with_distinct_t values (3, 1, null)" - sql "insert into min_with_distinct_t values (4, 2, 'b')" - sql "insert into min_with_distinct_t values (5, null, 'b')" - sql "insert into min_with_distinct_t values (6, 2, null)" - sql "insert into min_with_distinct_t values (7, 3, 'c')" - sql "insert into min_with_distinct_t values (8, null, 'c')" - sql "insert into min_with_distinct_t values (9, 3, null)" - sql "insert into min_with_distinct_t values (10, null, null)" - sql "analyze table min_with_distinct_t with sync;" - order_qt_groupby_pushdown_basic """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_right_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 right join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_full_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 full join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_semi_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 inner join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_anti_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left anti join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_complex_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), avg(t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where score > 10) t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_outer_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_deep_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t) min_with_distinct_t where score > 10) t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_having """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name having min(distinct t1.score) > 100; - """ - - order_qt_groupby_pushdown_mixed_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), sum(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_multi_table_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id join min_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_groupby_pushdown_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ sum(distinct t1.score), min(distinct t2.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, min(distinct t1.score), min(distinct t2.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_where_clause """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_groupby_pushdown_varied_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), avg(t1.id), min(distinct t2.name) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by_limit """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name order by min(distinct t1.score) limit 10; - """ - - order_qt_groupby_pushdown_alias_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1_alias.score) from min_with_distinct_t t1_alias join min_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_groupby_pushdown_complex_join_condition """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_function_processed_columns """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct LENGTH(t1.name)) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_nested_queries """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where score > 20) t1 join (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_basic """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_right_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 right join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_full_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 full join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_semi_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 inner join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_anti_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left anti join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), avg(t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where score > 10) t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_outer_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 left join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_deep_subquery """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t) min_with_distinct_t where score > 10) t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_having """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name having min(distinct t1.score) > 100; - """ - - order_qt_with_hint_groupby_pushdown_mixed_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), sum(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multi_table_join """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id join min_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ sum(distinct t1.score), min(distinct t2.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ t1.name, min(distinct t1.score), min(distinct t2.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_where_clause """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_varied_aggregates """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score), avg(t1.id), min(distinct t2.name) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by_limit """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name order by min(distinct t1.score) limit 10; - """ - - order_qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1_alias.score) from min_with_distinct_t t1_alias join min_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_join_condition """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from min_with_distinct_t t1 join min_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_function_processed_columns """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct LENGTH(t1.name)) from min_with_distinct_t t1, min_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_nested_queries """ - select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ min(distinct t1.score) from (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where score > 20) t1 join (select /*+use_cbo_rule(PUSH_DOWN_AGG_WITH_DISTINCT_THROUGH_JOIN_ONE_SIDE)*/ * from min_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_through_join.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_through_join.groovy deleted file mode 100644 index 9ee791799ae4bb..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_min_through_join.groovy +++ /dev/null @@ -1,260 +0,0 @@ -// 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("push_down_min_through_join") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - sql "set disable_join_reorder=true" - - sql """ - DROP TABLE IF EXISTS min_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS min_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into min_t values (1, 1, 'a')" - sql "insert into min_t values (2, null, 'a')" - sql "insert into min_t values (3, 1, null)" - sql "insert into min_t values (4, 2, 'b')" - sql "insert into min_t values (5, null, 'b')" - sql "insert into min_t values (6, 2, null)" - sql "insert into min_t values (7, 3, 'c')" - sql "insert into min_t values (8, null, 'c')" - sql "insert into min_t values (9, 3, null)" - sql "insert into min_t values (10, null, null)" - sql "analyze table min_t with sync;" - qt_groupby_pushdown_basic """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select min(t1.score) from min_t t1 left join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select min(t1.score) from min_t t1 right join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select min(t1.score) from min_t t1 full join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select min(t1.score) from min_t t1 inner join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select min(t1.score) from min_t t1 left anti join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select min(t1.score), avg(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select min(t1.score) from (select * from min_t where score > 10) t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select min(t1.score) from min_t t1 left join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select min(t1.score) from (select * from (select * from min_t) min_t where score > 10) t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name having min(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select min(t1.score), count(*), sum(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id join min_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select sum(t1.score), min(t2.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, min(t1.score), min(t2.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select min(t1.score), avg(t1.id), count(t2.name) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name order by min(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select min(t1_alias.score) from min_t t1_alias join min_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select min(LENGTH(t1.name)) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select min(t1.score) from (select * from min_t where score > 20) t1 join (select * from min_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 left join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 right join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 full join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 inner join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 left anti join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score), avg(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from (select * from min_t where score > 10) t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 left join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from (select * from (select * from min_t) min_t where score > 10) t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name having min(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score), count(*), sum(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id join min_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score), min(t2.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, min(t1.score), min(t2.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score), avg(t1.id), count(t2.name) from min_t t1 join min_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name order by min(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1_alias.score) from min_t t1_alias join min_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from min_t t1 join min_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(LENGTH(t1.name)) from min_t t1, min_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ min(t1.score) from (select * from min_t where score > 20) t1 join (select * from min_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.groovy deleted file mode 100644 index 560f31bab42119..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_distinct_through_join_one_side.groovy +++ /dev/null @@ -1,253 +0,0 @@ -// 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("push_down_sum_distinct_through_join_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "set be_number_for_test=1" - sql """ - DROP TABLE IF EXISTS sum_with_distinct_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS sum_with_distinct_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into sum_with_distinct_t values (1, 1, 'a')" - sql "insert into sum_with_distinct_t values (2, null, 'a')" - sql "insert into sum_with_distinct_t values (3, 1, null)" - sql "insert into sum_with_distinct_t values (4, 2, 'b')" - sql "insert into sum_with_distinct_t values (5, null, 'b')" - sql "insert into sum_with_distinct_t values (6, 2, null)" - sql "insert into sum_with_distinct_t values (7, 3, 'c')" - sql "insert into sum_with_distinct_t values (8, null, 'c')" - sql "insert into sum_with_distinct_t values (9, 3, null)" - sql "insert into sum_with_distinct_t values (10, null, null)" - sql "analyze table sum_with_distinct_t with sync;" - order_qt_groupby_pushdown_basic """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_right_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 right join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_full_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 full join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_semi_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 inner join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_left_anti_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left anti join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_complex_conditions """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_aggregate """ - select sum(distinct t1.score), avg(t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_subquery """ - select sum(distinct t1.score) from (select * from sum_with_distinct_t where score > 10) t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_outer_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_deep_subquery """ - select sum(distinct t1.score) from (select * from (select * from sum_with_distinct_t) sum_with_distinct_t where score > 10) t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_having """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name having sum(distinct t1.score) > 100; - """ - - order_qt_groupby_pushdown_mixed_aggregates """ - select sum(distinct t1.score), sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_multi_table_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id join sum_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_groupby_pushdown_multiple_equal_conditions """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_with_aggregate """ - select sum(distinct t1.score), sum(distinct t2.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate """ - select t1.name, sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select t1.name, sum(distinct t1.score), sum(distinct t2.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_with_where_clause """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_groupby_pushdown_varied_aggregates """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_with_order_by_limit """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name order by sum(distinct t1.score) limit 10; - """ - - order_qt_groupby_pushdown_alias_multiple_equal_conditions """ - select sum(distinct t1_alias.score) from sum_with_distinct_t t1_alias join sum_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_groupby_pushdown_complex_join_condition """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_groupby_pushdown_function_processed_columns """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_groupby_pushdown_nested_queries """ - select sum(distinct t1.score) from (select * from sum_with_distinct_t where score > 20) t1 join (select * from sum_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_basic """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_right_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 right join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_full_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 full join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_semi_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 inner join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_left_anti_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left anti join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_conditions """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_aggregate """ - select sum(distinct t1.score), avg(t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_subquery """ - select sum(distinct t1.score) from (select * from sum_with_distinct_t where score > 10) t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_outer_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 left join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_deep_subquery """ - select sum(distinct t1.score) from (select * from (select * from sum_with_distinct_t) sum_with_distinct_t where score > 10) t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_having """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name having sum(distinct t1.score) > 100; - """ - - order_qt_with_hint_groupby_pushdown_mixed_aggregates """ - select sum(distinct t1.score), sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multi_table_join """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id join sum_with_distinct_t t3 on t1.name = t3.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - select sum(distinct t1.score), sum(distinct t2.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate """ - select t1.name, sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_with_aggregate """ - select t1.name, sum(distinct t1.score), sum(distinct t2.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_where_clause """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_varied_aggregates """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_with_order_by_limit """ - select sum(distinct t1.score) from sum_with_distinct_t t1, sum_with_distinct_t t2 where t1.id = t2.id group by t1.name order by sum(distinct t1.score) limit 10; - """ - - order_qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - select sum(distinct t1_alias.score) from sum_with_distinct_t t1_alias join sum_with_distinct_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - order_qt_with_hint_groupby_pushdown_complex_join_condition """ - select sum(distinct t1.score) from sum_with_distinct_t t1 join sum_with_distinct_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - order_qt_with_hint_groupby_pushdown_nested_queries """ - select sum(distinct t1.score) from (select * from sum_with_distinct_t where score > 20) t1 join (select * from sum_with_distinct_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.groovy deleted file mode 100644 index e637a58219f1c5..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join.groovy +++ /dev/null @@ -1,259 +0,0 @@ -// 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("push_down_sum_through_join") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - - sql """ - DROP TABLE IF EXISTS sum_t; - """ - - sql """ - CREATE TABLE IF NOT EXISTS sum_t( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into sum_t values (1, 1, 'a')" - sql "insert into sum_t values (2, null, 'a')" - sql "insert into sum_t values (3, 1, null)" - sql "insert into sum_t values (4, 2, 'b')" - sql "insert into sum_t values (5, null, 'b')" - sql "insert into sum_t values (6, 2, null)" - sql "insert into sum_t values (7, 3, 'c')" - sql "insert into sum_t values (8, null, 'c')" - sql "insert into sum_t values (9, 3, null)" - sql "insert into sum_t values (10, null, null)" - sql "analyze table sum_t with sync;" - qt_groupby_pushdown_basic """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select sum(t1.score) from sum_t t1 left join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select sum(t1.score) from sum_t t1 right join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select sum(t1.score) from sum_t t1 full join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select sum(t1.score) from sum_t t1 inner join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select sum(t1.score) from sum_t t1 left anti join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select sum(t1.score), avg(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select sum(t1.score) from (select * from sum_t where score > 10) t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select sum(t1.score) from sum_t t1 left join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select sum(t1.score) from (select * from (select * from sum_t) sum_t where score > 10) t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name having sum(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select sum(t1.score), count(*), max(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id join sum_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select max(t1.score), sum(t2.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, sum(t1.score), sum(t2.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select sum(t1.score), count(t2.name) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name order by sum(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select sum(t1_alias.score) from sum_t t1_alias join sum_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select sum(LENGTH(t1.name)) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select sum(t1.score) from (select * from sum_t where score > 20) t1 join (select * from sum_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 left join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 right join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 full join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 inner join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 left anti join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score), avg(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from (select * from sum_t where score > 10) t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 left join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from (select * from (select * from sum_t) sum_t where score > 10) t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name having sum(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score), count(*), max(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id join sum_t t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ max(t1.score), sum(t2.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ t1.name, sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ t1.name, sum(t1.score), sum(t2.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score), count(t2.name) from sum_t t1 join sum_t t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name order by sum(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1_alias.score) from sum_t t1_alias join sum_t t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from sum_t t1 join sum_t t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(LENGTH(t1.name)) from sum_t t1, sum_t t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join) */ sum(t1.score) from (select * from sum_t where score > 20) t1 join (select * from sum_t where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.groovy b/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.groovy deleted file mode 100644 index 6b04b8f6ba4e8f..00000000000000 --- a/regression-test/suites/nereids_rules_p0/eager_aggregate/push_down_sum_through_join_one_side.groovy +++ /dev/null @@ -1,259 +0,0 @@ -// 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("push_down_sum_through_join_one_side") { - sql "SET enable_nereids_planner=true" - sql "set runtime_filter_mode=OFF" - sql "SET enable_fallback_to_original_planner=false" - sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" - sql "set be_number_for_test=1" - - sql """ - DROP TABLE IF EXISTS sum_t_one_side; - """ - - sql """ - CREATE TABLE IF NOT EXISTS sum_t_one_side( - `id` int(32), - `score` int(64) NULL, - `name` varchar(64) NULL - ) ENGINE = OLAP - DISTRIBUTED BY HASH(id) BUCKETS 4 - PROPERTIES ( - "replication_allocation" = "tag.location.default: 1" - ); - """ - - sql "insert into sum_t_one_side values (1, 1, 'a')" - sql "insert into sum_t_one_side values (2, null, 'a')" - sql "insert into sum_t_one_side values (3, 1, null)" - sql "insert into sum_t_one_side values (4, 2, 'b')" - sql "insert into sum_t_one_side values (5, null, 'b')" - sql "insert into sum_t_one_side values (6, 2, null)" - sql "insert into sum_t_one_side values (7, 3, 'c')" - sql "insert into sum_t_one_side values (8, null, 'c')" - sql "insert into sum_t_one_side values (9, 3, null)" - sql "insert into sum_t_one_side values (10, null, null)" - sql "analyze table sum_t_one_side with sync;" - qt_groupby_pushdown_basic """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 left join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_right_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 right join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_full_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 full join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_semi_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 inner join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_left_anti_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 left anti join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_complex_conditions """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_aggregate """ - explain shape plan select sum(t1.score), avg(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_subquery """ - explain shape plan select sum(t1.score) from (select * from sum_t_one_side where score > 10) t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_outer_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 left join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_deep_subquery """ - explain shape plan select sum(t1.score) from (select * from (select * from sum_t_one_side) sum_t_one_side where score > 10) t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_having """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name having sum(t1.score) > 100; - """ - - qt_groupby_pushdown_mixed_aggregates """ - explain shape plan select sum(t1.score), count(*), max(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_multi_table_join """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id join sum_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_groupby_pushdown_with_order_by """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select max(t1.score), sum(t2.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select t1.name, sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select t1.name, sum(t1.score), sum(t2.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_groupby_pushdown_with_where_clause """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_groupby_pushdown_varied_aggregates """ - explain shape plan select sum(t1.score), avg(t1.id), count(t2.name) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_with_order_by_limit """ - explain shape plan select sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name order by sum(t1.score) limit 10; - """ - - qt_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select sum(t1_alias.score) from sum_t_one_side t1_alias join sum_t_one_side t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_groupby_pushdown_complex_join_condition """ - explain shape plan select sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_groupby_pushdown_function_processed_columns """ - explain shape plan select sum(LENGTH(t1.name)) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_groupby_pushdown_nested_queries """ - explain shape plan select sum(t1.score) from (select * from sum_t_one_side where score > 20) t1 join (select * from sum_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_basic """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t2.score < 100 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 left join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_right_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 right join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_full_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 full join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_semi_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 inner join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_left_anti_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 left anti join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_complex_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.name < t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score), avg(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from (select * from sum_t_one_side where score > 10) t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_outer_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 left join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_deep_subquery """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from (select * from (select * from sum_t_one_side) sum_t_one_side where score > 10) t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_having """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name having sum(t1.score) > 100; - """ - - qt_with_hint_groupby_pushdown_mixed_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score), count(*), max(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_multi_table_join """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id join sum_t_one_side t3 on t1.name = t3.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name order by t1.name; - """ - - qt_with_hint_groupby_pushdown_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ max(t1.score), sum(t2.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_equal_conditions_non_aggregate_selection_with_aggregate """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ t1.name, sum(t1.score), sum(t2.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.name = t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_where_clause """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id and t1.score > 50 group by t1.name; - """ - - qt_with_hint_groupby_pushdown_varied_aggregates """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score), avg(t1.id), count(t2.name) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_with_order_by_limit """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name order by sum(t1.score) limit 10; - """ - - qt_with_hint_groupby_pushdown_alias_multiple_equal_conditions """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1_alias.score) from sum_t_one_side t1_alias join sum_t_one_side t2_alias on t1_alias.id = t2_alias.id and t1_alias.name = t2_alias.name group by t1_alias.name; - """ - - qt_with_hint_groupby_pushdown_complex_join_condition """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from sum_t_one_side t1 join sum_t_one_side t2 on t1.id = t2.id and t1.score = t2.score and t1.name <> t2.name group by t1.name; - """ - - qt_with_hint_groupby_pushdown_function_processed_columns """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(LENGTH(t1.name)) from sum_t_one_side t1, sum_t_one_side t2 where t1.id = t2.id group by t1.name; - """ - - qt_with_hint_groupby_pushdown_nested_queries """ - explain shape plan select /*+ USE_CBO_RULE(push_down_agg_through_join_one_side) */ sum(t1.score) from (select * from sum_t_one_side where score > 20) t1 join (select * from sum_t_one_side where id < 100) t2 on t1.id = t2.id group by t1.name; - """ -} diff --git a/regression-test/suites/shape_check/tpcds_sf1000/load.groovy b/regression-test/suites/shape_check/tpcds_sf1000/load.groovy index 52eee1cd28d20a..e818d54bd7361f 100644 --- a/regression-test/suites/shape_check/tpcds_sf1000/load.groovy +++ b/regression-test/suites/shape_check/tpcds_sf1000/load.groovy @@ -1,2540 +1,2540 @@ -// 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("load") { - String database = context.config.getDbNameByFile(context.file) - sql "drop database if exists ${database}" - sql "create database ${database}" - sql "use ${database}" - - sql ''' - drop table if exists customer_demographics - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS customer_demographics ( - cd_demo_sk int not null, - cd_gender varchar(1), - cd_marital_status varchar(1), - cd_education_status varchar(20), - cd_purchase_estimate integer, - cd_credit_rating varchar(10), - cd_dep_count integer, - cd_dep_employed_count integer, - cd_dep_college_count integer - ) - DUPLICATE KEY(cd_demo_sk) - DISTRIBUTED BY HASH(cd_demo_sk) BUCKETS 9 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists reason - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS reason ( - r_reason_sk int not null, - r_reason_id varchar(16) not null, - r_reason_desc varchar(100) - ) - DUPLICATE KEY(r_reason_sk) - DISTRIBUTED BY HASH(r_reason_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists date_dim - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS date_dim ( - d_date_sk int not null, - d_date_id varchar(16) not null, - d_date datev2, - d_month_seq integer, - d_week_seq integer, - d_quarter_seq integer, - d_year integer, - d_dow integer, - d_moy integer, - d_dom integer, - d_qoy integer, - d_fy_year integer, - d_fy_quarter_seq integer, - d_fy_week_seq integer, - d_day_name varchar(9), - d_quarter_name varchar(6), - d_holiday varchar(1), - d_weekend varchar(1), - d_following_holiday varchar(1), - d_first_dom integer, - d_last_dom integer, - d_same_day_ly integer, - d_same_day_lq integer, - d_current_day varchar(1), - d_current_week varchar(1), - d_current_month varchar(1), - d_current_quarter varchar(1), - d_current_year varchar(1) - ) - DUPLICATE KEY(d_date_sk) - DISTRIBUTED BY HASH(d_date_sk) BUCKETS 9 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists warehouse - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS warehouse ( - w_warehouse_sk int not null, - w_warehouse_id varchar(16) not null, - w_warehouse_name varchar(20), - w_warehouse_sq_ft integer, - w_street_number varchar(10), - w_street_name varchar(60), - w_street_type varchar(15), - w_suite_number varchar(10), - w_city varchar(60), - w_county varchar(30), - w_state varchar(2), - w_zip varchar(10), - w_country varchar(20), - w_gmt_offset decimalv3(5,2) - ) - DUPLICATE KEY(w_warehouse_sk) - DISTRIBUTED BY HASH(w_warehouse_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists catalog_sales - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS catalog_sales ( - cs_sold_date_sk int, - cs_item_sk int not null, - cs_order_number int not null, - cs_sold_time_sk int, - cs_ship_date_sk int, - cs_bill_customer_sk int, - cs_bill_cdemo_sk int, - cs_bill_hdemo_sk int, - cs_bill_addr_sk int, - cs_ship_customer_sk int, - cs_ship_cdemo_sk int, - cs_ship_hdemo_sk int, - cs_ship_addr_sk int, - cs_call_center_sk int, - cs_catalog_page_sk int, - cs_ship_mode_sk int, - cs_warehouse_sk int, - cs_promo_sk int, - cs_quantity int, - cs_wholesale_cost decimalv3(7,2), - cs_list_price decimalv3(7,2), - cs_sales_price decimalv3(7,2), - cs_ext_discount_amt decimalv3(7,2), - cs_ext_sales_price decimalv3(7,2), - cs_ext_wholesale_cost decimalv3(7,2), - cs_ext_list_price decimalv3(7,2), - cs_ext_tax decimalv3(7,2), - cs_coupon_amt decimalv3(7,2), - cs_ext_ship_cost decimalv3(7,2), - cs_net_paid decimalv3(7,2), - cs_net_paid_inc_tax decimalv3(7,2), - cs_net_paid_inc_ship decimalv3(7,2), - cs_net_paid_inc_ship_tax decimalv3(7,2), - cs_net_profit decimalv3(7,2) - ) - DUPLICATE KEY(`cs_sold_date_sk`, `cs_item_sk`, `cs_order_number`) - DISTRIBUTED BY HASH(cs_item_sk, cs_order_number) BUCKETS 261 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists call_center - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS call_center ( - cc_call_center_sk int not null, - cc_call_center_id varchar(16) not null, - cc_rec_start_date date, - cc_rec_end_date date, - cc_closed_date_sk integer, - cc_open_date_sk integer, - cc_name varchar(50), - cc_class varchar(50), - cc_employees integer, - cc_sq_ft integer, - cc_hours varchar(20), - cc_manager varchar(40), - cc_mkt_id integer, - cc_mkt_class varchar(50), - cc_mkt_desc varchar(100), - cc_market_manager varchar(40), - cc_division integer, - cc_division_name varchar(50), - cc_company integer, - cc_company_name varchar(50), - cc_street_number varchar(10), - cc_street_name varchar(60), - cc_street_type varchar(15), - cc_suite_number varchar(10), - cc_city varchar(60), - cc_county varchar(30), - cc_state varchar(2), - cc_zip varchar(10), - cc_country varchar(20), - cc_gmt_offset decimalv3(5,2), - cc_tax_percentage decimalv3(5,2) - ) - DUPLICATE KEY(cc_call_center_sk) - DISTRIBUTED BY HASH(cc_call_center_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists inventory - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS inventory ( - inv_date_sk int not null, - inv_item_sk int not null, - inv_warehouse_sk int, - inv_quantity_on_hand integer - ) - DUPLICATE KEY(inv_date_sk, inv_item_sk, inv_warehouse_sk) - DISTRIBUTED BY HASH(inv_item_sk) BUCKETS 63 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists catalog_returns - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS catalog_returns ( - cr_returned_date_sk int, - cr_item_sk int not null, - cr_order_number int not null, - cr_returned_time_sk int, - cr_refunded_customer_sk int, - cr_refunded_cdemo_sk int, - cr_refunded_hdemo_sk int, - cr_refunded_addr_sk int, - cr_returning_customer_sk int, - cr_returning_cdemo_sk int, - cr_returning_hdemo_sk int, - cr_returning_addr_sk int, - cr_call_center_sk int, - cr_catalog_page_sk int, - cr_ship_mode_sk int, - cr_warehouse_sk int, - cr_reason_sk int, - cr_return_quantity integer, - cr_return_amount decimalv3(7,2), - cr_return_tax decimalv3(7,2), - cr_return_amt_inc_tax decimalv3(7,2), - cr_fee decimalv3(7,2), - cr_return_ship_cost decimalv3(7,2), - cr_refunded_cash decimalv3(7,2), - cr_reversed_charge decimalv3(7,2), - cr_store_credit decimalv3(7,2), - cr_net_loss decimalv3(7,2) - ) - DUPLICATE KEY(`cr_returned_date_sk`, `cr_item_sk`, `cr_order_number`) - DISTRIBUTED BY HASH(cr_item_sk, cr_order_number) BUCKETS 36 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists household_demographics - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS household_demographics ( - hd_demo_sk int not null, - hd_income_band_sk int, - hd_buy_potential varchar(15), - hd_dep_count integer, - hd_vehicle_count integer - ) - DUPLICATE KEY(hd_demo_sk) - DISTRIBUTED BY HASH(hd_demo_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists customer_address - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS customer_address ( - ca_address_sk int not null, - ca_address_id varchar(16) not null, - ca_street_number varchar(10), - ca_street_name varchar(60), - ca_street_type varchar(15), - ca_suite_number varchar(10), - ca_city varchar(60), - ca_county varchar(30), - ca_state varchar(2), - ca_zip varchar(10), - ca_country varchar(20), - ca_gmt_offset decimalv3(5,2), - ca_location_type varchar(20) - ) - DUPLICATE KEY(ca_address_sk) - DISTRIBUTED BY HASH(ca_address_sk) BUCKETS 18 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists income_band - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS income_band ( - ib_income_band_sk int not null, - ib_lower_bound integer, - ib_upper_bound integer - ) - DUPLICATE KEY(ib_income_band_sk) - DISTRIBUTED BY HASH(ib_income_band_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists catalog_page - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS catalog_page ( - cp_catalog_page_sk int not null, - cp_catalog_page_id varchar(16) not null, - cp_start_date_sk integer, - cp_end_date_sk integer, - cp_department varchar(50), - cp_catalog_number integer, - cp_catalog_page_number integer, - cp_description varchar(100), - cp_type varchar(100) - ) - DUPLICATE KEY(cp_catalog_page_sk) - DISTRIBUTED BY HASH(cp_catalog_page_sk) BUCKETS 3 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists item - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS item ( - i_item_sk int not null, - i_item_id varchar(16) not null, - i_rec_start_date datev2, - i_rec_end_date datev2, - i_item_desc varchar(200), - i_current_price decimalv3(7,2), - i_wholesale_cost decimalv3(7,2), - i_brand_id integer, - i_brand varchar(50), - i_class_id integer, - i_class char(50), - i_category_id integer, - i_category varchar(50), - i_manufact_id integer, - i_manufact varchar(50), - i_size varchar(20), - i_formulation varchar(20), - i_color varchar(20), - i_units varchar(10), - i_container varchar(10), - i_manager_id integer, - i_product_name varchar(50) - ) - DUPLICATE KEY(i_item_sk) - DISTRIBUTED BY HASH(i_item_sk) BUCKETS 9 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists web_returns - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS web_returns ( - wr_returned_date_sk int, - wr_item_sk int not null, - wr_order_number int not null, - wr_returned_time_sk int, - wr_refunded_customer_sk int, - wr_refunded_cdemo_sk int, - wr_refunded_hdemo_sk int, - wr_refunded_addr_sk int, - wr_returning_customer_sk int, - wr_returning_cdemo_sk int, - wr_returning_hdemo_sk int, - wr_returning_addr_sk int, - wr_web_page_sk int, - wr_reason_sk int, - wr_return_quantity integer, - wr_return_amt decimalv3(7,2), - wr_return_tax decimalv3(7,2), - wr_return_amt_inc_tax decimalv3(7,2), - wr_fee decimalv3(7,2), - wr_return_ship_cost decimalv3(7,2), - wr_refunded_cash decimalv3(7,2), - wr_reversed_charge decimalv3(7,2), - wr_account_credit decimalv3(7,2), - wr_net_loss decimalv3(7,2) - ) - DUPLICATE KEY(`wr_returned_date_sk`, `wr_item_sk`, `wr_order_number`) - DISTRIBUTED BY HASH(`wr_item_sk`, `wr_order_number`) BUCKETS 18 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists web_site - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS web_site ( - web_site_sk int not null, - web_site_id varchar(16) not null, - web_rec_start_date datev2, - web_rec_end_date datev2, - web_name varchar(50), - web_open_date_sk int, - web_close_date_sk int, - web_class varchar(50), - web_manager varchar(40), - web_mkt_id integer, - web_mkt_class varchar(50), - web_mkt_desc varchar(100), - web_market_manager varchar(40), - web_company_id integer, - web_company_name varchar(50), - web_street_number varchar(10), - web_street_name varchar(60), - web_street_type varchar(15), - web_suite_number varchar(10), - web_city varchar(60), - web_county varchar(30), - web_state varchar(2), - web_zip varchar(10), - web_country varchar(20), - web_gmt_offset decimalv3(5,2), - web_tax_percentage decimalv3(5,2) - ) - DUPLICATE KEY(web_site_sk) - DISTRIBUTED BY HASH(web_site_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists promotion - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS promotion ( - p_promo_sk int not null, - p_promo_id varchar(16) not null, - p_start_date_sk int, - p_end_date_sk int, - p_item_sk int, - p_cost decimalv3(15,2), - p_response_targe integer, - p_promo_name varchar(50), - p_channel_dmail varchar(1), - p_channel_email varchar(1), - p_channel_catalog varchar(1), - p_channel_tv varchar(1), - p_channel_radio varchar(1), - p_channel_press varchar(1), - p_channel_event varchar(1), - p_channel_demo varchar(1), - p_channel_details varchar(100), - p_purpose varchar(15), - p_discount_active varchar(1) - ) - DUPLICATE KEY(p_promo_sk) - DISTRIBUTED BY HASH(p_promo_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists web_sales - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS web_sales ( - ws_sold_date_sk int, - ws_item_sk int not null, - ws_order_number int not null, - ws_sold_time_sk int, - ws_ship_date_sk int, - ws_bill_customer_sk int, - ws_bill_cdemo_sk int, - ws_bill_hdemo_sk int, - ws_bill_addr_sk int, - ws_ship_customer_sk int, - ws_ship_cdemo_sk int, - ws_ship_hdemo_sk int, - ws_ship_addr_sk int, - ws_web_page_sk int, - ws_web_site_sk int, - ws_ship_mode_sk int, - ws_warehouse_sk int, - ws_promo_sk int, - ws_quantity integer, - ws_wholesale_cost decimalv3(7,2), - ws_list_price decimalv3(7,2), - ws_sales_price decimalv3(7,2), - ws_ext_discount_amt decimalv3(7,2), - ws_ext_sales_price decimalv3(7,2), - ws_ext_wholesale_cost decimalv3(7,2), - ws_ext_list_price decimalv3(7,2), - ws_ext_tax decimalv3(7,2), - ws_coupon_amt decimalv3(7,2), - ws_ext_ship_cost decimalv3(7,2), - ws_net_paid decimalv3(7,2), - ws_net_paid_inc_tax decimalv3(7,2), - ws_net_paid_inc_ship decimalv3(7,2), - ws_net_paid_inc_ship_tax decimalv3(7,2), - ws_net_profit decimalv3(7,2) - ) - DUPLICATE KEY(`ws_sold_date_sk`, `ws_item_sk`, `ws_order_number`) - DISTRIBUTED BY HASH(ws_item_sk, ws_order_number) BUCKETS 126 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists store - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS store ( - s_store_sk int not null, - s_store_id varchar(16) not null, - s_rec_start_date datev2, - s_rec_end_date datev2, - s_closed_date_sk int, - s_store_name varchar(50), - s_number_employees integer, - s_floor_space integer, - s_hours varchar(20), - s_manager varchar(40), - s_market_id integer, - s_geography_class varchar(100), - s_market_desc varchar(100), - s_market_manager varchar(40), - s_division_id integer, - s_division_name varchar(50), - s_company_id integer, - s_company_name varchar(50), - s_street_number varchar(10), - s_street_name varchar(60), - s_street_type varchar(15), - s_suite_number varchar(10), - s_city varchar(60), - s_county varchar(30), - s_state varchar(2), - s_zip varchar(10), - s_country varchar(20), - s_gmt_offset decimalv3(5,2), - s_tax_percentage decimalv3(5,2) - ) - DUPLICATE KEY(s_store_sk) - DISTRIBUTED BY HASH(s_store_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists time_dim - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS time_dim ( - t_time_sk int not null, - t_time_id varchar(16) not null, - t_time integer, - t_hour integer, - t_minute integer, - t_second integer, - t_am_pm varchar(2), - t_shift varchar(20), - t_sub_shift varchar(20), - t_meal_time varchar(20) - ) - DUPLICATE KEY(t_time_sk) - DISTRIBUTED BY HASH(t_time_sk) BUCKETS 9 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists web_page - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS web_page ( - wp_web_page_sk int not null, - wp_web_page_id varchar(16) not null, - wp_rec_start_date datev2, - wp_rec_end_date datev2, - wp_creation_date_sk int, - wp_access_date_sk int, - wp_autogen_flag varchar(1), - wp_customer_sk int, - wp_url varchar(100), - wp_type varchar(50), - wp_char_count integer, - wp_link_count integer, - wp_image_count integer, - wp_max_ad_count integer - ) - DUPLICATE KEY(wp_web_page_sk) - DISTRIBUTED BY HASH(wp_web_page_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists store_returns - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS store_returns ( - sr_returned_date_sk int, - sr_item_sk int not null, - sr_ticket_number int not null, - sr_return_time_sk int, - sr_customer_sk int, - sr_cdemo_sk int, - sr_hdemo_sk int, - sr_addr_sk int, - sr_store_sk int, - sr_reason_sk int, - sr_return_quantity integer, - sr_return_amt decimalv3(7,2), - sr_return_tax decimalv3(7,2), - sr_return_amt_inc_tax decimalv3(7,2), - sr_fee decimalv3(7,2), - sr_return_ship_cost decimalv3(7,2), - sr_refunded_cash decimalv3(7,2), - sr_reversed_charge decimalv3(7,2), - sr_store_credit decimalv3(7,2), - sr_net_loss decimalv3(7,2) - ) - duplicate key(`sr_returned_date_sk`, `sr_item_sk`, `sr_ticket_number`) - distributed by hash (sr_item_sk, sr_ticket_number) buckets 36 - properties ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists store_sales - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS store_sales ( - ss_sold_date_sk int, - ss_item_sk int not null, - ss_ticket_number int not null, - ss_sold_time_sk int, - ss_customer_sk int, - ss_cdemo_sk int, - ss_hdemo_sk int, - ss_addr_sk int, - ss_store_sk int, - ss_promo_sk int, - ss_quantity integer, - ss_wholesale_cost decimalv3(7,2), - ss_list_price decimalv3(7,2), - ss_sales_price decimalv3(7,2), - ss_ext_discount_amt decimalv3(7,2), - ss_ext_sales_price decimalv3(7,2), - ss_ext_wholesale_cost decimalv3(7,2), - ss_ext_list_price decimalv3(7,2), - ss_ext_tax decimalv3(7,2), - ss_coupon_amt decimalv3(7,2), - ss_net_paid decimalv3(7,2), - ss_net_paid_inc_tax decimalv3(7,2), - ss_net_profit decimalv3(7,2) - ) - DUPLICATE KEY(`ss_sold_date_sk`, `ss_item_sk`, `ss_ticket_number`) - DISTRIBUTED BY HASH(ss_item_sk, ss_ticket_number) BUCKETS 261 - PROPERTIES ( - "replication_num" = "1", - "colocate_with" = "store" - ) - ''' - - sql ''' - drop table if exists ship_mode - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS ship_mode ( - sm_ship_mode_sk int not null, - sm_ship_mode_id varchar(16) not null, - sm_type varchar(30), - sm_code varchar(10), - sm_carrier varchar(20), - sm_contract varchar(20) - ) - DUPLICATE KEY(sm_ship_mode_sk) - DISTRIBUTED BY HASH(sm_ship_mode_sk) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists customer - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS customer ( - c_customer_sk int not null, - c_customer_id varchar(16) not null, - c_current_cdemo_sk int, - c_current_hdemo_sk int, - c_current_addr_sk int, - c_first_shipto_date_sk int, - c_first_sales_date_sk int, - c_salutation varchar(10), - c_first_name varchar(20), - c_last_name varchar(30), - c_preferred_cust_flag varchar(1), - c_birth_day integer, - c_birth_month integer, - c_birth_year integer, - c_birth_country varchar(20), - c_login varchar(13), - c_email_address varchar(50), - c_last_review_date_sk int - ) - DUPLICATE KEY(c_customer_sk) - DISTRIBUTED BY HASH(c_customer_sk) BUCKETS 18 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - drop table if exists dbgen_version - ''' - - sql ''' - CREATE TABLE IF NOT EXISTS dbgen_version - ( - dv_version varchar(16) , - dv_create_date datev2 , - dv_create_time datetime , - dv_cmdline_args varchar(200) - ) - DUPLICATE KEY(dv_version) - DISTRIBUTED BY HASH(dv_version) BUCKETS 1 - PROPERTIES ( - "replication_num" = "1" - ) - ''' - - sql ''' - alter table customer add constraint customer_pk primary key (c_customer_sk); - ''' - - sql ''' - alter table customer add constraint customer_uk unique (c_customer_id); - ''' - - sql ''' - alter table store_sales add constraint ss_fk foreign key(ss_customer_sk) references customer(c_customer_sk); - ''' - - sql ''' - alter table web_sales add constraint ws_fk foreign key(ws_bill_customer_sk) references customer(c_customer_sk); - ''' - - sql ''' - alter table catalog_sales add constraint cs_fk foreign key(cs_bill_customer_sk) references customer(c_customer_sk); - ''' - - sql """ - alter table customer_demographics modify column cd_dep_employed_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') - """ - - sql """ - alter table date_dim modify column d_day_name set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='Friday', 'max_value'='Wednesday', 'data_size'='521779') - """ - - sql """ - alter table date_dim modify column d_following_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_same_day_ly set stats ('row_count'='73049', 'ndv'='72450', 'num_nulls'='0', 'min_value'='2414657', 'max_value'='2487705', 'data_size'='292196') - """ - - sql """ - alter table warehouse modify column w_city set stats ('row_count'='20', 'ndv'='12', 'num_nulls'='0', 'min_value'='Fairview', 'max_value'='Shiloh', 'data_size'='183') - """ - - sql """ - alter table warehouse modify column w_street_type set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='71') - """ - - sql """ - alter table catalog_sales modify column cs_call_center_sk set stats ('row_count'='1439980416', 'ndv'='42', 'num_nulls'='7199711', 'min_value'='1', 'max_value'='42', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_net_paid_inc_ship set stats ('row_count'='1439980416', 'ndv'='2505826', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='43956.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_sales_price set stats ('row_count'='1439980416', 'ndv'='29306', 'num_nulls'='7200276', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='5759921664') - """ - - sql """ - alter table call_center modify column cc_class set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='large', 'max_value'='small', 'data_size'='226') - """ - - sql """ - alter table call_center modify column cc_country set stats ('row_count'='42', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='546') - """ - - sql """ - alter table call_center modify column cc_county set stats ('row_count'='42', 'ndv'='16', 'num_nulls'='0', 'min_value'='Barrow County', 'max_value'='Williamson County', 'data_size'='627') - """ - - sql """ - alter table call_center modify column cc_mkt_class set stats ('row_count'='42', 'ndv'='36', 'num_nulls'='0', 'min_value'='A bit narrow forms matter animals. Consist', 'max_value'='Yesterday new men can make moreov', 'data_size'='1465') - """ - - sql """ - alter table call_center modify column cc_sq_ft set stats ('row_count'='42', 'ndv'='31', 'num_nulls'='0', 'min_value'='-1890660328', 'max_value'='2122480316', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_state set stats ('row_count'='42', 'ndv'='14', 'num_nulls'='0', 'min_value'='FL', 'max_value'='WV', 'data_size'='84') - """ - - sql """ - alter table inventory modify column inv_warehouse_sk set stats ('row_count'='783000000', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='6264000000') - """ - - sql """ - alter table catalog_returns modify column cr_refunded_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2881609', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_refunded_cash set stats ('row_count'='143996756', 'ndv'='1107525', 'num_nulls'='2879192', 'min_value'='0.00', 'max_value'='26955.24', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_refunded_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2881314', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_return_amt_inc_tax set stats ('row_count'='143996756', 'ndv'='1544502', 'num_nulls'='2881886', 'min_value'='0.00', 'max_value'='30418.06', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_returning_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2883215', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') - """ - - sql """ - alter table household_demographics modify column hd_buy_potential set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='0-500', 'max_value'='Unknown', 'data_size'='54000') - """ - - sql """ - alter table customer_address modify column ca_address_id set stats ('row_count'='6000000', 'ndv'='5984931', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPEAA', 'data_size'='96000000') - """ - - sql """ - alter table customer_address modify column ca_address_sk set stats ('row_count'='6000000', 'ndv'='6015811', 'num_nulls'='0', 'min_value'='1', 'max_value'='6000000', 'data_size'='48000000') - """ - - sql """ - alter table customer_address modify column ca_country set stats ('row_count'='6000000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='75661794') - """ - - sql """ - alter table customer_address modify column ca_location_type set stats ('row_count'='6000000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='single family', 'data_size'='52372545') - """ - - sql """ - alter table customer_address modify column ca_street_number set stats ('row_count'='6000000', 'ndv'='1002', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='16837336') - """ - - sql """ - alter table customer_address modify column ca_suite_number set stats ('row_count'='6000000', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='45911575') - """ - - sql """ - alter table catalog_page modify column cp_catalog_page_id set stats ('row_count'='30000', 'ndv'='29953', 'num_nulls'='0', 'min_value'='AAAAAAAAAAABAAAA', 'max_value'='AAAAAAAAPPPGAAAA', 'data_size'='480000') - """ - - sql """ - alter table item modify column i_rec_end_date set stats ('row_count'='300000', 'ndv'='3', 'num_nulls'='150000', 'min_value'='1999-10-27', 'max_value'='2001-10-26', 'data_size'='1200000') - """ - - sql """ - alter table web_returns modify column wr_refunded_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239971', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_reversed_charge set stats ('row_count'='71997522', 'ndv'='692680', 'num_nulls'='3239546', 'min_value'='0.00', 'max_value'='23194.77', 'data_size'='287990088') - """ - - sql """ - alter table web_site modify column web_state set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='0', 'min_value'='AL', 'max_value'='WV', 'data_size'='108') - """ - - sql """ - alter table promotion modify column p_end_date_sk set stats ('row_count'='1500', 'ndv'='683', 'num_nulls'='18', 'min_value'='2450113', 'max_value'='2450967', 'data_size'='12000') - """ - - sql """ - alter table web_sales modify column ws_bill_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='180139', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_ext_ship_cost set stats ('row_count'='720000376', 'ndv'='567477', 'num_nulls'='180084', 'min_value'='0.00', 'max_value'='14950.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ship_addr_sk set stats ('row_count'='720000376', 'ndv'='6015811', 'num_nulls'='179848', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_ship_mode_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180017', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_warehouse_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180105', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_company_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') - """ - - sql """ - alter table store modify column s_gmt_offset set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='6', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_manager set stats ('row_count'='1002', 'ndv'='739', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Clifton', 'data_size'='12649') - """ - - sql """ - alter table store modify column s_street_number set stats ('row_count'='1002', 'ndv'='521', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='2874') - """ - - sql """ - alter table time_dim modify column t_meal_time set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='lunch', 'data_size'='248400') - """ - - sql """ - alter table time_dim modify column t_time set stats ('row_count'='86400', 'ndv'='86684', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='345600') - """ - - sql """ - alter table web_page modify column wp_creation_date_sk set stats ('row_count'='3000', 'ndv'='199', 'num_nulls'='33', 'min_value'='2450604', 'max_value'='2450815', 'data_size'='24000') - """ - - sql """ - alter table web_page modify column wp_customer_sk set stats ('row_count'='3000', 'ndv'='713', 'num_nulls'='2147', 'min_value'='9522', 'max_value'='11995685', 'data_size'='24000') - """ - - sql """ - alter table web_page modify column wp_max_ad_count set stats ('row_count'='3000', 'ndv'='5', 'num_nulls'='31', 'min_value'='0', 'max_value'='4', 'data_size'='12000') - """ - - sql """ - alter table web_page modify column wp_url set stats ('row_count'='3000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='http://www.foo.com', 'data_size'='53406') - """ - - sql """ - alter table store_returns modify column sr_refunded_cash set stats ('row_count'='287999764', 'ndv'='928470', 'num_nulls'='10081294', 'min_value'='0.00', 'max_value'='18173.96', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_return_tax set stats ('row_count'='287999764', 'ndv'='117247', 'num_nulls'='10081332', 'min_value'='0.00', 'max_value'='1682.04', 'data_size'='1151999056') - """ - - sql """ - alter table store_sales modify column ss_customer_sk set stats ('row_count'='2879987999', 'ndv'='12157481', 'num_nulls'='129590766', 'min_value'='1', 'max_value'='12000000', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_hdemo_sk set stats ('row_count'='2879987999', 'ndv'='7251', 'num_nulls'='129594559', 'min_value'='1', 'max_value'='7200', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_store_sk set stats ('row_count'='2879987999', 'ndv'='499', 'num_nulls'='129572050', 'min_value'='1', 'max_value'='1000', 'data_size'='23039903992') - """ - - sql """ - alter table ship_mode modify column sm_ship_mode_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') - """ - - sql """ - alter table ship_mode modify column sm_ship_mode_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') - """ - - sql """ - alter table customer modify column c_first_name set stats ('row_count'='12000000', 'ndv'='5140', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma', 'data_size'='67593278') - """ - - sql """ - alter table customer modify column c_first_sales_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='419856', 'min_value'='2448998', 'max_value'='2452648', 'data_size'='96000000') - """ - - sql """ - alter table customer modify column c_first_shipto_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='420769', 'min_value'='2449028', 'max_value'='2452678', 'data_size'='96000000') - """ - - sql """ - alter table customer_demographics modify column cd_dep_college_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') - """ - - sql """ - alter table date_dim modify column d_dow set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_fy_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_qoy set stats ('row_count'='73049', 'ndv'='4', 'num_nulls'='0', 'min_value'='1', 'max_value'='4', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') - """ - - sql """ - alter table warehouse modify column w_street_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Elm', 'data_size'='176') - """ - - sql """ - alter table warehouse modify column w_suite_number set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite X', 'data_size'='150') - """ - - sql """ - alter table catalog_sales modify column cs_bill_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7202134', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_bill_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7198837', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_ext_ship_cost set stats ('row_count'='1439980416', 'ndv'='573238', 'num_nulls'='7202537', 'min_value'='0.00', 'max_value'='14994.00', 'data_size'='5759921664') - """ - - sql """ - alter table call_center modify column cc_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='California', 'max_value'='Pacific Northwest_2', 'data_size'='572') - """ - - sql """ - alter table call_center modify column cc_street_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='1st', 'max_value'='Willow', 'data_size'='356') - """ - - sql """ - alter table call_center modify column cc_zip set stats ('row_count'='42', 'ndv'='19', 'num_nulls'='0', 'min_value'='18605', 'max_value'='98048', 'data_size'='210') - """ - - sql """ - alter table inventory modify column inv_quantity_on_hand set stats ('row_count'='783000000', 'ndv'='1006', 'num_nulls'='39153758', 'min_value'='0', 'max_value'='1000', 'data_size'='3132000000') - """ - - sql """ - alter table catalog_returns modify column cr_catalog_page_sk set stats ('row_count'='143996756', 'ndv'='17005', 'num_nulls'='2882502', 'min_value'='1', 'max_value'='25207', 'data_size'='1151974048') - """ - - sql """ - alter table household_demographics modify column hd_income_band_sk set stats ('row_count'='7200', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='57600') - """ - - sql """ - alter table catalog_page modify column cp_description set stats ('row_count'='30000', 'ndv'='30141', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters worry both workers. Fascinating characters take cheap never alive studies. Direct, old', 'data_size'='2215634') - """ - - sql """ - alter table item modify column i_item_id set stats ('row_count'='300000', 'ndv'='150851', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPBAAA', 'data_size'='4800000') - """ - - sql """ - alter table web_returns modify column wr_account_credit set stats ('row_count'='71997522', 'ndv'='683955', 'num_nulls'='3241972', 'min_value'='0.00', 'max_value'='23166.33', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_net_loss set stats ('row_count'='71997522', 'ndv'='815608', 'num_nulls'='3240573', 'min_value'='0.50', 'max_value'='15887.84', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_return_amt set stats ('row_count'='71997522', 'ndv'='808311', 'num_nulls'='3238405', 'min_value'='0.00', 'max_value'='29191.00', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_return_amt_inc_tax set stats ('row_count'='71997522', 'ndv'='1359913', 'num_nulls'='3239765', 'min_value'='0.00', 'max_value'='30393.01', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_return_quantity set stats ('row_count'='71997522', 'ndv'='100', 'num_nulls'='3238643', 'min_value'='1', 'max_value'='100', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_returning_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239658', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_returning_customer_sk set stats ('row_count'='71997522', 'ndv'='12119220', 'num_nulls'='3237281', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') - """ - - sql """ - alter table web_site modify column web_mkt_desc set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Acres see else children. Mutual too', 'max_value'='Windows increase to a differences. Other parties might in', 'data_size'='3473') - """ - - sql """ - alter table web_site modify column web_mkt_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='1', 'min_value'='1', 'max_value'='6', 'data_size'='216') - """ - - sql """ - alter table web_site modify column web_rec_end_date set stats ('row_count'='54', 'ndv'='3', 'num_nulls'='27', 'min_value'='1999-08-16', 'max_value'='2001-08-15', 'data_size'='216') - """ - - sql """ - alter table web_site modify column web_site_id set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='864') - """ - - sql """ - alter table web_site modify column web_street_type set stats ('row_count'='54', 'ndv'='20', 'num_nulls'='0', 'min_value'='Ave', 'max_value'='Wy', 'data_size'='208') - """ - - sql """ - alter table promotion modify column p_channel_demo set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') - """ - - sql """ - alter table promotion modify column p_channel_details set stats ('row_count'='1500', 'ndv'='1490', 'num_nulls'='0', 'min_value'='', 'max_value'='Young, valuable companies watch walls. Payments can flour', 'data_size'='59126') - """ - - sql """ - alter table promotion modify column p_channel_event set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') - """ - - sql """ - alter table promotion modify column p_discount_active set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1473') - """ - - sql """ - alter table promotion modify column p_promo_sk set stats ('row_count'='1500', 'ndv'='1489', 'num_nulls'='0', 'min_value'='1', 'max_value'='1500', 'data_size'='12000') - """ - - sql """ - alter table promotion modify column p_purpose set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='10374') - """ - - sql """ - alter table web_sales modify column ws_bill_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='179788', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_sold_date_sk set stats ('row_count'='720000376', 'ndv'='1820', 'num_nulls'='179921', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_web_site_sk set stats ('row_count'='720000376', 'ndv'='54', 'num_nulls'='179930', 'min_value'='1', 'max_value'='54', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_city set stats ('row_count'='1002', 'ndv'='55', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='9238') - """ - - sql """ - alter table store modify column s_company_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='7', 'min_value'='1', 'max_value'='1', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_county set stats ('row_count'='1002', 'ndv'='28', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='14291') - """ - - sql """ - alter table store modify column s_geography_class set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6972') - """ - - sql """ - alter table store modify column s_hours set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='8AM-8AM', 'data_size'='7088') - """ - - sql """ - alter table store modify column s_store_id set stats ('row_count'='1002', 'ndv'='501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPBAAAAA', 'data_size'='16032') - """ - - sql """ - alter table store modify column s_zip set stats ('row_count'='1002', 'ndv'='354', 'num_nulls'='0', 'min_value'='', 'max_value'='99454', 'data_size'='4975') - """ - - sql """ - alter table time_dim modify column t_am_pm set stats ('row_count'='86400', 'ndv'='2', 'num_nulls'='0', 'min_value'='AM', 'max_value'='PM', 'data_size'='172800') - """ - - sql """ - alter table time_dim modify column t_minute set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') - """ - - sql """ - alter table web_page modify column wp_web_page_id set stats ('row_count'='3000', 'ndv'='1501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPKAAAAA', 'data_size'='48000') - """ - - sql """ - alter table web_page modify column wp_web_page_sk set stats ('row_count'='3000', 'ndv'='2984', 'num_nulls'='0', 'min_value'='1', 'max_value'='3000', 'data_size'='24000') - """ - - sql """ - alter table store_returns modify column sr_return_amt set stats ('row_count'='287999764', 'ndv'='671228', 'num_nulls'='10080055', 'min_value'='0.00', 'max_value'='19434.00', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_returned_date_sk set stats ('row_count'='287999764', 'ndv'='2010', 'num_nulls'='10079607', 'min_value'='2450820', 'max_value'='2452822', 'data_size'='2303998112') - """ - - sql """ - alter table store_sales modify column ss_ext_tax set stats ('row_count'='2879987999', 'ndv'='149597', 'num_nulls'='129588732', 'min_value'='0.00', 'max_value'='1797.48', 'data_size'='11519951996') - """ - - sql """ - alter table customer modify column c_current_cdemo_sk set stats ('row_count'='12000000', 'ndv'='1913901', 'num_nulls'='419895', 'min_value'='1', 'max_value'='1920800', 'data_size'='96000000') - """ - - sql """ - alter table customer modify column c_customer_id set stats ('row_count'='12000000', 'ndv'='11921032', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPKAA', 'data_size'='192000000') - """ - - sql """ - alter table date_dim modify column d_current_day set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_current_month set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_date set stats ('row_count'='73049', 'ndv'='73250', 'num_nulls'='0', 'min_value'='1900-01-02', 'max_value'='2100-01-01', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_moy set stats ('row_count'='73049', 'ndv'='12', 'num_nulls'='0', 'min_value'='1', 'max_value'='12', 'data_size'='292196') - """ - - sql """ - alter table warehouse modify column w_gmt_offset set stats ('row_count'='20', 'ndv'='3', 'num_nulls'='1', 'min_value'='-7.00', 'max_value'='-5.00', 'data_size'='80') - """ - - sql """ - alter table warehouse modify column w_warehouse_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') - """ - - sql """ - alter table warehouse modify column w_warehouse_sq_ft set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='1', 'min_value'='73065', 'max_value'='977787', 'data_size'='80') - """ - - sql """ - alter table catalog_sales modify column cs_ext_sales_price set stats ('row_count'='1439980416', 'ndv'='1100662', 'num_nulls'='7199625', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_ext_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='393180', 'num_nulls'='7199876', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_item_sk set stats ('row_count'='1439980416', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_net_paid_inc_tax set stats ('row_count'='1439980416', 'ndv'='2422238', 'num_nulls'='7200702', 'min_value'='0.00', 'max_value'='32376.27', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_ship_date_sk set stats ('row_count'='1439980416', 'ndv'='1933', 'num_nulls'='7200707', 'min_value'='2450817', 'max_value'='2452744', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_warehouse_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7200688', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') - """ - - sql """ - alter table call_center modify column cc_division set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_division_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='164') - """ - - sql """ - alter table call_center modify column cc_manager set stats ('row_count'='42', 'ndv'='28', 'num_nulls'='0', 'min_value'='Alden Snyder', 'max_value'='Wayne Ray', 'data_size'='519') - """ - - sql """ - alter table call_center modify column cc_rec_start_date set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='1998-01-01', 'max_value'='2002-01-01', 'data_size'='168') - """ - - sql """ - alter table catalog_returns modify column cr_call_center_sk set stats ('row_count'='143996756', 'ndv'='42', 'num_nulls'='2881668', 'min_value'='1', 'max_value'='42', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_net_loss set stats ('row_count'='143996756', 'ndv'='911034', 'num_nulls'='2881704', 'min_value'='0.50', 'max_value'='16095.08', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_refunded_customer_sk set stats ('row_count'='143996756', 'ndv'='12156363', 'num_nulls'='2879017', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_refunded_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882107', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_returning_customer_sk set stats ('row_count'='143996756', 'ndv'='12157481', 'num_nulls'='2879023', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') - """ - - sql """ - alter table customer_address modify column ca_gmt_offset set stats ('row_count'='6000000', 'ndv'='6', 'num_nulls'='180219', 'min_value'='-10.00', 'max_value'='-5.00', 'data_size'='24000000') - """ - - sql """ - alter table item modify column i_color set stats ('row_count'='300000', 'ndv'='93', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow', 'data_size'='1610293') - """ - - sql """ - alter table item modify column i_manufact set stats ('row_count'='300000', 'ndv'='1004', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripri', 'data_size'='3379693') - """ - - sql """ - alter table item modify column i_product_name set stats ('row_count'='300000', 'ndv'='294994', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripripripriought', 'data_size'='6849199') - """ - - sql """ - alter table web_returns modify column wr_returned_time_sk set stats ('row_count'='71997522', 'ndv'='87677', 'num_nulls'='3238574', 'min_value'='0', 'max_value'='86399', 'data_size'='575980176') - """ - - sql """ - alter table web_site modify column web_manager set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='William Young', 'data_size'='658') - """ - - sql """ - alter table web_site modify column web_mkt_class set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='Written, political plans show to the models. T', 'data_size'='1822') - """ - - sql """ - alter table web_site modify column web_rec_start_date set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='2', 'min_value'='1997-08-16', 'max_value'='2001-08-16', 'data_size'='216') - """ - - sql """ - alter table web_site modify column web_street_number set stats ('row_count'='54', 'ndv'='36', 'num_nulls'='0', 'min_value'='', 'max_value'='983', 'data_size'='154') - """ - - sql """ - alter table promotion modify column p_channel_catalog set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') - """ - - sql """ - alter table promotion modify column p_promo_id set stats ('row_count'='1500', 'ndv'='1519', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPEAAAAA', 'data_size'='24000') - """ - - sql """ - alter table web_sales modify column ws_bill_customer_sk set stats ('row_count'='720000376', 'ndv'='12103729', 'num_nulls'='179817', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_list_price set stats ('row_count'='720000376', 'ndv'='29396', 'num_nulls'='180053', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_sales_price set stats ('row_count'='720000376', 'ndv'='29288', 'num_nulls'='180005', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ship_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='179824', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_closed_date_sk set stats ('row_count'='1002', 'ndv'='163', 'num_nulls'='729', 'min_value'='2450820', 'max_value'='2451313', 'data_size'='8016') - """ - - sql """ - alter table store modify column s_division_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='6', 'min_value'='1', 'max_value'='1', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_market_desc set stats ('row_count'='1002', 'ndv'='765', 'num_nulls'='0', 'min_value'='', 'max_value'='Yesterday left factors handle continuing co', 'data_size'='57638') - """ - - sql """ - alter table store modify column s_market_id set stats ('row_count'='1002', 'ndv'='10', 'num_nulls'='8', 'min_value'='1', 'max_value'='10', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_state set stats ('row_count'='1002', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='WV', 'data_size'='1994') - """ - - sql """ - alter table store modify column s_store_sk set stats ('row_count'='1002', 'ndv'='988', 'num_nulls'='0', 'min_value'='1', 'max_value'='1002', 'data_size'='8016') - """ - - sql """ - alter table store modify column s_street_name set stats ('row_count'='1002', 'ndv'='549', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Oak', 'data_size'='8580') - """ - - sql """ - alter table web_page modify column wp_access_date_sk set stats ('row_count'='3000', 'ndv'='101', 'num_nulls'='31', 'min_value'='2452548', 'max_value'='2452648', 'data_size'='24000') - """ - - sql """ - alter table web_page modify column wp_char_count set stats ('row_count'='3000', 'ndv'='1883', 'num_nulls'='42', 'min_value'='303', 'max_value'='8523', 'data_size'='12000') - """ - - sql """ - alter table store_returns modify column sr_addr_sk set stats ('row_count'='287999764', 'ndv'='6015811', 'num_nulls'='10082311', 'min_value'='1', 'max_value'='6000000', 'data_size'='2303998112') - """ - - sql """ - alter table store_returns modify column sr_return_time_sk set stats ('row_count'='287999764', 'ndv'='32660', 'num_nulls'='10082805', 'min_value'='28799', 'max_value'='61199', 'data_size'='2303998112') - """ - - sql """ - alter table store_returns modify column sr_store_sk set stats ('row_count'='287999764', 'ndv'='499', 'num_nulls'='10081871', 'min_value'='1', 'max_value'='1000', 'data_size'='2303998112') - """ - - sql """ - alter table store_sales modify column ss_coupon_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_sales_price set stats ('row_count'='2879987999', 'ndv'='19780', 'num_nulls'='129598061', 'min_value'='0.00', 'max_value'='200.00', 'data_size'='11519951996') - """ - - sql """ - alter table customer modify column c_birth_country set stats ('row_count'='12000000', 'ndv'='211', 'num_nulls'='0', 'min_value'='', 'max_value'='ZIMBABWE', 'data_size'='100750845') - """ - - sql """ - alter table customer modify column c_birth_month set stats ('row_count'='12000000', 'ndv'='12', 'num_nulls'='419629', 'min_value'='1', 'max_value'='12', 'data_size'='48000000') - """ - - sql """ - alter table customer modify column c_customer_sk set stats ('row_count'='12000000', 'ndv'='12157481', 'num_nulls'='0', 'min_value'='1', 'max_value'='12000000', 'data_size'='96000000') - """ - - sql """ - alter table customer modify column c_email_address set stats ('row_count'='12000000', 'ndv'='11642077', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma.Young@aDhzZzCzYN.edu', 'data_size'='318077849') - """ - - sql """ - alter table customer modify column c_last_review_date_sk set stats ('row_count'='12000000', 'ndv'='366', 'num_nulls'='419900', 'min_value'='2452283', 'max_value'='2452648', 'data_size'='96000000') - """ - - sql """ - alter table customer modify column c_preferred_cust_flag set stats ('row_count'='12000000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='11580510') - """ - - sql """ - alter table dbgen_version modify column dv_version set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='3.2.0', 'max_value'='3.2.0', 'data_size'='5') - """ - - sql """ - alter table customer_demographics modify column cd_purchase_estimate set stats ('row_count'='1920800', 'ndv'='20', 'num_nulls'='0', 'min_value'='500', 'max_value'='10000', 'data_size'='7683200') - """ - - sql """ - alter table reason modify column r_reason_id set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPDAAAAAA', 'data_size'='1040') - """ - - sql """ - alter table reason modify column r_reason_sk set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='1', 'max_value'='65', 'data_size'='520') - """ - - sql """ - alter table date_dim modify column d_current_week set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_first_dom set stats ('row_count'='73049', 'ndv'='2410', 'num_nulls'='0', 'min_value'='2415021', 'max_value'='2488070', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_fy_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_last_dom set stats ('row_count'='73049', 'ndv'='2419', 'num_nulls'='0', 'min_value'='2415020', 'max_value'='2488372', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_month_seq set stats ('row_count'='73049', 'ndv'='2398', 'num_nulls'='0', 'min_value'='0', 'max_value'='2400', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_quarter_name set stats ('row_count'='73049', 'ndv'='799', 'num_nulls'='0', 'min_value'='1900Q1', 'max_value'='2100Q1', 'data_size'='438294') - """ - - sql """ - alter table warehouse modify column w_county set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='Bronx County', 'max_value'='Ziebach County', 'data_size'='291') - """ - - sql """ - alter table warehouse modify column w_street_number set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='0', 'min_value'='', 'max_value'='957', 'data_size'='54') - """ - - sql """ - alter table warehouse modify column w_warehouse_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Therefore urg', 'data_size'='307') - """ - - sql """ - alter table catalog_sales modify column cs_ext_discount_amt set stats ('row_count'='1439980416', 'ndv'='1100115', 'num_nulls'='7201054', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_net_paid_inc_ship_tax set stats ('row_count'='1439980416', 'ndv'='3312360', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46593.36', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_promo_sk set stats ('row_count'='1439980416', 'ndv'='1489', 'num_nulls'='7202844', 'min_value'='1', 'max_value'='1500', 'data_size'='11519843328') - """ - - sql """ - alter table call_center modify column cc_call_center_id set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='672') - """ - - sql """ - alter table call_center modify column cc_employees set stats ('row_count'='42', 'ndv'='30', 'num_nulls'='0', 'min_value'='69020', 'max_value'='6879074', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_suite_number set stats ('row_count'='42', 'ndv'='18', 'num_nulls'='0', 'min_value'='Suite 0', 'max_value'='Suite W', 'data_size'='326') - """ - - sql """ - alter table catalog_returns modify column cr_item_sk set stats ('row_count'='143996756', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_reason_sk set stats ('row_count'='143996756', 'ndv'='65', 'num_nulls'='2881950', 'min_value'='1', 'max_value'='65', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_return_ship_cost set stats ('row_count'='143996756', 'ndv'='483467', 'num_nulls'='2883436', 'min_value'='0.00', 'max_value'='14273.28', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_ship_mode_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2879879', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_store_credit set stats ('row_count'='143996756', 'ndv'='802237', 'num_nulls'='2880469', 'min_value'='0.00', 'max_value'='23215.15', 'data_size'='575987024') - """ - - sql """ - alter table customer_address modify column ca_city set stats ('row_count'='6000000', 'ndv'='977', 'num_nulls'='0', 'min_value'='', 'max_value'='Zion', 'data_size'='52096290') - """ - - sql """ - alter table customer_address modify column ca_state set stats ('row_count'='6000000', 'ndv'='52', 'num_nulls'='0', 'min_value'='', 'max_value'='WY', 'data_size'='11640128') - """ - - sql """ - alter table customer_address modify column ca_street_name set stats ('row_count'='6000000', 'ndv'='8173', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Woodland', 'data_size'='50697257') - """ - - sql """ - alter table customer_address modify column ca_street_type set stats ('row_count'='6000000', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='24441630') - """ - - sql """ - alter table catalog_page modify column cp_catalog_number set stats ('row_count'='30000', 'ndv'='109', 'num_nulls'='297', 'min_value'='1', 'max_value'='109', 'data_size'='120000') - """ - - sql """ - alter table catalog_page modify column cp_catalog_page_number set stats ('row_count'='30000', 'ndv'='279', 'num_nulls'='294', 'min_value'='1', 'max_value'='277', 'data_size'='120000') - """ - - sql """ - alter table catalog_page modify column cp_catalog_page_sk set stats ('row_count'='30000', 'ndv'='30439', 'num_nulls'='0', 'min_value'='1', 'max_value'='30000', 'data_size'='240000') - """ - - sql """ - alter table catalog_page modify column cp_start_date_sk set stats ('row_count'='30000', 'ndv'='91', 'num_nulls'='286', 'min_value'='2450815', 'max_value'='2453005', 'data_size'='120000') - """ - - sql """ - alter table item modify column i_rec_start_date set stats ('row_count'='300000', 'ndv'='4', 'num_nulls'='784', 'min_value'='1997-10-27', 'max_value'='2001-10-27', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_units set stats ('row_count'='300000', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='1253652') - """ - - sql """ - alter table web_returns modify column wr_refunded_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238545', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_return_ship_cost set stats ('row_count'='71997522', 'ndv'='451263', 'num_nulls'='3239048', 'min_value'='0.00', 'max_value'='14352.10', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_returned_date_sk set stats ('row_count'='71997522', 'ndv'='2188', 'num_nulls'='3239259', 'min_value'='2450819', 'max_value'='2453002', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_returning_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3239192', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') - """ - - sql """ - alter table web_site modify column web_suite_number set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Suite 100', 'max_value'='Suite Y', 'data_size'='430') - """ - - sql """ - alter table promotion modify column p_start_date_sk set stats ('row_count'='1500', 'ndv'='685', 'num_nulls'='23', 'min_value'='2450096', 'max_value'='2450915', 'data_size'='12000') - """ - - sql """ - alter table web_sales modify column ws_coupon_amt set stats ('row_count'='720000376', 'ndv'='1505315', 'num_nulls'='179933', 'min_value'='0.00', 'max_value'='28824.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ext_wholesale_cost set stats ('row_count'='720000376', 'ndv'='393180', 'num_nulls'='180060', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_net_paid_inc_ship set stats ('row_count'='720000376', 'ndv'='2414838', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='44263.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ship_date_sk set stats ('row_count'='720000376', 'ndv'='1952', 'num_nulls'='180011', 'min_value'='2450817', 'max_value'='2452762', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_web_page_sk set stats ('row_count'='720000376', 'ndv'='2984', 'num_nulls'='179732', 'min_value'='1', 'max_value'='3000', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_country set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='12961') - """ - - sql """ - alter table store modify column s_store_name set stats ('row_count'='1002', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='3916') - """ - - sql """ - alter table time_dim modify column t_second set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') - """ - - sql """ - alter table time_dim modify column t_sub_shift set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='afternoon', 'max_value'='night', 'data_size'='597600') - """ - - sql """ - alter table web_page modify column wp_image_count set stats ('row_count'='3000', 'ndv'='7', 'num_nulls'='26', 'min_value'='1', 'max_value'='7', 'data_size'='12000') - """ - - sql """ - alter table web_page modify column wp_type set stats ('row_count'='3000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='welcome', 'data_size'='18867') - """ - - sql """ - alter table store_returns modify column sr_customer_sk set stats ('row_count'='287999764', 'ndv'='12157481', 'num_nulls'='10081624', 'min_value'='1', 'max_value'='12000000', 'data_size'='2303998112') - """ - - sql """ - alter table store_returns modify column sr_hdemo_sk set stats ('row_count'='287999764', 'ndv'='7251', 'num_nulls'='10083275', 'min_value'='1', 'max_value'='7200', 'data_size'='2303998112') - """ - - sql """ - alter table store_sales modify column ss_addr_sk set stats ('row_count'='2879987999', 'ndv'='6015811', 'num_nulls'='129589799', 'min_value'='1', 'max_value'='6000000', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_item_sk set stats ('row_count'='2879987999', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_quantity set stats ('row_count'='2879987999', 'ndv'='100', 'num_nulls'='129584258', 'min_value'='1', 'max_value'='100', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_ticket_number set stats ('row_count'='2879987999', 'ndv'='238830448', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='9905', 'num_nulls'='129590273', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='11519951996') - """ - - sql """ - alter table ship_mode modify column sm_type set stats ('row_count'='20', 'ndv'='6', 'num_nulls'='0', 'min_value'='EXPRESS', 'max_value'='TWO DAY', 'data_size'='150') - """ - - sql """ - alter table customer modify column c_current_addr_sk set stats ('row_count'='12000000', 'ndv'='5243359', 'num_nulls'='0', 'min_value'='3', 'max_value'='6000000', 'data_size'='96000000') - """ - - sql """ - alter table customer modify column c_last_name set stats ('row_count'='12000000', 'ndv'='4990', 'num_nulls'='0', 'min_value'='', 'max_value'='Zuniga', 'data_size'='70991730') - """ - - sql """ - alter table dbgen_version modify column dv_cmdline_args set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'max_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'data_size'='86') - """ - - sql """ - alter table date_dim modify column d_current_quarter set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_date_sk set stats ('row_count'='73049', 'ndv'='73042', 'num_nulls'='0', 'min_value'='2415022', 'max_value'='2488070', 'data_size'='584392') - """ - - sql """ - alter table date_dim modify column d_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table warehouse modify column w_country set stats ('row_count'='20', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='260') - """ - - sql """ - alter table warehouse modify column w_state set stats ('row_count'='20', 'ndv'='13', 'num_nulls'='0', 'min_value'='AL', 'max_value'='TN', 'data_size'='40') - """ - - sql """ - alter table catalog_sales modify column cs_bill_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7199539', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_bill_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201919', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_net_paid set stats ('row_count'='1439980416', 'ndv'='1809875', 'num_nulls'='7197668', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_ship_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7198232', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_ship_mode_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7201083', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_sold_date_sk set stats ('row_count'='1439980416', 'ndv'='1835', 'num_nulls'='7203326', 'min_value'='2450815', 'max_value'='2452654', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_sold_time_sk set stats ('row_count'='1439980416', 'ndv'='87677', 'num_nulls'='7201329', 'min_value'='0', 'max_value'='86399', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='9905', 'num_nulls'='7201098', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='5759921664') - """ - - sql """ - alter table call_center modify column cc_company_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='160') - """ - - sql """ - alter table call_center modify column cc_market_manager set stats ('row_count'='42', 'ndv'='35', 'num_nulls'='0', 'min_value'='Cesar Allen', 'max_value'='William Larsen', 'data_size'='524') - """ - - sql """ - alter table call_center modify column cc_mkt_id set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_street_type set stats ('row_count'='42', 'ndv'='11', 'num_nulls'='0', 'min_value'='Avenue', 'max_value'='Way', 'data_size'='184') - """ - - sql """ - alter table catalog_returns modify column cr_return_tax set stats ('row_count'='143996756', 'ndv'='149828', 'num_nulls'='2881611', 'min_value'='0.00', 'max_value'='2511.58', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_returning_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2880543', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_returning_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882692', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_reversed_charge set stats ('row_count'='143996756', 'ndv'='802509', 'num_nulls'='2881215', 'min_value'='0.00', 'max_value'='24033.84', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_warehouse_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2882192', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') - """ - - sql """ - alter table household_demographics modify column hd_demo_sk set stats ('row_count'='7200', 'ndv'='7251', 'num_nulls'='0', 'min_value'='1', 'max_value'='7200', 'data_size'='57600') - """ - - sql """ - alter table household_demographics modify column hd_vehicle_count set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='-1', 'max_value'='4', 'data_size'='28800') - """ - - sql """ - alter table customer_address modify column ca_zip set stats ('row_count'='6000000', 'ndv'='9253', 'num_nulls'='0', 'min_value'='', 'max_value'='99981', 'data_size'='29097610') - """ - - sql """ - alter table income_band modify column ib_income_band_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') - """ - - sql """ - alter table catalog_page modify column cp_type set stats ('row_count'='30000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='quarterly', 'data_size'='227890') - """ - - sql """ - alter table item modify column i_brand set stats ('row_count'='300000', 'ndv'='714', 'num_nulls'='0', 'min_value'='', 'max_value'='univunivamalg #9', 'data_size'='4834917') - """ - - sql """ - alter table item modify column i_formulation set stats ('row_count'='300000', 'ndv'='224757', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow98911509228741', 'data_size'='5984460') - """ - - sql """ - alter table item modify column i_item_desc set stats ('row_count'='300000', 'ndv'='217721', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters used to save quite colour', 'data_size'='30093342') - """ - - sql """ - alter table web_returns modify column wr_fee set stats ('row_count'='71997522', 'ndv'='9958', 'num_nulls'='3238926', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_item_sk set stats ('row_count'='71997522', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_reason_sk set stats ('row_count'='71997522', 'ndv'='65', 'num_nulls'='3238897', 'min_value'='1', 'max_value'='65', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_refunded_customer_sk set stats ('row_count'='71997522', 'ndv'='12117831', 'num_nulls'='3242433', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') - """ - - sql """ - alter table web_site modify column web_city set stats ('row_count'='54', 'ndv'='31', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='491') - """ - - sql """ - alter table web_site modify column web_close_date_sk set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='10', 'min_value'='2441265', 'max_value'='2446218', 'data_size'='432') - """ - - sql """ - alter table web_site modify column web_company_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='216') - """ - - sql """ - alter table web_site modify column web_company_name set stats ('row_count'='54', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='203') - """ - - sql """ - alter table web_site modify column web_county set stats ('row_count'='54', 'ndv'='25', 'num_nulls'='0', 'min_value'='', 'max_value'='Williamson County', 'data_size'='762') - """ - - sql """ - alter table web_site modify column web_name set stats ('row_count'='54', 'ndv'='10', 'num_nulls'='0', 'min_value'='', 'max_value'='site_8', 'data_size'='312') - """ - - sql """ - alter table web_site modify column web_open_date_sk set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='1', 'min_value'='2450373', 'max_value'='2450807', 'data_size'='432') - """ - - sql """ - alter table promotion modify column p_channel_dmail set stats ('row_count'='1500', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='1483') - """ - - sql """ - alter table promotion modify column p_channel_press set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') - """ - - sql """ - alter table promotion modify column p_channel_radio set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') - """ - - sql """ - alter table promotion modify column p_cost set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='18', 'min_value'='1000.00', 'max_value'='1000.00', 'data_size'='12000') - """ - - sql """ - alter table web_sales modify column ws_ext_tax set stats ('row_count'='720000376', 'ndv'='211413', 'num_nulls'='179695', 'min_value'='0.00', 'max_value'='2682.90', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_item_sk set stats ('row_count'='720000376', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_net_paid set stats ('row_count'='720000376', 'ndv'='1749360', 'num_nulls'='179970', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_net_paid_inc_ship_tax set stats ('row_count'='720000376', 'ndv'='3224829', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46004.19', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_net_paid_inc_tax set stats ('row_count'='720000376', 'ndv'='2354996', 'num_nulls'='179972', 'min_value'='0.00', 'max_value'='32492.90', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_order_number set stats ('row_count'='720000376', 'ndv'='60401176', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_quantity set stats ('row_count'='720000376', 'ndv'='100', 'num_nulls'='179781', 'min_value'='1', 'max_value'='100', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ship_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='180290', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_sold_time_sk set stats ('row_count'='720000376', 'ndv'='87677', 'num_nulls'='179980', 'min_value'='0', 'max_value'='86399', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_street_type set stats ('row_count'='1002', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='4189') - """ - - sql """ - alter table web_page modify column wp_autogen_flag set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='2962') - """ - - sql """ - alter table web_page modify column wp_rec_start_date set stats ('row_count'='3000', 'ndv'='4', 'num_nulls'='29', 'min_value'='1997-09-03', 'max_value'='2001-09-03', 'data_size'='12000') - """ - - sql """ - alter table store_returns modify column sr_net_loss set stats ('row_count'='287999764', 'ndv'='714210', 'num_nulls'='10080716', 'min_value'='0.50', 'max_value'='10776.08', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_return_amt_inc_tax set stats ('row_count'='287999764', 'ndv'='1259368', 'num_nulls'='10076879', 'min_value'='0.00', 'max_value'='20454.63', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_return_quantity set stats ('row_count'='287999764', 'ndv'='100', 'num_nulls'='10082815', 'min_value'='1', 'max_value'='100', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_return_ship_cost set stats ('row_count'='287999764', 'ndv'='355844', 'num_nulls'='10081927', 'min_value'='0.00', 'max_value'='9767.34', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_reversed_charge set stats ('row_count'='287999764', 'ndv'='700618', 'num_nulls'='10085976', 'min_value'='0.00', 'max_value'='17339.42', 'data_size'='1151999056') - """ - - sql """ - alter table store_sales modify column ss_net_paid_inc_tax set stats ('row_count'='2879987999', 'ndv'='1681767', 'num_nulls'='129609050', 'min_value'='0.00', 'max_value'='21769.48', 'data_size'='11519951996') - """ - - sql """ - alter table customer modify column c_birth_day set stats ('row_count'='12000000', 'ndv'='31', 'num_nulls'='420361', 'min_value'='1', 'max_value'='31', 'data_size'='48000000') - """ - - sql """ - alter table customer_demographics modify column cd_credit_rating set stats ('row_count'='1920800', 'ndv'='4', 'num_nulls'='0', 'min_value'='Good', 'max_value'='Unknown', 'data_size'='13445600') - """ - - sql """ - alter table customer_demographics modify column cd_demo_sk set stats ('row_count'='1920800', 'ndv'='1916366', 'num_nulls'='0', 'min_value'='1', 'max_value'='1920800', 'data_size'='15366400') - """ - - sql """ - alter table customer_demographics modify column cd_dep_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') - """ - - sql """ - alter table customer_demographics modify column cd_education_status set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='2 yr Degree', 'max_value'='Unknown', 'data_size'='18384800') - """ - - sql """ - alter table customer_demographics modify column cd_gender set stats ('row_count'='1920800', 'ndv'='2', 'num_nulls'='0', 'min_value'='F', 'max_value'='M', 'data_size'='1920800') - """ - - sql """ - alter table customer_demographics modify column cd_marital_status set stats ('row_count'='1920800', 'ndv'='5', 'num_nulls'='0', 'min_value'='D', 'max_value'='W', 'data_size'='1920800') - """ - - sql """ - alter table date_dim modify column d_date_id set stats ('row_count'='73049', 'ndv'='72907', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAFCAA', 'max_value'='AAAAAAAAPPPPECAA', 'data_size'='1168784') - """ - - sql """ - alter table date_dim modify column d_fy_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') - """ - - sql """ - alter table warehouse modify column w_warehouse_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') - """ - - sql """ - alter table catalog_sales modify column cs_ext_list_price set stats ('row_count'='1439980416', 'ndv'='1160303', 'num_nulls'='7199542', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_ext_tax set stats ('row_count'='1439980416', 'ndv'='215267', 'num_nulls'='7200412', 'min_value'='0.00', 'max_value'='2673.27', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_quantity set stats ('row_count'='1439980416', 'ndv'='100', 'num_nulls'='7202885', 'min_value'='1', 'max_value'='100', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_ship_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7200151', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_ship_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201507', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') - """ - - sql """ - alter table call_center modify column cc_company set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_mkt_desc set stats ('row_count'='42', 'ndv'='33', 'num_nulls'='0', 'min_value'='Arms increase controversial, present so', 'max_value'='Young tests could buy comfortable, local users; o', 'data_size'='2419') - """ - - sql """ - alter table call_center modify column cc_open_date_sk set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='2450794', 'max_value'='2451146', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_rec_end_date set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='21', 'min_value'='2000-01-01', 'max_value'='2001-12-31', 'data_size'='168') - """ - - sql """ - alter table catalog_returns modify column cr_order_number set stats ('row_count'='143996756', 'ndv'='93476424', 'num_nulls'='0', 'min_value'='2', 'max_value'='160000000', 'data_size'='1151974048') - """ - - sql """ - alter table catalog_returns modify column cr_return_amount set stats ('row_count'='143996756', 'ndv'='882831', 'num_nulls'='2880424', 'min_value'='0.00', 'max_value'='28805.04', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_returned_date_sk set stats ('row_count'='143996756', 'ndv'='2108', 'num_nulls'='0', 'min_value'='2450821', 'max_value'='2452924', 'data_size'='1151974048') - """ - - sql """ - alter table income_band modify column ib_upper_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='10000', 'max_value'='200000', 'data_size'='80') - """ - - sql """ - alter table catalog_page modify column cp_department set stats ('row_count'='30000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='DEPARTMENT', 'data_size'='297110') - """ - - sql """ - alter table catalog_page modify column cp_end_date_sk set stats ('row_count'='30000', 'ndv'='97', 'num_nulls'='302', 'min_value'='2450844', 'max_value'='2453186', 'data_size'='120000') - """ - - sql """ - alter table item modify column i_brand_id set stats ('row_count'='300000', 'ndv'='951', 'num_nulls'='763', 'min_value'='1001001', 'max_value'='10016017', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_category set stats ('row_count'='300000', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='Women', 'data_size'='1766742') - """ - - sql """ - alter table item modify column i_class_id set stats ('row_count'='300000', 'ndv'='16', 'num_nulls'='722', 'min_value'='1', 'max_value'='16', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_item_sk set stats ('row_count'='300000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2400000') - """ - - sql """ - alter table item modify column i_manufact_id set stats ('row_count'='300000', 'ndv'='1005', 'num_nulls'='761', 'min_value'='1', 'max_value'='1000', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_wholesale_cost set stats ('row_count'='300000', 'ndv'='7243', 'num_nulls'='740', 'min_value'='0.02', 'max_value'='89.49', 'data_size'='1200000') - """ - - sql """ - alter table web_returns modify column wr_refunded_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3240352', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_return_tax set stats ('row_count'='71997522', 'ndv'='137392', 'num_nulls'='3237729', 'min_value'='0.00', 'max_value'='2551.16', 'data_size'='287990088') - """ - - sql """ - alter table web_returns modify column wr_returning_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238239', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_web_page_sk set stats ('row_count'='71997522', 'ndv'='2984', 'num_nulls'='3240387', 'min_value'='1', 'max_value'='3000', 'data_size'='575980176') - """ - - sql """ - alter table web_site modify column web_class set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='371') - """ - - sql """ - alter table web_site modify column web_zip set stats ('row_count'='54', 'ndv'='32', 'num_nulls'='0', 'min_value'='14593', 'max_value'='99431', 'data_size'='270') - """ - - sql """ - alter table promotion modify column p_channel_email set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1480') - """ - - sql """ - alter table promotion modify column p_item_sk set stats ('row_count'='1500', 'ndv'='1467', 'num_nulls'='19', 'min_value'='184', 'max_value'='299990', 'data_size'='12000') - """ - - sql """ - alter table promotion modify column p_promo_name set stats ('row_count'='1500', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='5896') - """ - - sql """ - alter table web_sales modify column ws_ext_discount_amt set stats ('row_count'='720000376', 'ndv'='1093513', 'num_nulls'='179851', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_ext_list_price set stats ('row_count'='720000376', 'ndv'='1160303', 'num_nulls'='179866', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_wholesale_cost set stats ('row_count'='720000376', 'ndv'='9905', 'num_nulls'='179834', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='2880001504') - """ - - sql """ - alter table store modify column s_market_manager set stats ('row_count'='1002', 'ndv'='732', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Perez', 'data_size'='12823') - """ - - sql """ - alter table store modify column s_number_employees set stats ('row_count'='1002', 'ndv'='101', 'num_nulls'='8', 'min_value'='200', 'max_value'='300', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_rec_end_date set stats ('row_count'='1002', 'ndv'='3', 'num_nulls'='501', 'min_value'='1999-03-13', 'max_value'='2001-03-12', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_rec_start_date set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='7', 'min_value'='1997-03-13', 'max_value'='2001-03-13', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_suite_number set stats ('row_count'='1002', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='7866') - """ - - sql """ - alter table time_dim modify column t_hour set stats ('row_count'='86400', 'ndv'='24', 'num_nulls'='0', 'min_value'='0', 'max_value'='23', 'data_size'='345600') - """ - - sql """ - alter table time_dim modify column t_shift set stats ('row_count'='86400', 'ndv'='3', 'num_nulls'='0', 'min_value'='first', 'max_value'='third', 'data_size'='460800') - """ - - sql """ - alter table web_page modify column wp_link_count set stats ('row_count'='3000', 'ndv'='24', 'num_nulls'='27', 'min_value'='2', 'max_value'='25', 'data_size'='12000') - """ - - sql """ - alter table web_page modify column wp_rec_end_date set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='1500', 'min_value'='1999-09-03', 'max_value'='2001-09-02', 'data_size'='12000') - """ - - sql """ - alter table store_returns modify column sr_cdemo_sk set stats ('row_count'='287999764', 'ndv'='1916366', 'num_nulls'='10076902', 'min_value'='1', 'max_value'='1920800', 'data_size'='2303998112') - """ - - sql """ - alter table store_returns modify column sr_item_sk set stats ('row_count'='287999764', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2303998112') - """ - - sql """ - alter table store_sales modify column ss_cdemo_sk set stats ('row_count'='2879987999', 'ndv'='1916366', 'num_nulls'='129602155', 'min_value'='1', 'max_value'='1920800', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_ext_discount_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_ext_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='393180', 'num_nulls'='129595018', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_list_price set stats ('row_count'='2879987999', 'ndv'='19640', 'num_nulls'='129597020', 'min_value'='1.00', 'max_value'='200.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_net_paid set stats ('row_count'='2879987999', 'ndv'='1288646', 'num_nulls'='129599407', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_sold_date_sk set stats ('row_count'='2879987999', 'ndv'='1820', 'num_nulls'='129600843', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='23039903992') - """ - - sql """ - alter table store_sales modify column ss_sold_time_sk set stats ('row_count'='2879987999', 'ndv'='47252', 'num_nulls'='129593012', 'min_value'='28800', 'max_value'='75599', 'data_size'='23039903992') - """ - - sql """ - alter table ship_mode modify column sm_carrier set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AIRBORNE', 'max_value'='ZOUROS', 'data_size'='133') - """ - - sql """ - alter table customer modify column c_birth_year set stats ('row_count'='12000000', 'ndv'='69', 'num_nulls'='419584', 'min_value'='1924', 'max_value'='1992', 'data_size'='48000000') - """ - - sql """ - alter table customer modify column c_login set stats ('row_count'='12000000', 'ndv'='1', 'num_nulls'='0', 'min_value'='', 'max_value'='', 'data_size'='0') - """ - - sql """ - alter table customer modify column c_salutation set stats ('row_count'='12000000', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='Sir', 'data_size'='37544445') - """ - - sql """ - alter table reason modify column r_reason_desc set stats ('row_count'='65', 'ndv'='64', 'num_nulls'='0', 'min_value'='Did not fit', 'max_value'='unauthoized purchase', 'data_size'='848') - """ - - sql """ - alter table date_dim modify column d_current_year set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table date_dim modify column d_dom set stats ('row_count'='73049', 'ndv'='31', 'num_nulls'='0', 'min_value'='1', 'max_value'='31', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_same_day_lq set stats ('row_count'='73049', 'ndv'='72231', 'num_nulls'='0', 'min_value'='2414930', 'max_value'='2487978', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') - """ - - sql """ - alter table date_dim modify column d_weekend set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') - """ - - sql """ - alter table warehouse modify column w_zip set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='19231', 'max_value'='89275', 'data_size'='100') - """ - - sql """ - alter table catalog_sales modify column cs_catalog_page_sk set stats ('row_count'='1439980416', 'ndv'='17005', 'num_nulls'='7199032', 'min_value'='1', 'max_value'='25207', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_coupon_amt set stats ('row_count'='1439980416', 'ndv'='1578778', 'num_nulls'='7198116', 'min_value'='0.00', 'max_value'='28730.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_list_price set stats ('row_count'='1439980416', 'ndv'='29396', 'num_nulls'='7201549', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_net_profit set stats ('row_count'='1439980416', 'ndv'='2058398', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19962.00', 'data_size'='5759921664') - """ - - sql """ - alter table catalog_sales modify column cs_order_number set stats ('row_count'='1439980416', 'ndv'='159051824', 'num_nulls'='0', 'min_value'='1', 'max_value'='160000000', 'data_size'='11519843328') - """ - - sql """ - alter table catalog_sales modify column cs_ship_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7201542', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') - """ - - sql """ - alter table call_center modify column cc_call_center_sk set stats ('row_count'='42', 'ndv'='42', 'num_nulls'='0', 'min_value'='1', 'max_value'='42', 'data_size'='336') - """ - - sql """ - alter table call_center modify column cc_city set stats ('row_count'='42', 'ndv'='17', 'num_nulls'='0', 'min_value'='Antioch', 'max_value'='Spring Hill', 'data_size'='386') - """ - - sql """ - alter table call_center modify column cc_closed_date_sk set stats ('row_count'='42', 'ndv'='0', 'num_nulls'='42', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_gmt_offset set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='168') - """ - - sql """ - alter table call_center modify column cc_hours set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='8AM-12AM', 'max_value'='8AM-8AM', 'data_size'='300') - """ - - sql """ - alter table call_center modify column cc_street_number set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='38', 'max_value'='999', 'data_size'='120') - """ - - sql """ - alter table call_center modify column cc_tax_percentage set stats ('row_count'='42', 'ndv'='12', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='168') - """ - - sql """ - alter table inventory modify column inv_date_sk set stats ('row_count'='783000000', 'ndv'='261', 'num_nulls'='0', 'min_value'='2450815', 'max_value'='2452635', 'data_size'='6264000000') - """ - - sql """ - alter table inventory modify column inv_item_sk set stats ('row_count'='783000000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='6264000000') - """ - - sql """ - alter table catalog_returns modify column cr_fee set stats ('row_count'='143996756', 'ndv'='9958', 'num_nulls'='2882168', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_return_quantity set stats ('row_count'='143996756', 'ndv'='100', 'num_nulls'='2878774', 'min_value'='1', 'max_value'='100', 'data_size'='575987024') - """ - - sql """ - alter table catalog_returns modify column cr_returned_time_sk set stats ('row_count'='143996756', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='1151974048') - """ - - sql """ - alter table household_demographics modify column hd_dep_count set stats ('row_count'='7200', 'ndv'='10', 'num_nulls'='0', 'min_value'='0', 'max_value'='9', 'data_size'='28800') - """ - - sql """ - alter table customer_address modify column ca_county set stats ('row_count'='6000000', 'ndv'='1825', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='81254984') - """ - - sql """ - alter table income_band modify column ib_lower_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='0', 'max_value'='190001', 'data_size'='80') - """ - - sql """ - alter table item modify column i_category_id set stats ('row_count'='300000', 'ndv'='10', 'num_nulls'='766', 'min_value'='1', 'max_value'='10', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_class set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='0', 'min_value'='', 'max_value'='womens watch', 'data_size'='2331199') - """ - - sql """ - alter table item modify column i_container set stats ('row_count'='300000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='2094652') - """ - - sql """ - alter table item modify column i_current_price set stats ('row_count'='300000', 'ndv'='9685', 'num_nulls'='775', 'min_value'='0.09', 'max_value'='99.99', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_manager_id set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='744', 'min_value'='1', 'max_value'='100', 'data_size'='1200000') - """ - - sql """ - alter table item modify column i_size set stats ('row_count'='300000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='small', 'data_size'='1296134') - """ - - sql """ - alter table web_returns modify column wr_order_number set stats ('row_count'='71997522', 'ndv'='42383708', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='575980176') - """ - - sql """ - alter table web_returns modify column wr_refunded_cash set stats ('row_count'='71997522', 'ndv'='955369', 'num_nulls'='3240493', 'min_value'='0.00', 'max_value'='26992.92', 'data_size'='287990088') - """ - - sql """ - alter table web_site modify column web_country set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='689') - """ - - sql """ - alter table web_site modify column web_gmt_offset set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='1', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='216') - """ - - sql """ - alter table web_site modify column web_market_manager set stats ('row_count'='54', 'ndv'='46', 'num_nulls'='0', 'min_value'='', 'max_value'='Zachery Oneil', 'data_size'='691') - """ - - sql """ - alter table web_site modify column web_site_sk set stats ('row_count'='54', 'ndv'='54', 'num_nulls'='0', 'min_value'='1', 'max_value'='54', 'data_size'='432') - """ - - sql """ - alter table web_site modify column web_street_name set stats ('row_count'='54', 'ndv'='53', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Ridge', 'data_size'='471') - """ - - sql """ - alter table web_site modify column web_tax_percentage set stats ('row_count'='54', 'ndv'='13', 'num_nulls'='1', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='216') - """ - - sql """ - alter table promotion modify column p_channel_tv set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') - """ - - sql """ - alter table promotion modify column p_response_targe set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='27', 'min_value'='1', 'max_value'='1', 'data_size'='6000') - """ - - sql """ - alter table web_sales modify column ws_bill_addr_sk set stats ('row_count'='720000376', 'ndv'='6015742', 'num_nulls'='179648', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_ext_sales_price set stats ('row_count'='720000376', 'ndv'='1091003', 'num_nulls'='180023', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_net_profit set stats ('row_count'='720000376', 'ndv'='2014057', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19840.00', 'data_size'='2880001504') - """ - - sql """ - alter table web_sales modify column ws_promo_sk set stats ('row_count'='720000376', 'ndv'='1489', 'num_nulls'='180016', 'min_value'='1', 'max_value'='1500', 'data_size'='5760003008') - """ - - sql """ - alter table web_sales modify column ws_ship_customer_sk set stats ('row_count'='720000376', 'ndv'='12074547', 'num_nulls'='179966', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') - """ - - sql """ - alter table store modify column s_division_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') - """ - - sql """ - alter table store modify column s_floor_space set stats ('row_count'='1002', 'ndv'='752', 'num_nulls'='6', 'min_value'='5002549', 'max_value'='9997773', 'data_size'='4008') - """ - - sql """ - alter table store modify column s_tax_percentage set stats ('row_count'='1002', 'ndv'='12', 'num_nulls'='8', 'min_value'='0.00', 'max_value'='0.11', 'data_size'='4008') - """ - - sql """ - alter table time_dim modify column t_time_id set stats ('row_count'='86400', 'ndv'='85663', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPAAAA', 'data_size'='1382400') - """ - - sql """ - alter table time_dim modify column t_time_sk set stats ('row_count'='86400', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='691200') - """ - - sql """ - alter table store_returns modify column sr_fee set stats ('row_count'='287999764', 'ndv'='9958', 'num_nulls'='10081860', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_reason_sk set stats ('row_count'='287999764', 'ndv'='65', 'num_nulls'='10087936', 'min_value'='1', 'max_value'='65', 'data_size'='2303998112') - """ - - sql """ - alter table store_returns modify column sr_store_credit set stats ('row_count'='287999764', 'ndv'='698161', 'num_nulls'='10077188', 'min_value'='0.00', 'max_value'='17792.48', 'data_size'='1151999056') - """ - - sql """ - alter table store_returns modify column sr_ticket_number set stats ('row_count'='287999764', 'ndv'='168770768', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='2303998112') - """ - - sql """ - alter table store_sales modify column ss_ext_list_price set stats ('row_count'='2879987999', 'ndv'='770971', 'num_nulls'='129593800', 'min_value'='1.00', 'max_value'='20000.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_ext_sales_price set stats ('row_count'='2879987999', 'ndv'='754248', 'num_nulls'='129589177', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_net_profit set stats ('row_count'='2879987999', 'ndv'='1497362', 'num_nulls'='129572933', 'min_value'='-10000.00', 'max_value'='9986.00', 'data_size'='11519951996') - """ - - sql """ - alter table store_sales modify column ss_promo_sk set stats ('row_count'='2879987999', 'ndv'='1489', 'num_nulls'='129597096', 'min_value'='1', 'max_value'='1500', 'data_size'='23039903992') - """ - - sql """ - alter table ship_mode modify column sm_code set stats ('row_count'='20', 'ndv'='4', 'num_nulls'='0', 'min_value'='AIR', 'max_value'='SURFACE', 'data_size'='87') - """ - - sql """ - alter table ship_mode modify column sm_contract set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='2mM8l', 'max_value'='yVfotg7Tio3MVhBg6Bkn', 'data_size'='252') - """ - - sql """ - alter table customer modify column c_current_hdemo_sk set stats ('row_count'='12000000', 'ndv'='7251', 'num_nulls'='418736', 'min_value'='1', 'max_value'='7200', 'data_size'='96000000') - """ - - sql """ - alter table dbgen_version modify column dv_create_date set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2023-07-06', 'max_value'='2023-07-06', 'data_size'='4') - """ - - sql """ - alter table dbgen_version modify column dv_create_time set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2017-05-13 00:00:00', 'max_value'='2017-05-13 00:00:00', 'data_size'='8') - """ -} +// 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("load") { + String database = context.config.getDbNameByFile(context.file) + sql "drop database if exists ${database}" + sql "create database ${database}" + sql "use ${database}" + + sql ''' + drop table if exists customer_demographics + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer_demographics ( + cd_demo_sk int not null, + cd_gender varchar(1), + cd_marital_status varchar(1), + cd_education_status varchar(20), + cd_purchase_estimate integer, + cd_credit_rating varchar(10), + cd_dep_count integer, + cd_dep_employed_count integer, + cd_dep_college_count integer + ) + DUPLICATE KEY(cd_demo_sk) + DISTRIBUTED BY HASH(cd_demo_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists reason + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS reason ( + r_reason_sk int not null, + r_reason_id varchar(16) not null, + r_reason_desc varchar(100) + ) + DUPLICATE KEY(r_reason_sk) + DISTRIBUTED BY HASH(r_reason_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists date_dim + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS date_dim ( + d_date_sk int not null, + d_date_id varchar(16) not null, + d_date datev2, + d_month_seq integer, + d_week_seq integer, + d_quarter_seq integer, + d_year integer, + d_dow integer, + d_moy integer, + d_dom integer, + d_qoy integer, + d_fy_year integer, + d_fy_quarter_seq integer, + d_fy_week_seq integer, + d_day_name varchar(9), + d_quarter_name varchar(6), + d_holiday varchar(1), + d_weekend varchar(1), + d_following_holiday varchar(1), + d_first_dom integer, + d_last_dom integer, + d_same_day_ly integer, + d_same_day_lq integer, + d_current_day varchar(1), + d_current_week varchar(1), + d_current_month varchar(1), + d_current_quarter varchar(1), + d_current_year varchar(1) + ) + DUPLICATE KEY(d_date_sk) + DISTRIBUTED BY HASH(d_date_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists warehouse + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS warehouse ( + w_warehouse_sk int not null, + w_warehouse_id varchar(16) not null, + w_warehouse_name varchar(20), + w_warehouse_sq_ft integer, + w_street_number varchar(10), + w_street_name varchar(60), + w_street_type varchar(15), + w_suite_number varchar(10), + w_city varchar(60), + w_county varchar(30), + w_state varchar(2), + w_zip varchar(10), + w_country varchar(20), + w_gmt_offset decimalv3(5,2) + ) + DUPLICATE KEY(w_warehouse_sk) + DISTRIBUTED BY HASH(w_warehouse_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_sales ( + cs_sold_date_sk int, + cs_item_sk int not null, + cs_order_number int not null, + cs_sold_time_sk int, + cs_ship_date_sk int, + cs_bill_customer_sk int, + cs_bill_cdemo_sk int, + cs_bill_hdemo_sk int, + cs_bill_addr_sk int, + cs_ship_customer_sk int, + cs_ship_cdemo_sk int, + cs_ship_hdemo_sk int, + cs_ship_addr_sk int, + cs_call_center_sk int, + cs_catalog_page_sk int, + cs_ship_mode_sk int, + cs_warehouse_sk int, + cs_promo_sk int, + cs_quantity int, + cs_wholesale_cost decimalv3(7,2), + cs_list_price decimalv3(7,2), + cs_sales_price decimalv3(7,2), + cs_ext_discount_amt decimalv3(7,2), + cs_ext_sales_price decimalv3(7,2), + cs_ext_wholesale_cost decimalv3(7,2), + cs_ext_list_price decimalv3(7,2), + cs_ext_tax decimalv3(7,2), + cs_coupon_amt decimalv3(7,2), + cs_ext_ship_cost decimalv3(7,2), + cs_net_paid decimalv3(7,2), + cs_net_paid_inc_tax decimalv3(7,2), + cs_net_paid_inc_ship decimalv3(7,2), + cs_net_paid_inc_ship_tax decimalv3(7,2), + cs_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`cs_sold_date_sk`, `cs_item_sk`, `cs_order_number`) + DISTRIBUTED BY HASH(cs_item_sk, cs_order_number) BUCKETS 261 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists call_center + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS call_center ( + cc_call_center_sk int not null, + cc_call_center_id varchar(16) not null, + cc_rec_start_date date, + cc_rec_end_date date, + cc_closed_date_sk integer, + cc_open_date_sk integer, + cc_name varchar(50), + cc_class varchar(50), + cc_employees integer, + cc_sq_ft integer, + cc_hours varchar(20), + cc_manager varchar(40), + cc_mkt_id integer, + cc_mkt_class varchar(50), + cc_mkt_desc varchar(100), + cc_market_manager varchar(40), + cc_division integer, + cc_division_name varchar(50), + cc_company integer, + cc_company_name varchar(50), + cc_street_number varchar(10), + cc_street_name varchar(60), + cc_street_type varchar(15), + cc_suite_number varchar(10), + cc_city varchar(60), + cc_county varchar(30), + cc_state varchar(2), + cc_zip varchar(10), + cc_country varchar(20), + cc_gmt_offset decimalv3(5,2), + cc_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(cc_call_center_sk) + DISTRIBUTED BY HASH(cc_call_center_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists inventory + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS inventory ( + inv_date_sk int not null, + inv_item_sk int not null, + inv_warehouse_sk int, + inv_quantity_on_hand integer + ) + DUPLICATE KEY(inv_date_sk, inv_item_sk, inv_warehouse_sk) + DISTRIBUTED BY HASH(inv_item_sk) BUCKETS 63 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_returns ( + cr_returned_date_sk int, + cr_item_sk int not null, + cr_order_number int not null, + cr_returned_time_sk int, + cr_refunded_customer_sk int, + cr_refunded_cdemo_sk int, + cr_refunded_hdemo_sk int, + cr_refunded_addr_sk int, + cr_returning_customer_sk int, + cr_returning_cdemo_sk int, + cr_returning_hdemo_sk int, + cr_returning_addr_sk int, + cr_call_center_sk int, + cr_catalog_page_sk int, + cr_ship_mode_sk int, + cr_warehouse_sk int, + cr_reason_sk int, + cr_return_quantity integer, + cr_return_amount decimalv3(7,2), + cr_return_tax decimalv3(7,2), + cr_return_amt_inc_tax decimalv3(7,2), + cr_fee decimalv3(7,2), + cr_return_ship_cost decimalv3(7,2), + cr_refunded_cash decimalv3(7,2), + cr_reversed_charge decimalv3(7,2), + cr_store_credit decimalv3(7,2), + cr_net_loss decimalv3(7,2) + ) + DUPLICATE KEY(`cr_returned_date_sk`, `cr_item_sk`, `cr_order_number`) + DISTRIBUTED BY HASH(cr_item_sk, cr_order_number) BUCKETS 36 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists household_demographics + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS household_demographics ( + hd_demo_sk int not null, + hd_income_band_sk int, + hd_buy_potential varchar(15), + hd_dep_count integer, + hd_vehicle_count integer + ) + DUPLICATE KEY(hd_demo_sk) + DISTRIBUTED BY HASH(hd_demo_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists customer_address + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer_address ( + ca_address_sk int not null, + ca_address_id varchar(16) not null, + ca_street_number varchar(10), + ca_street_name varchar(60), + ca_street_type varchar(15), + ca_suite_number varchar(10), + ca_city varchar(60), + ca_county varchar(30), + ca_state varchar(2), + ca_zip varchar(10), + ca_country varchar(20), + ca_gmt_offset decimalv3(5,2), + ca_location_type varchar(20) + ) + DUPLICATE KEY(ca_address_sk) + DISTRIBUTED BY HASH(ca_address_sk) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists income_band + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS income_band ( + ib_income_band_sk int not null, + ib_lower_bound integer, + ib_upper_bound integer + ) + DUPLICATE KEY(ib_income_band_sk) + DISTRIBUTED BY HASH(ib_income_band_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_page + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_page ( + cp_catalog_page_sk int not null, + cp_catalog_page_id varchar(16) not null, + cp_start_date_sk integer, + cp_end_date_sk integer, + cp_department varchar(50), + cp_catalog_number integer, + cp_catalog_page_number integer, + cp_description varchar(100), + cp_type varchar(100) + ) + DUPLICATE KEY(cp_catalog_page_sk) + DISTRIBUTED BY HASH(cp_catalog_page_sk) BUCKETS 3 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists item + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS item ( + i_item_sk int not null, + i_item_id varchar(16) not null, + i_rec_start_date datev2, + i_rec_end_date datev2, + i_item_desc varchar(200), + i_current_price decimalv3(7,2), + i_wholesale_cost decimalv3(7,2), + i_brand_id integer, + i_brand varchar(50), + i_class_id integer, + i_class char(50), + i_category_id integer, + i_category varchar(50), + i_manufact_id integer, + i_manufact varchar(50), + i_size varchar(20), + i_formulation varchar(20), + i_color varchar(20), + i_units varchar(10), + i_container varchar(10), + i_manager_id integer, + i_product_name varchar(50) + ) + DUPLICATE KEY(i_item_sk) + DISTRIBUTED BY HASH(i_item_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_returns ( + wr_returned_date_sk int, + wr_item_sk int not null, + wr_order_number int not null, + wr_returned_time_sk int, + wr_refunded_customer_sk int, + wr_refunded_cdemo_sk int, + wr_refunded_hdemo_sk int, + wr_refunded_addr_sk int, + wr_returning_customer_sk int, + wr_returning_cdemo_sk int, + wr_returning_hdemo_sk int, + wr_returning_addr_sk int, + wr_web_page_sk int, + wr_reason_sk int, + wr_return_quantity integer, + wr_return_amt decimalv3(7,2), + wr_return_tax decimalv3(7,2), + wr_return_amt_inc_tax decimalv3(7,2), + wr_fee decimalv3(7,2), + wr_return_ship_cost decimalv3(7,2), + wr_refunded_cash decimalv3(7,2), + wr_reversed_charge decimalv3(7,2), + wr_account_credit decimalv3(7,2), + wr_net_loss decimalv3(7,2) + ) + DUPLICATE KEY(`wr_returned_date_sk`, `wr_item_sk`, `wr_order_number`) + DISTRIBUTED BY HASH(`wr_item_sk`, `wr_order_number`) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_site + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_site ( + web_site_sk int not null, + web_site_id varchar(16) not null, + web_rec_start_date datev2, + web_rec_end_date datev2, + web_name varchar(50), + web_open_date_sk int, + web_close_date_sk int, + web_class varchar(50), + web_manager varchar(40), + web_mkt_id integer, + web_mkt_class varchar(50), + web_mkt_desc varchar(100), + web_market_manager varchar(40), + web_company_id integer, + web_company_name varchar(50), + web_street_number varchar(10), + web_street_name varchar(60), + web_street_type varchar(15), + web_suite_number varchar(10), + web_city varchar(60), + web_county varchar(30), + web_state varchar(2), + web_zip varchar(10), + web_country varchar(20), + web_gmt_offset decimalv3(5,2), + web_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(web_site_sk) + DISTRIBUTED BY HASH(web_site_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists promotion + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS promotion ( + p_promo_sk int not null, + p_promo_id varchar(16) not null, + p_start_date_sk int, + p_end_date_sk int, + p_item_sk int, + p_cost decimalv3(15,2), + p_response_targe integer, + p_promo_name varchar(50), + p_channel_dmail varchar(1), + p_channel_email varchar(1), + p_channel_catalog varchar(1), + p_channel_tv varchar(1), + p_channel_radio varchar(1), + p_channel_press varchar(1), + p_channel_event varchar(1), + p_channel_demo varchar(1), + p_channel_details varchar(100), + p_purpose varchar(15), + p_discount_active varchar(1) + ) + DUPLICATE KEY(p_promo_sk) + DISTRIBUTED BY HASH(p_promo_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_sales ( + ws_sold_date_sk int, + ws_item_sk int not null, + ws_order_number int not null, + ws_sold_time_sk int, + ws_ship_date_sk int, + ws_bill_customer_sk int, + ws_bill_cdemo_sk int, + ws_bill_hdemo_sk int, + ws_bill_addr_sk int, + ws_ship_customer_sk int, + ws_ship_cdemo_sk int, + ws_ship_hdemo_sk int, + ws_ship_addr_sk int, + ws_web_page_sk int, + ws_web_site_sk int, + ws_ship_mode_sk int, + ws_warehouse_sk int, + ws_promo_sk int, + ws_quantity integer, + ws_wholesale_cost decimalv3(7,2), + ws_list_price decimalv3(7,2), + ws_sales_price decimalv3(7,2), + ws_ext_discount_amt decimalv3(7,2), + ws_ext_sales_price decimalv3(7,2), + ws_ext_wholesale_cost decimalv3(7,2), + ws_ext_list_price decimalv3(7,2), + ws_ext_tax decimalv3(7,2), + ws_coupon_amt decimalv3(7,2), + ws_ext_ship_cost decimalv3(7,2), + ws_net_paid decimalv3(7,2), + ws_net_paid_inc_tax decimalv3(7,2), + ws_net_paid_inc_ship decimalv3(7,2), + ws_net_paid_inc_ship_tax decimalv3(7,2), + ws_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`ws_sold_date_sk`, `ws_item_sk`, `ws_order_number`) + DISTRIBUTED BY HASH(ws_item_sk, ws_order_number) BUCKETS 126 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store ( + s_store_sk int not null, + s_store_id varchar(16) not null, + s_rec_start_date datev2, + s_rec_end_date datev2, + s_closed_date_sk int, + s_store_name varchar(50), + s_number_employees integer, + s_floor_space integer, + s_hours varchar(20), + s_manager varchar(40), + s_market_id integer, + s_geography_class varchar(100), + s_market_desc varchar(100), + s_market_manager varchar(40), + s_division_id integer, + s_division_name varchar(50), + s_company_id integer, + s_company_name varchar(50), + s_street_number varchar(10), + s_street_name varchar(60), + s_street_type varchar(15), + s_suite_number varchar(10), + s_city varchar(60), + s_county varchar(30), + s_state varchar(2), + s_zip varchar(10), + s_country varchar(20), + s_gmt_offset decimalv3(5,2), + s_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(s_store_sk) + DISTRIBUTED BY HASH(s_store_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists time_dim + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS time_dim ( + t_time_sk int not null, + t_time_id varchar(16) not null, + t_time integer, + t_hour integer, + t_minute integer, + t_second integer, + t_am_pm varchar(2), + t_shift varchar(20), + t_sub_shift varchar(20), + t_meal_time varchar(20) + ) + DUPLICATE KEY(t_time_sk) + DISTRIBUTED BY HASH(t_time_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_page + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_page ( + wp_web_page_sk int not null, + wp_web_page_id varchar(16) not null, + wp_rec_start_date datev2, + wp_rec_end_date datev2, + wp_creation_date_sk int, + wp_access_date_sk int, + wp_autogen_flag varchar(1), + wp_customer_sk int, + wp_url varchar(100), + wp_type varchar(50), + wp_char_count integer, + wp_link_count integer, + wp_image_count integer, + wp_max_ad_count integer + ) + DUPLICATE KEY(wp_web_page_sk) + DISTRIBUTED BY HASH(wp_web_page_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store_returns ( + sr_returned_date_sk int, + sr_item_sk int not null, + sr_ticket_number int not null, + sr_return_time_sk int, + sr_customer_sk int, + sr_cdemo_sk int, + sr_hdemo_sk int, + sr_addr_sk int, + sr_store_sk int, + sr_reason_sk int, + sr_return_quantity integer, + sr_return_amt decimalv3(7,2), + sr_return_tax decimalv3(7,2), + sr_return_amt_inc_tax decimalv3(7,2), + sr_fee decimalv3(7,2), + sr_return_ship_cost decimalv3(7,2), + sr_refunded_cash decimalv3(7,2), + sr_reversed_charge decimalv3(7,2), + sr_store_credit decimalv3(7,2), + sr_net_loss decimalv3(7,2) + ) + duplicate key(`sr_returned_date_sk`, `sr_item_sk`, `sr_ticket_number`) + distributed by hash (sr_item_sk, sr_ticket_number) buckets 36 + properties ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store_sales ( + ss_sold_date_sk int, + ss_item_sk int not null, + ss_ticket_number int not null, + ss_sold_time_sk int, + ss_customer_sk int, + ss_cdemo_sk int, + ss_hdemo_sk int, + ss_addr_sk int, + ss_store_sk int, + ss_promo_sk int, + ss_quantity integer, + ss_wholesale_cost decimalv3(7,2), + ss_list_price decimalv3(7,2), + ss_sales_price decimalv3(7,2), + ss_ext_discount_amt decimalv3(7,2), + ss_ext_sales_price decimalv3(7,2), + ss_ext_wholesale_cost decimalv3(7,2), + ss_ext_list_price decimalv3(7,2), + ss_ext_tax decimalv3(7,2), + ss_coupon_amt decimalv3(7,2), + ss_net_paid decimalv3(7,2), + ss_net_paid_inc_tax decimalv3(7,2), + ss_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`ss_sold_date_sk`, `ss_item_sk`, `ss_ticket_number`) + DISTRIBUTED BY HASH(ss_item_sk, ss_ticket_number) BUCKETS 261 + PROPERTIES ( + "replication_num" = "1", + "colocate_with" = "store" + ) + ''' + + sql ''' + drop table if exists ship_mode + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS ship_mode ( + sm_ship_mode_sk int not null, + sm_ship_mode_id varchar(16) not null, + sm_type varchar(30), + sm_code varchar(10), + sm_carrier varchar(20), + sm_contract varchar(20) + ) + DUPLICATE KEY(sm_ship_mode_sk) + DISTRIBUTED BY HASH(sm_ship_mode_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists customer + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer ( + c_customer_sk int not null, + c_customer_id varchar(16) not null, + c_current_cdemo_sk int, + c_current_hdemo_sk int, + c_current_addr_sk int, + c_first_shipto_date_sk int, + c_first_sales_date_sk int, + c_salutation varchar(10), + c_first_name varchar(20), + c_last_name varchar(30), + c_preferred_cust_flag varchar(1), + c_birth_day integer, + c_birth_month integer, + c_birth_year integer, + c_birth_country varchar(20), + c_login varchar(13), + c_email_address varchar(50), + c_last_review_date_sk int + ) + DUPLICATE KEY(c_customer_sk) + DISTRIBUTED BY HASH(c_customer_sk) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists dbgen_version + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS dbgen_version + ( + dv_version varchar(16) , + dv_create_date datev2 , + dv_create_time datetime , + dv_cmdline_args varchar(200) + ) + DUPLICATE KEY(dv_version) + DISTRIBUTED BY HASH(dv_version) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + alter table customer add constraint customer_pk primary key (c_customer_sk); + ''' + + sql ''' + alter table customer add constraint customer_uk unique (c_customer_id); + ''' + + sql ''' + alter table store_sales add constraint ss_fk foreign key(ss_customer_sk) references customer(c_customer_sk); + ''' + + sql ''' + alter table web_sales add constraint ws_fk foreign key(ws_bill_customer_sk) references customer(c_customer_sk); + ''' + + sql ''' + alter table catalog_sales add constraint cs_fk foreign key(cs_bill_customer_sk) references customer(c_customer_sk); + ''' + + sql """ + alter table customer_demographics modify column cd_dep_employed_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table date_dim modify column d_day_name set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='Friday', 'max_value'='Wednesday', 'data_size'='521779') + """ + + sql """ + alter table date_dim modify column d_following_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_same_day_ly set stats ('row_count'='73049', 'ndv'='72450', 'num_nulls'='0', 'min_value'='2414657', 'max_value'='2487705', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_city set stats ('row_count'='20', 'ndv'='12', 'num_nulls'='0', 'min_value'='Fairview', 'max_value'='Shiloh', 'data_size'='183') + """ + + sql """ + alter table warehouse modify column w_street_type set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='71') + """ + + sql """ + alter table catalog_sales modify column cs_call_center_sk set stats ('row_count'='1439980416', 'ndv'='42', 'num_nulls'='7199711', 'min_value'='1', 'max_value'='42', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_ship set stats ('row_count'='1439980416', 'ndv'='2505826', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='43956.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_sales_price set stats ('row_count'='1439980416', 'ndv'='29306', 'num_nulls'='7200276', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_class set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='large', 'max_value'='small', 'data_size'='226') + """ + + sql """ + alter table call_center modify column cc_country set stats ('row_count'='42', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='546') + """ + + sql """ + alter table call_center modify column cc_county set stats ('row_count'='42', 'ndv'='16', 'num_nulls'='0', 'min_value'='Barrow County', 'max_value'='Williamson County', 'data_size'='627') + """ + + sql """ + alter table call_center modify column cc_mkt_class set stats ('row_count'='42', 'ndv'='36', 'num_nulls'='0', 'min_value'='A bit narrow forms matter animals. Consist', 'max_value'='Yesterday new men can make moreov', 'data_size'='1465') + """ + + sql """ + alter table call_center modify column cc_sq_ft set stats ('row_count'='42', 'ndv'='31', 'num_nulls'='0', 'min_value'='-1890660328', 'max_value'='2122480316', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_state set stats ('row_count'='42', 'ndv'='14', 'num_nulls'='0', 'min_value'='FL', 'max_value'='WV', 'data_size'='84') + """ + + sql """ + alter table inventory modify column inv_warehouse_sk set stats ('row_count'='783000000', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='6264000000') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2881609', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_cash set stats ('row_count'='143996756', 'ndv'='1107525', 'num_nulls'='2879192', 'min_value'='0.00', 'max_value'='26955.24', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2881314', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_amt_inc_tax set stats ('row_count'='143996756', 'ndv'='1544502', 'num_nulls'='2881886', 'min_value'='0.00', 'max_value'='30418.06', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returning_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2883215', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_buy_potential set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='0-500', 'max_value'='Unknown', 'data_size'='54000') + """ + + sql """ + alter table customer_address modify column ca_address_id set stats ('row_count'='6000000', 'ndv'='5984931', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPEAA', 'data_size'='96000000') + """ + + sql """ + alter table customer_address modify column ca_address_sk set stats ('row_count'='6000000', 'ndv'='6015811', 'num_nulls'='0', 'min_value'='1', 'max_value'='6000000', 'data_size'='48000000') + """ + + sql """ + alter table customer_address modify column ca_country set stats ('row_count'='6000000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='75661794') + """ + + sql """ + alter table customer_address modify column ca_location_type set stats ('row_count'='6000000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='single family', 'data_size'='52372545') + """ + + sql """ + alter table customer_address modify column ca_street_number set stats ('row_count'='6000000', 'ndv'='1002', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='16837336') + """ + + sql """ + alter table customer_address modify column ca_suite_number set stats ('row_count'='6000000', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='45911575') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_id set stats ('row_count'='30000', 'ndv'='29953', 'num_nulls'='0', 'min_value'='AAAAAAAAAAABAAAA', 'max_value'='AAAAAAAAPPPGAAAA', 'data_size'='480000') + """ + + sql """ + alter table item modify column i_rec_end_date set stats ('row_count'='300000', 'ndv'='3', 'num_nulls'='150000', 'min_value'='1999-10-27', 'max_value'='2001-10-26', 'data_size'='1200000') + """ + + sql """ + alter table web_returns modify column wr_refunded_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239971', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_reversed_charge set stats ('row_count'='71997522', 'ndv'='692680', 'num_nulls'='3239546', 'min_value'='0.00', 'max_value'='23194.77', 'data_size'='287990088') + """ + + sql """ + alter table web_site modify column web_state set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='0', 'min_value'='AL', 'max_value'='WV', 'data_size'='108') + """ + + sql """ + alter table promotion modify column p_end_date_sk set stats ('row_count'='1500', 'ndv'='683', 'num_nulls'='18', 'min_value'='2450113', 'max_value'='2450967', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_bill_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='180139', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ext_ship_cost set stats ('row_count'='720000376', 'ndv'='567477', 'num_nulls'='180084', 'min_value'='0.00', 'max_value'='14950.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_addr_sk set stats ('row_count'='720000376', 'ndv'='6015811', 'num_nulls'='179848', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ship_mode_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180017', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_warehouse_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180105', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_company_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') + """ + + sql """ + alter table store modify column s_gmt_offset set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='6', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_manager set stats ('row_count'='1002', 'ndv'='739', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Clifton', 'data_size'='12649') + """ + + sql """ + alter table store modify column s_street_number set stats ('row_count'='1002', 'ndv'='521', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='2874') + """ + + sql """ + alter table time_dim modify column t_meal_time set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='lunch', 'data_size'='248400') + """ + + sql """ + alter table time_dim modify column t_time set stats ('row_count'='86400', 'ndv'='86684', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='345600') + """ + + sql """ + alter table web_page modify column wp_creation_date_sk set stats ('row_count'='3000', 'ndv'='199', 'num_nulls'='33', 'min_value'='2450604', 'max_value'='2450815', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_customer_sk set stats ('row_count'='3000', 'ndv'='713', 'num_nulls'='2147', 'min_value'='9522', 'max_value'='11995685', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_max_ad_count set stats ('row_count'='3000', 'ndv'='5', 'num_nulls'='31', 'min_value'='0', 'max_value'='4', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_url set stats ('row_count'='3000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='http://www.foo.com', 'data_size'='53406') + """ + + sql """ + alter table store_returns modify column sr_refunded_cash set stats ('row_count'='287999764', 'ndv'='928470', 'num_nulls'='10081294', 'min_value'='0.00', 'max_value'='18173.96', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_tax set stats ('row_count'='287999764', 'ndv'='117247', 'num_nulls'='10081332', 'min_value'='0.00', 'max_value'='1682.04', 'data_size'='1151999056') + """ + + sql """ + alter table store_sales modify column ss_customer_sk set stats ('row_count'='2879987999', 'ndv'='12157481', 'num_nulls'='129590766', 'min_value'='1', 'max_value'='12000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_hdemo_sk set stats ('row_count'='2879987999', 'ndv'='7251', 'num_nulls'='129594559', 'min_value'='1', 'max_value'='7200', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_store_sk set stats ('row_count'='2879987999', 'ndv'='499', 'num_nulls'='129572050', 'min_value'='1', 'max_value'='1000', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_ship_mode_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') + """ + + sql """ + alter table ship_mode modify column sm_ship_mode_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table customer modify column c_first_name set stats ('row_count'='12000000', 'ndv'='5140', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma', 'data_size'='67593278') + """ + + sql """ + alter table customer modify column c_first_sales_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='419856', 'min_value'='2448998', 'max_value'='2452648', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_first_shipto_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='420769', 'min_value'='2449028', 'max_value'='2452678', 'data_size'='96000000') + """ + + sql """ + alter table customer_demographics modify column cd_dep_college_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table date_dim modify column d_dow set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_fy_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_qoy set stats ('row_count'='73049', 'ndv'='4', 'num_nulls'='0', 'min_value'='1', 'max_value'='4', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_street_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Elm', 'data_size'='176') + """ + + sql """ + alter table warehouse modify column w_suite_number set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite X', 'data_size'='150') + """ + + sql """ + alter table catalog_sales modify column cs_bill_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7202134', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_bill_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7198837', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ext_ship_cost set stats ('row_count'='1439980416', 'ndv'='573238', 'num_nulls'='7202537', 'min_value'='0.00', 'max_value'='14994.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='California', 'max_value'='Pacific Northwest_2', 'data_size'='572') + """ + + sql """ + alter table call_center modify column cc_street_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='1st', 'max_value'='Willow', 'data_size'='356') + """ + + sql """ + alter table call_center modify column cc_zip set stats ('row_count'='42', 'ndv'='19', 'num_nulls'='0', 'min_value'='18605', 'max_value'='98048', 'data_size'='210') + """ + + sql """ + alter table inventory modify column inv_quantity_on_hand set stats ('row_count'='783000000', 'ndv'='1006', 'num_nulls'='39153758', 'min_value'='0', 'max_value'='1000', 'data_size'='3132000000') + """ + + sql """ + alter table catalog_returns modify column cr_catalog_page_sk set stats ('row_count'='143996756', 'ndv'='17005', 'num_nulls'='2882502', 'min_value'='1', 'max_value'='25207', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_income_band_sk set stats ('row_count'='7200', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='57600') + """ + + sql """ + alter table catalog_page modify column cp_description set stats ('row_count'='30000', 'ndv'='30141', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters worry both workers. Fascinating characters take cheap never alive studies. Direct, old', 'data_size'='2215634') + """ + + sql """ + alter table item modify column i_item_id set stats ('row_count'='300000', 'ndv'='150851', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPBAAA', 'data_size'='4800000') + """ + + sql """ + alter table web_returns modify column wr_account_credit set stats ('row_count'='71997522', 'ndv'='683955', 'num_nulls'='3241972', 'min_value'='0.00', 'max_value'='23166.33', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_net_loss set stats ('row_count'='71997522', 'ndv'='815608', 'num_nulls'='3240573', 'min_value'='0.50', 'max_value'='15887.84', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_amt set stats ('row_count'='71997522', 'ndv'='808311', 'num_nulls'='3238405', 'min_value'='0.00', 'max_value'='29191.00', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_amt_inc_tax set stats ('row_count'='71997522', 'ndv'='1359913', 'num_nulls'='3239765', 'min_value'='0.00', 'max_value'='30393.01', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_quantity set stats ('row_count'='71997522', 'ndv'='100', 'num_nulls'='3238643', 'min_value'='1', 'max_value'='100', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returning_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239658', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_returning_customer_sk set stats ('row_count'='71997522', 'ndv'='12119220', 'num_nulls'='3237281', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_mkt_desc set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Acres see else children. Mutual too', 'max_value'='Windows increase to a differences. Other parties might in', 'data_size'='3473') + """ + + sql """ + alter table web_site modify column web_mkt_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='1', 'min_value'='1', 'max_value'='6', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_rec_end_date set stats ('row_count'='54', 'ndv'='3', 'num_nulls'='27', 'min_value'='1999-08-16', 'max_value'='2001-08-15', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_site_id set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='864') + """ + + sql """ + alter table web_site modify column web_street_type set stats ('row_count'='54', 'ndv'='20', 'num_nulls'='0', 'min_value'='Ave', 'max_value'='Wy', 'data_size'='208') + """ + + sql """ + alter table promotion modify column p_channel_demo set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') + """ + + sql """ + alter table promotion modify column p_channel_details set stats ('row_count'='1500', 'ndv'='1490', 'num_nulls'='0', 'min_value'='', 'max_value'='Young, valuable companies watch walls. Payments can flour', 'data_size'='59126') + """ + + sql """ + alter table promotion modify column p_channel_event set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') + """ + + sql """ + alter table promotion modify column p_discount_active set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1473') + """ + + sql """ + alter table promotion modify column p_promo_sk set stats ('row_count'='1500', 'ndv'='1489', 'num_nulls'='0', 'min_value'='1', 'max_value'='1500', 'data_size'='12000') + """ + + sql """ + alter table promotion modify column p_purpose set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='10374') + """ + + sql """ + alter table web_sales modify column ws_bill_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='179788', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_sold_date_sk set stats ('row_count'='720000376', 'ndv'='1820', 'num_nulls'='179921', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_web_site_sk set stats ('row_count'='720000376', 'ndv'='54', 'num_nulls'='179930', 'min_value'='1', 'max_value'='54', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_city set stats ('row_count'='1002', 'ndv'='55', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='9238') + """ + + sql """ + alter table store modify column s_company_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='7', 'min_value'='1', 'max_value'='1', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_county set stats ('row_count'='1002', 'ndv'='28', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='14291') + """ + + sql """ + alter table store modify column s_geography_class set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6972') + """ + + sql """ + alter table store modify column s_hours set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='8AM-8AM', 'data_size'='7088') + """ + + sql """ + alter table store modify column s_store_id set stats ('row_count'='1002', 'ndv'='501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPBAAAAA', 'data_size'='16032') + """ + + sql """ + alter table store modify column s_zip set stats ('row_count'='1002', 'ndv'='354', 'num_nulls'='0', 'min_value'='', 'max_value'='99454', 'data_size'='4975') + """ + + sql """ + alter table time_dim modify column t_am_pm set stats ('row_count'='86400', 'ndv'='2', 'num_nulls'='0', 'min_value'='AM', 'max_value'='PM', 'data_size'='172800') + """ + + sql """ + alter table time_dim modify column t_minute set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') + """ + + sql """ + alter table web_page modify column wp_web_page_id set stats ('row_count'='3000', 'ndv'='1501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPKAAAAA', 'data_size'='48000') + """ + + sql """ + alter table web_page modify column wp_web_page_sk set stats ('row_count'='3000', 'ndv'='2984', 'num_nulls'='0', 'min_value'='1', 'max_value'='3000', 'data_size'='24000') + """ + + sql """ + alter table store_returns modify column sr_return_amt set stats ('row_count'='287999764', 'ndv'='671228', 'num_nulls'='10080055', 'min_value'='0.00', 'max_value'='19434.00', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_returned_date_sk set stats ('row_count'='287999764', 'ndv'='2010', 'num_nulls'='10079607', 'min_value'='2450820', 'max_value'='2452822', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_ext_tax set stats ('row_count'='2879987999', 'ndv'='149597', 'num_nulls'='129588732', 'min_value'='0.00', 'max_value'='1797.48', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_current_cdemo_sk set stats ('row_count'='12000000', 'ndv'='1913901', 'num_nulls'='419895', 'min_value'='1', 'max_value'='1920800', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_customer_id set stats ('row_count'='12000000', 'ndv'='11921032', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPKAA', 'data_size'='192000000') + """ + + sql """ + alter table date_dim modify column d_current_day set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_current_month set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_date set stats ('row_count'='73049', 'ndv'='73250', 'num_nulls'='0', 'min_value'='1900-01-02', 'max_value'='2100-01-01', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_moy set stats ('row_count'='73049', 'ndv'='12', 'num_nulls'='0', 'min_value'='1', 'max_value'='12', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_gmt_offset set stats ('row_count'='20', 'ndv'='3', 'num_nulls'='1', 'min_value'='-7.00', 'max_value'='-5.00', 'data_size'='80') + """ + + sql """ + alter table warehouse modify column w_warehouse_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table warehouse modify column w_warehouse_sq_ft set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='1', 'min_value'='73065', 'max_value'='977787', 'data_size'='80') + """ + + sql """ + alter table catalog_sales modify column cs_ext_sales_price set stats ('row_count'='1439980416', 'ndv'='1100662', 'num_nulls'='7199625', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ext_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='393180', 'num_nulls'='7199876', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_item_sk set stats ('row_count'='1439980416', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_tax set stats ('row_count'='1439980416', 'ndv'='2422238', 'num_nulls'='7200702', 'min_value'='0.00', 'max_value'='32376.27', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_date_sk set stats ('row_count'='1439980416', 'ndv'='1933', 'num_nulls'='7200707', 'min_value'='2450817', 'max_value'='2452744', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_warehouse_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7200688', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_division set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_division_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='164') + """ + + sql """ + alter table call_center modify column cc_manager set stats ('row_count'='42', 'ndv'='28', 'num_nulls'='0', 'min_value'='Alden Snyder', 'max_value'='Wayne Ray', 'data_size'='519') + """ + + sql """ + alter table call_center modify column cc_rec_start_date set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='1998-01-01', 'max_value'='2002-01-01', 'data_size'='168') + """ + + sql """ + alter table catalog_returns modify column cr_call_center_sk set stats ('row_count'='143996756', 'ndv'='42', 'num_nulls'='2881668', 'min_value'='1', 'max_value'='42', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_net_loss set stats ('row_count'='143996756', 'ndv'='911034', 'num_nulls'='2881704', 'min_value'='0.50', 'max_value'='16095.08', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_customer_sk set stats ('row_count'='143996756', 'ndv'='12156363', 'num_nulls'='2879017', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882107', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_returning_customer_sk set stats ('row_count'='143996756', 'ndv'='12157481', 'num_nulls'='2879023', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') + """ + + sql """ + alter table customer_address modify column ca_gmt_offset set stats ('row_count'='6000000', 'ndv'='6', 'num_nulls'='180219', 'min_value'='-10.00', 'max_value'='-5.00', 'data_size'='24000000') + """ + + sql """ + alter table item modify column i_color set stats ('row_count'='300000', 'ndv'='93', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow', 'data_size'='1610293') + """ + + sql """ + alter table item modify column i_manufact set stats ('row_count'='300000', 'ndv'='1004', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripri', 'data_size'='3379693') + """ + + sql """ + alter table item modify column i_product_name set stats ('row_count'='300000', 'ndv'='294994', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripripripriought', 'data_size'='6849199') + """ + + sql """ + alter table web_returns modify column wr_returned_time_sk set stats ('row_count'='71997522', 'ndv'='87677', 'num_nulls'='3238574', 'min_value'='0', 'max_value'='86399', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_manager set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='William Young', 'data_size'='658') + """ + + sql """ + alter table web_site modify column web_mkt_class set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='Written, political plans show to the models. T', 'data_size'='1822') + """ + + sql """ + alter table web_site modify column web_rec_start_date set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='2', 'min_value'='1997-08-16', 'max_value'='2001-08-16', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_street_number set stats ('row_count'='54', 'ndv'='36', 'num_nulls'='0', 'min_value'='', 'max_value'='983', 'data_size'='154') + """ + + sql """ + alter table promotion modify column p_channel_catalog set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') + """ + + sql """ + alter table promotion modify column p_promo_id set stats ('row_count'='1500', 'ndv'='1519', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPEAAAAA', 'data_size'='24000') + """ + + sql """ + alter table web_sales modify column ws_bill_customer_sk set stats ('row_count'='720000376', 'ndv'='12103729', 'num_nulls'='179817', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_list_price set stats ('row_count'='720000376', 'ndv'='29396', 'num_nulls'='180053', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_sales_price set stats ('row_count'='720000376', 'ndv'='29288', 'num_nulls'='180005', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='179824', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_closed_date_sk set stats ('row_count'='1002', 'ndv'='163', 'num_nulls'='729', 'min_value'='2450820', 'max_value'='2451313', 'data_size'='8016') + """ + + sql """ + alter table store modify column s_division_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='6', 'min_value'='1', 'max_value'='1', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_market_desc set stats ('row_count'='1002', 'ndv'='765', 'num_nulls'='0', 'min_value'='', 'max_value'='Yesterday left factors handle continuing co', 'data_size'='57638') + """ + + sql """ + alter table store modify column s_market_id set stats ('row_count'='1002', 'ndv'='10', 'num_nulls'='8', 'min_value'='1', 'max_value'='10', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_state set stats ('row_count'='1002', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='WV', 'data_size'='1994') + """ + + sql """ + alter table store modify column s_store_sk set stats ('row_count'='1002', 'ndv'='988', 'num_nulls'='0', 'min_value'='1', 'max_value'='1002', 'data_size'='8016') + """ + + sql """ + alter table store modify column s_street_name set stats ('row_count'='1002', 'ndv'='549', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Oak', 'data_size'='8580') + """ + + sql """ + alter table web_page modify column wp_access_date_sk set stats ('row_count'='3000', 'ndv'='101', 'num_nulls'='31', 'min_value'='2452548', 'max_value'='2452648', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_char_count set stats ('row_count'='3000', 'ndv'='1883', 'num_nulls'='42', 'min_value'='303', 'max_value'='8523', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_addr_sk set stats ('row_count'='287999764', 'ndv'='6015811', 'num_nulls'='10082311', 'min_value'='1', 'max_value'='6000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_return_time_sk set stats ('row_count'='287999764', 'ndv'='32660', 'num_nulls'='10082805', 'min_value'='28799', 'max_value'='61199', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_store_sk set stats ('row_count'='287999764', 'ndv'='499', 'num_nulls'='10081871', 'min_value'='1', 'max_value'='1000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_coupon_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_sales_price set stats ('row_count'='2879987999', 'ndv'='19780', 'num_nulls'='129598061', 'min_value'='0.00', 'max_value'='200.00', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_birth_country set stats ('row_count'='12000000', 'ndv'='211', 'num_nulls'='0', 'min_value'='', 'max_value'='ZIMBABWE', 'data_size'='100750845') + """ + + sql """ + alter table customer modify column c_birth_month set stats ('row_count'='12000000', 'ndv'='12', 'num_nulls'='419629', 'min_value'='1', 'max_value'='12', 'data_size'='48000000') + """ + + sql """ + alter table customer modify column c_customer_sk set stats ('row_count'='12000000', 'ndv'='12157481', 'num_nulls'='0', 'min_value'='1', 'max_value'='12000000', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_email_address set stats ('row_count'='12000000', 'ndv'='11642077', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma.Young@aDhzZzCzYN.edu', 'data_size'='318077849') + """ + + sql """ + alter table customer modify column c_last_review_date_sk set stats ('row_count'='12000000', 'ndv'='366', 'num_nulls'='419900', 'min_value'='2452283', 'max_value'='2452648', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_preferred_cust_flag set stats ('row_count'='12000000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='11580510') + """ + + sql """ + alter table dbgen_version modify column dv_version set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='3.2.0', 'max_value'='3.2.0', 'data_size'='5') + """ + + sql """ + alter table customer_demographics modify column cd_purchase_estimate set stats ('row_count'='1920800', 'ndv'='20', 'num_nulls'='0', 'min_value'='500', 'max_value'='10000', 'data_size'='7683200') + """ + + sql """ + alter table reason modify column r_reason_id set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPDAAAAAA', 'data_size'='1040') + """ + + sql """ + alter table reason modify column r_reason_sk set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='1', 'max_value'='65', 'data_size'='520') + """ + + sql """ + alter table date_dim modify column d_current_week set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_first_dom set stats ('row_count'='73049', 'ndv'='2410', 'num_nulls'='0', 'min_value'='2415021', 'max_value'='2488070', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_fy_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_last_dom set stats ('row_count'='73049', 'ndv'='2419', 'num_nulls'='0', 'min_value'='2415020', 'max_value'='2488372', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_month_seq set stats ('row_count'='73049', 'ndv'='2398', 'num_nulls'='0', 'min_value'='0', 'max_value'='2400', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_quarter_name set stats ('row_count'='73049', 'ndv'='799', 'num_nulls'='0', 'min_value'='1900Q1', 'max_value'='2100Q1', 'data_size'='438294') + """ + + sql """ + alter table warehouse modify column w_county set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='Bronx County', 'max_value'='Ziebach County', 'data_size'='291') + """ + + sql """ + alter table warehouse modify column w_street_number set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='0', 'min_value'='', 'max_value'='957', 'data_size'='54') + """ + + sql """ + alter table warehouse modify column w_warehouse_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Therefore urg', 'data_size'='307') + """ + + sql """ + alter table catalog_sales modify column cs_ext_discount_amt set stats ('row_count'='1439980416', 'ndv'='1100115', 'num_nulls'='7201054', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_ship_tax set stats ('row_count'='1439980416', 'ndv'='3312360', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46593.36', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_promo_sk set stats ('row_count'='1439980416', 'ndv'='1489', 'num_nulls'='7202844', 'min_value'='1', 'max_value'='1500', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_call_center_id set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='672') + """ + + sql """ + alter table call_center modify column cc_employees set stats ('row_count'='42', 'ndv'='30', 'num_nulls'='0', 'min_value'='69020', 'max_value'='6879074', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_suite_number set stats ('row_count'='42', 'ndv'='18', 'num_nulls'='0', 'min_value'='Suite 0', 'max_value'='Suite W', 'data_size'='326') + """ + + sql """ + alter table catalog_returns modify column cr_item_sk set stats ('row_count'='143996756', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_reason_sk set stats ('row_count'='143996756', 'ndv'='65', 'num_nulls'='2881950', 'min_value'='1', 'max_value'='65', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_ship_cost set stats ('row_count'='143996756', 'ndv'='483467', 'num_nulls'='2883436', 'min_value'='0.00', 'max_value'='14273.28', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_ship_mode_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2879879', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_store_credit set stats ('row_count'='143996756', 'ndv'='802237', 'num_nulls'='2880469', 'min_value'='0.00', 'max_value'='23215.15', 'data_size'='575987024') + """ + + sql """ + alter table customer_address modify column ca_city set stats ('row_count'='6000000', 'ndv'='977', 'num_nulls'='0', 'min_value'='', 'max_value'='Zion', 'data_size'='52096290') + """ + + sql """ + alter table customer_address modify column ca_state set stats ('row_count'='6000000', 'ndv'='52', 'num_nulls'='0', 'min_value'='', 'max_value'='WY', 'data_size'='11640128') + """ + + sql """ + alter table customer_address modify column ca_street_name set stats ('row_count'='6000000', 'ndv'='8173', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Woodland', 'data_size'='50697257') + """ + + sql """ + alter table customer_address modify column ca_street_type set stats ('row_count'='6000000', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='24441630') + """ + + sql """ + alter table catalog_page modify column cp_catalog_number set stats ('row_count'='30000', 'ndv'='109', 'num_nulls'='297', 'min_value'='1', 'max_value'='109', 'data_size'='120000') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_number set stats ('row_count'='30000', 'ndv'='279', 'num_nulls'='294', 'min_value'='1', 'max_value'='277', 'data_size'='120000') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_sk set stats ('row_count'='30000', 'ndv'='30439', 'num_nulls'='0', 'min_value'='1', 'max_value'='30000', 'data_size'='240000') + """ + + sql """ + alter table catalog_page modify column cp_start_date_sk set stats ('row_count'='30000', 'ndv'='91', 'num_nulls'='286', 'min_value'='2450815', 'max_value'='2453005', 'data_size'='120000') + """ + + sql """ + alter table item modify column i_rec_start_date set stats ('row_count'='300000', 'ndv'='4', 'num_nulls'='784', 'min_value'='1997-10-27', 'max_value'='2001-10-27', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_units set stats ('row_count'='300000', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='1253652') + """ + + sql """ + alter table web_returns modify column wr_refunded_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238545', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_return_ship_cost set stats ('row_count'='71997522', 'ndv'='451263', 'num_nulls'='3239048', 'min_value'='0.00', 'max_value'='14352.10', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returned_date_sk set stats ('row_count'='71997522', 'ndv'='2188', 'num_nulls'='3239259', 'min_value'='2450819', 'max_value'='2453002', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_returning_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3239192', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_suite_number set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Suite 100', 'max_value'='Suite Y', 'data_size'='430') + """ + + sql """ + alter table promotion modify column p_start_date_sk set stats ('row_count'='1500', 'ndv'='685', 'num_nulls'='23', 'min_value'='2450096', 'max_value'='2450915', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_coupon_amt set stats ('row_count'='720000376', 'ndv'='1505315', 'num_nulls'='179933', 'min_value'='0.00', 'max_value'='28824.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ext_wholesale_cost set stats ('row_count'='720000376', 'ndv'='393180', 'num_nulls'='180060', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_ship set stats ('row_count'='720000376', 'ndv'='2414838', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='44263.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_date_sk set stats ('row_count'='720000376', 'ndv'='1952', 'num_nulls'='180011', 'min_value'='2450817', 'max_value'='2452762', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_web_page_sk set stats ('row_count'='720000376', 'ndv'='2984', 'num_nulls'='179732', 'min_value'='1', 'max_value'='3000', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_country set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='12961') + """ + + sql """ + alter table store modify column s_store_name set stats ('row_count'='1002', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='3916') + """ + + sql """ + alter table time_dim modify column t_second set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') + """ + + sql """ + alter table time_dim modify column t_sub_shift set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='afternoon', 'max_value'='night', 'data_size'='597600') + """ + + sql """ + alter table web_page modify column wp_image_count set stats ('row_count'='3000', 'ndv'='7', 'num_nulls'='26', 'min_value'='1', 'max_value'='7', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_type set stats ('row_count'='3000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='welcome', 'data_size'='18867') + """ + + sql """ + alter table store_returns modify column sr_customer_sk set stats ('row_count'='287999764', 'ndv'='12157481', 'num_nulls'='10081624', 'min_value'='1', 'max_value'='12000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_hdemo_sk set stats ('row_count'='287999764', 'ndv'='7251', 'num_nulls'='10083275', 'min_value'='1', 'max_value'='7200', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_addr_sk set stats ('row_count'='2879987999', 'ndv'='6015811', 'num_nulls'='129589799', 'min_value'='1', 'max_value'='6000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_item_sk set stats ('row_count'='2879987999', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_quantity set stats ('row_count'='2879987999', 'ndv'='100', 'num_nulls'='129584258', 'min_value'='1', 'max_value'='100', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ticket_number set stats ('row_count'='2879987999', 'ndv'='238830448', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='9905', 'num_nulls'='129590273', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='11519951996') + """ + + sql """ + alter table ship_mode modify column sm_type set stats ('row_count'='20', 'ndv'='6', 'num_nulls'='0', 'min_value'='EXPRESS', 'max_value'='TWO DAY', 'data_size'='150') + """ + + sql """ + alter table customer modify column c_current_addr_sk set stats ('row_count'='12000000', 'ndv'='5243359', 'num_nulls'='0', 'min_value'='3', 'max_value'='6000000', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_last_name set stats ('row_count'='12000000', 'ndv'='4990', 'num_nulls'='0', 'min_value'='', 'max_value'='Zuniga', 'data_size'='70991730') + """ + + sql """ + alter table dbgen_version modify column dv_cmdline_args set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'max_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'data_size'='86') + """ + + sql """ + alter table date_dim modify column d_current_quarter set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_date_sk set stats ('row_count'='73049', 'ndv'='73042', 'num_nulls'='0', 'min_value'='2415022', 'max_value'='2488070', 'data_size'='584392') + """ + + sql """ + alter table date_dim modify column d_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table warehouse modify column w_country set stats ('row_count'='20', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='260') + """ + + sql """ + alter table warehouse modify column w_state set stats ('row_count'='20', 'ndv'='13', 'num_nulls'='0', 'min_value'='AL', 'max_value'='TN', 'data_size'='40') + """ + + sql """ + alter table catalog_sales modify column cs_bill_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7199539', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_bill_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201919', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid set stats ('row_count'='1439980416', 'ndv'='1809875', 'num_nulls'='7197668', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7198232', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_mode_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7201083', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_sold_date_sk set stats ('row_count'='1439980416', 'ndv'='1835', 'num_nulls'='7203326', 'min_value'='2450815', 'max_value'='2452654', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_sold_time_sk set stats ('row_count'='1439980416', 'ndv'='87677', 'num_nulls'='7201329', 'min_value'='0', 'max_value'='86399', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='9905', 'num_nulls'='7201098', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_company_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='160') + """ + + sql """ + alter table call_center modify column cc_market_manager set stats ('row_count'='42', 'ndv'='35', 'num_nulls'='0', 'min_value'='Cesar Allen', 'max_value'='William Larsen', 'data_size'='524') + """ + + sql """ + alter table call_center modify column cc_mkt_id set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_street_type set stats ('row_count'='42', 'ndv'='11', 'num_nulls'='0', 'min_value'='Avenue', 'max_value'='Way', 'data_size'='184') + """ + + sql """ + alter table catalog_returns modify column cr_return_tax set stats ('row_count'='143996756', 'ndv'='149828', 'num_nulls'='2881611', 'min_value'='0.00', 'max_value'='2511.58', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returning_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2880543', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_returning_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882692', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_reversed_charge set stats ('row_count'='143996756', 'ndv'='802509', 'num_nulls'='2881215', 'min_value'='0.00', 'max_value'='24033.84', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_warehouse_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2882192', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_demo_sk set stats ('row_count'='7200', 'ndv'='7251', 'num_nulls'='0', 'min_value'='1', 'max_value'='7200', 'data_size'='57600') + """ + + sql """ + alter table household_demographics modify column hd_vehicle_count set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='-1', 'max_value'='4', 'data_size'='28800') + """ + + sql """ + alter table customer_address modify column ca_zip set stats ('row_count'='6000000', 'ndv'='9253', 'num_nulls'='0', 'min_value'='', 'max_value'='99981', 'data_size'='29097610') + """ + + sql """ + alter table income_band modify column ib_income_band_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table catalog_page modify column cp_type set stats ('row_count'='30000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='quarterly', 'data_size'='227890') + """ + + sql """ + alter table item modify column i_brand set stats ('row_count'='300000', 'ndv'='714', 'num_nulls'='0', 'min_value'='', 'max_value'='univunivamalg #9', 'data_size'='4834917') + """ + + sql """ + alter table item modify column i_formulation set stats ('row_count'='300000', 'ndv'='224757', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow98911509228741', 'data_size'='5984460') + """ + + sql """ + alter table item modify column i_item_desc set stats ('row_count'='300000', 'ndv'='217721', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters used to save quite colour', 'data_size'='30093342') + """ + + sql """ + alter table web_returns modify column wr_fee set stats ('row_count'='71997522', 'ndv'='9958', 'num_nulls'='3238926', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_item_sk set stats ('row_count'='71997522', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_reason_sk set stats ('row_count'='71997522', 'ndv'='65', 'num_nulls'='3238897', 'min_value'='1', 'max_value'='65', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_refunded_customer_sk set stats ('row_count'='71997522', 'ndv'='12117831', 'num_nulls'='3242433', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_city set stats ('row_count'='54', 'ndv'='31', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='491') + """ + + sql """ + alter table web_site modify column web_close_date_sk set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='10', 'min_value'='2441265', 'max_value'='2446218', 'data_size'='432') + """ + + sql """ + alter table web_site modify column web_company_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_company_name set stats ('row_count'='54', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='203') + """ + + sql """ + alter table web_site modify column web_county set stats ('row_count'='54', 'ndv'='25', 'num_nulls'='0', 'min_value'='', 'max_value'='Williamson County', 'data_size'='762') + """ + + sql """ + alter table web_site modify column web_name set stats ('row_count'='54', 'ndv'='10', 'num_nulls'='0', 'min_value'='', 'max_value'='site_8', 'data_size'='312') + """ + + sql """ + alter table web_site modify column web_open_date_sk set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='1', 'min_value'='2450373', 'max_value'='2450807', 'data_size'='432') + """ + + sql """ + alter table promotion modify column p_channel_dmail set stats ('row_count'='1500', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='1483') + """ + + sql """ + alter table promotion modify column p_channel_press set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') + """ + + sql """ + alter table promotion modify column p_channel_radio set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') + """ + + sql """ + alter table promotion modify column p_cost set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='18', 'min_value'='1000.00', 'max_value'='1000.00', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_ext_tax set stats ('row_count'='720000376', 'ndv'='211413', 'num_nulls'='179695', 'min_value'='0.00', 'max_value'='2682.90', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_item_sk set stats ('row_count'='720000376', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_net_paid set stats ('row_count'='720000376', 'ndv'='1749360', 'num_nulls'='179970', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_ship_tax set stats ('row_count'='720000376', 'ndv'='3224829', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46004.19', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_tax set stats ('row_count'='720000376', 'ndv'='2354996', 'num_nulls'='179972', 'min_value'='0.00', 'max_value'='32492.90', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_order_number set stats ('row_count'='720000376', 'ndv'='60401176', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_quantity set stats ('row_count'='720000376', 'ndv'='100', 'num_nulls'='179781', 'min_value'='1', 'max_value'='100', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='180290', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_sold_time_sk set stats ('row_count'='720000376', 'ndv'='87677', 'num_nulls'='179980', 'min_value'='0', 'max_value'='86399', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_street_type set stats ('row_count'='1002', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='4189') + """ + + sql """ + alter table web_page modify column wp_autogen_flag set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='2962') + """ + + sql """ + alter table web_page modify column wp_rec_start_date set stats ('row_count'='3000', 'ndv'='4', 'num_nulls'='29', 'min_value'='1997-09-03', 'max_value'='2001-09-03', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_net_loss set stats ('row_count'='287999764', 'ndv'='714210', 'num_nulls'='10080716', 'min_value'='0.50', 'max_value'='10776.08', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_amt_inc_tax set stats ('row_count'='287999764', 'ndv'='1259368', 'num_nulls'='10076879', 'min_value'='0.00', 'max_value'='20454.63', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_quantity set stats ('row_count'='287999764', 'ndv'='100', 'num_nulls'='10082815', 'min_value'='1', 'max_value'='100', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_ship_cost set stats ('row_count'='287999764', 'ndv'='355844', 'num_nulls'='10081927', 'min_value'='0.00', 'max_value'='9767.34', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_reversed_charge set stats ('row_count'='287999764', 'ndv'='700618', 'num_nulls'='10085976', 'min_value'='0.00', 'max_value'='17339.42', 'data_size'='1151999056') + """ + + sql """ + alter table store_sales modify column ss_net_paid_inc_tax set stats ('row_count'='2879987999', 'ndv'='1681767', 'num_nulls'='129609050', 'min_value'='0.00', 'max_value'='21769.48', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_birth_day set stats ('row_count'='12000000', 'ndv'='31', 'num_nulls'='420361', 'min_value'='1', 'max_value'='31', 'data_size'='48000000') + """ + + sql """ + alter table customer_demographics modify column cd_credit_rating set stats ('row_count'='1920800', 'ndv'='4', 'num_nulls'='0', 'min_value'='Good', 'max_value'='Unknown', 'data_size'='13445600') + """ + + sql """ + alter table customer_demographics modify column cd_demo_sk set stats ('row_count'='1920800', 'ndv'='1916366', 'num_nulls'='0', 'min_value'='1', 'max_value'='1920800', 'data_size'='15366400') + """ + + sql """ + alter table customer_demographics modify column cd_dep_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table customer_demographics modify column cd_education_status set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='2 yr Degree', 'max_value'='Unknown', 'data_size'='18384800') + """ + + sql """ + alter table customer_demographics modify column cd_gender set stats ('row_count'='1920800', 'ndv'='2', 'num_nulls'='0', 'min_value'='F', 'max_value'='M', 'data_size'='1920800') + """ + + sql """ + alter table customer_demographics modify column cd_marital_status set stats ('row_count'='1920800', 'ndv'='5', 'num_nulls'='0', 'min_value'='D', 'max_value'='W', 'data_size'='1920800') + """ + + sql """ + alter table date_dim modify column d_date_id set stats ('row_count'='73049', 'ndv'='72907', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAFCAA', 'max_value'='AAAAAAAAPPPPECAA', 'data_size'='1168784') + """ + + sql """ + alter table date_dim modify column d_fy_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_warehouse_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') + """ + + sql """ + alter table catalog_sales modify column cs_ext_list_price set stats ('row_count'='1439980416', 'ndv'='1160303', 'num_nulls'='7199542', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ext_tax set stats ('row_count'='1439980416', 'ndv'='215267', 'num_nulls'='7200412', 'min_value'='0.00', 'max_value'='2673.27', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_quantity set stats ('row_count'='1439980416', 'ndv'='100', 'num_nulls'='7202885', 'min_value'='1', 'max_value'='100', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7200151', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201507', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_company set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_mkt_desc set stats ('row_count'='42', 'ndv'='33', 'num_nulls'='0', 'min_value'='Arms increase controversial, present so', 'max_value'='Young tests could buy comfortable, local users; o', 'data_size'='2419') + """ + + sql """ + alter table call_center modify column cc_open_date_sk set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='2450794', 'max_value'='2451146', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_rec_end_date set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='21', 'min_value'='2000-01-01', 'max_value'='2001-12-31', 'data_size'='168') + """ + + sql """ + alter table catalog_returns modify column cr_order_number set stats ('row_count'='143996756', 'ndv'='93476424', 'num_nulls'='0', 'min_value'='2', 'max_value'='160000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_amount set stats ('row_count'='143996756', 'ndv'='882831', 'num_nulls'='2880424', 'min_value'='0.00', 'max_value'='28805.04', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returned_date_sk set stats ('row_count'='143996756', 'ndv'='2108', 'num_nulls'='0', 'min_value'='2450821', 'max_value'='2452924', 'data_size'='1151974048') + """ + + sql """ + alter table income_band modify column ib_upper_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='10000', 'max_value'='200000', 'data_size'='80') + """ + + sql """ + alter table catalog_page modify column cp_department set stats ('row_count'='30000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='DEPARTMENT', 'data_size'='297110') + """ + + sql """ + alter table catalog_page modify column cp_end_date_sk set stats ('row_count'='30000', 'ndv'='97', 'num_nulls'='302', 'min_value'='2450844', 'max_value'='2453186', 'data_size'='120000') + """ + + sql """ + alter table item modify column i_brand_id set stats ('row_count'='300000', 'ndv'='951', 'num_nulls'='763', 'min_value'='1001001', 'max_value'='10016017', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_category set stats ('row_count'='300000', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='Women', 'data_size'='1766742') + """ + + sql """ + alter table item modify column i_class_id set stats ('row_count'='300000', 'ndv'='16', 'num_nulls'='722', 'min_value'='1', 'max_value'='16', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_item_sk set stats ('row_count'='300000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2400000') + """ + + sql """ + alter table item modify column i_manufact_id set stats ('row_count'='300000', 'ndv'='1005', 'num_nulls'='761', 'min_value'='1', 'max_value'='1000', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_wholesale_cost set stats ('row_count'='300000', 'ndv'='7243', 'num_nulls'='740', 'min_value'='0.02', 'max_value'='89.49', 'data_size'='1200000') + """ + + sql """ + alter table web_returns modify column wr_refunded_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3240352', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_return_tax set stats ('row_count'='71997522', 'ndv'='137392', 'num_nulls'='3237729', 'min_value'='0.00', 'max_value'='2551.16', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returning_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238239', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_web_page_sk set stats ('row_count'='71997522', 'ndv'='2984', 'num_nulls'='3240387', 'min_value'='1', 'max_value'='3000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_class set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='371') + """ + + sql """ + alter table web_site modify column web_zip set stats ('row_count'='54', 'ndv'='32', 'num_nulls'='0', 'min_value'='14593', 'max_value'='99431', 'data_size'='270') + """ + + sql """ + alter table promotion modify column p_channel_email set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1480') + """ + + sql """ + alter table promotion modify column p_item_sk set stats ('row_count'='1500', 'ndv'='1467', 'num_nulls'='19', 'min_value'='184', 'max_value'='299990', 'data_size'='12000') + """ + + sql """ + alter table promotion modify column p_promo_name set stats ('row_count'='1500', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='5896') + """ + + sql """ + alter table web_sales modify column ws_ext_discount_amt set stats ('row_count'='720000376', 'ndv'='1093513', 'num_nulls'='179851', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ext_list_price set stats ('row_count'='720000376', 'ndv'='1160303', 'num_nulls'='179866', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_wholesale_cost set stats ('row_count'='720000376', 'ndv'='9905', 'num_nulls'='179834', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='2880001504') + """ + + sql """ + alter table store modify column s_market_manager set stats ('row_count'='1002', 'ndv'='732', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Perez', 'data_size'='12823') + """ + + sql """ + alter table store modify column s_number_employees set stats ('row_count'='1002', 'ndv'='101', 'num_nulls'='8', 'min_value'='200', 'max_value'='300', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_rec_end_date set stats ('row_count'='1002', 'ndv'='3', 'num_nulls'='501', 'min_value'='1999-03-13', 'max_value'='2001-03-12', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_rec_start_date set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='7', 'min_value'='1997-03-13', 'max_value'='2001-03-13', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_suite_number set stats ('row_count'='1002', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='7866') + """ + + sql """ + alter table time_dim modify column t_hour set stats ('row_count'='86400', 'ndv'='24', 'num_nulls'='0', 'min_value'='0', 'max_value'='23', 'data_size'='345600') + """ + + sql """ + alter table time_dim modify column t_shift set stats ('row_count'='86400', 'ndv'='3', 'num_nulls'='0', 'min_value'='first', 'max_value'='third', 'data_size'='460800') + """ + + sql """ + alter table web_page modify column wp_link_count set stats ('row_count'='3000', 'ndv'='24', 'num_nulls'='27', 'min_value'='2', 'max_value'='25', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_rec_end_date set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='1500', 'min_value'='1999-09-03', 'max_value'='2001-09-02', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_cdemo_sk set stats ('row_count'='287999764', 'ndv'='1916366', 'num_nulls'='10076902', 'min_value'='1', 'max_value'='1920800', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_item_sk set stats ('row_count'='287999764', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_cdemo_sk set stats ('row_count'='2879987999', 'ndv'='1916366', 'num_nulls'='129602155', 'min_value'='1', 'max_value'='1920800', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_ext_discount_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ext_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='393180', 'num_nulls'='129595018', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_list_price set stats ('row_count'='2879987999', 'ndv'='19640', 'num_nulls'='129597020', 'min_value'='1.00', 'max_value'='200.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_net_paid set stats ('row_count'='2879987999', 'ndv'='1288646', 'num_nulls'='129599407', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_sold_date_sk set stats ('row_count'='2879987999', 'ndv'='1820', 'num_nulls'='129600843', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_sold_time_sk set stats ('row_count'='2879987999', 'ndv'='47252', 'num_nulls'='129593012', 'min_value'='28800', 'max_value'='75599', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_carrier set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AIRBORNE', 'max_value'='ZOUROS', 'data_size'='133') + """ + + sql """ + alter table customer modify column c_birth_year set stats ('row_count'='12000000', 'ndv'='69', 'num_nulls'='419584', 'min_value'='1924', 'max_value'='1992', 'data_size'='48000000') + """ + + sql """ + alter table customer modify column c_login set stats ('row_count'='12000000', 'ndv'='1', 'num_nulls'='0', 'min_value'='', 'max_value'='', 'data_size'='0') + """ + + sql """ + alter table customer modify column c_salutation set stats ('row_count'='12000000', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='Sir', 'data_size'='37544445') + """ + + sql """ + alter table reason modify column r_reason_desc set stats ('row_count'='65', 'ndv'='64', 'num_nulls'='0', 'min_value'='Did not fit', 'max_value'='unauthoized purchase', 'data_size'='848') + """ + + sql """ + alter table date_dim modify column d_current_year set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_dom set stats ('row_count'='73049', 'ndv'='31', 'num_nulls'='0', 'min_value'='1', 'max_value'='31', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_same_day_lq set stats ('row_count'='73049', 'ndv'='72231', 'num_nulls'='0', 'min_value'='2414930', 'max_value'='2487978', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_weekend set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table warehouse modify column w_zip set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='19231', 'max_value'='89275', 'data_size'='100') + """ + + sql """ + alter table catalog_sales modify column cs_catalog_page_sk set stats ('row_count'='1439980416', 'ndv'='17005', 'num_nulls'='7199032', 'min_value'='1', 'max_value'='25207', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_coupon_amt set stats ('row_count'='1439980416', 'ndv'='1578778', 'num_nulls'='7198116', 'min_value'='0.00', 'max_value'='28730.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_list_price set stats ('row_count'='1439980416', 'ndv'='29396', 'num_nulls'='7201549', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_net_profit set stats ('row_count'='1439980416', 'ndv'='2058398', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19962.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_order_number set stats ('row_count'='1439980416', 'ndv'='159051824', 'num_nulls'='0', 'min_value'='1', 'max_value'='160000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7201542', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_call_center_sk set stats ('row_count'='42', 'ndv'='42', 'num_nulls'='0', 'min_value'='1', 'max_value'='42', 'data_size'='336') + """ + + sql """ + alter table call_center modify column cc_city set stats ('row_count'='42', 'ndv'='17', 'num_nulls'='0', 'min_value'='Antioch', 'max_value'='Spring Hill', 'data_size'='386') + """ + + sql """ + alter table call_center modify column cc_closed_date_sk set stats ('row_count'='42', 'ndv'='0', 'num_nulls'='42', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_gmt_offset set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_hours set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='8AM-12AM', 'max_value'='8AM-8AM', 'data_size'='300') + """ + + sql """ + alter table call_center modify column cc_street_number set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='38', 'max_value'='999', 'data_size'='120') + """ + + sql """ + alter table call_center modify column cc_tax_percentage set stats ('row_count'='42', 'ndv'='12', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='168') + """ + + sql """ + alter table inventory modify column inv_date_sk set stats ('row_count'='783000000', 'ndv'='261', 'num_nulls'='0', 'min_value'='2450815', 'max_value'='2452635', 'data_size'='6264000000') + """ + + sql """ + alter table inventory modify column inv_item_sk set stats ('row_count'='783000000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='6264000000') + """ + + sql """ + alter table catalog_returns modify column cr_fee set stats ('row_count'='143996756', 'ndv'='9958', 'num_nulls'='2882168', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_return_quantity set stats ('row_count'='143996756', 'ndv'='100', 'num_nulls'='2878774', 'min_value'='1', 'max_value'='100', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returned_time_sk set stats ('row_count'='143996756', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_dep_count set stats ('row_count'='7200', 'ndv'='10', 'num_nulls'='0', 'min_value'='0', 'max_value'='9', 'data_size'='28800') + """ + + sql """ + alter table customer_address modify column ca_county set stats ('row_count'='6000000', 'ndv'='1825', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='81254984') + """ + + sql """ + alter table income_band modify column ib_lower_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='0', 'max_value'='190001', 'data_size'='80') + """ + + sql """ + alter table item modify column i_category_id set stats ('row_count'='300000', 'ndv'='10', 'num_nulls'='766', 'min_value'='1', 'max_value'='10', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_class set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='0', 'min_value'='', 'max_value'='womens watch', 'data_size'='2331199') + """ + + sql """ + alter table item modify column i_container set stats ('row_count'='300000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='2094652') + """ + + sql """ + alter table item modify column i_current_price set stats ('row_count'='300000', 'ndv'='9685', 'num_nulls'='775', 'min_value'='0.09', 'max_value'='99.99', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_manager_id set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='744', 'min_value'='1', 'max_value'='100', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_size set stats ('row_count'='300000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='small', 'data_size'='1296134') + """ + + sql """ + alter table web_returns modify column wr_order_number set stats ('row_count'='71997522', 'ndv'='42383708', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_refunded_cash set stats ('row_count'='71997522', 'ndv'='955369', 'num_nulls'='3240493', 'min_value'='0.00', 'max_value'='26992.92', 'data_size'='287990088') + """ + + sql """ + alter table web_site modify column web_country set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='689') + """ + + sql """ + alter table web_site modify column web_gmt_offset set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='1', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_market_manager set stats ('row_count'='54', 'ndv'='46', 'num_nulls'='0', 'min_value'='', 'max_value'='Zachery Oneil', 'data_size'='691') + """ + + sql """ + alter table web_site modify column web_site_sk set stats ('row_count'='54', 'ndv'='54', 'num_nulls'='0', 'min_value'='1', 'max_value'='54', 'data_size'='432') + """ + + sql """ + alter table web_site modify column web_street_name set stats ('row_count'='54', 'ndv'='53', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Ridge', 'data_size'='471') + """ + + sql """ + alter table web_site modify column web_tax_percentage set stats ('row_count'='54', 'ndv'='13', 'num_nulls'='1', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='216') + """ + + sql """ + alter table promotion modify column p_channel_tv set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') + """ + + sql """ + alter table promotion modify column p_response_targe set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='27', 'min_value'='1', 'max_value'='1', 'data_size'='6000') + """ + + sql """ + alter table web_sales modify column ws_bill_addr_sk set stats ('row_count'='720000376', 'ndv'='6015742', 'num_nulls'='179648', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ext_sales_price set stats ('row_count'='720000376', 'ndv'='1091003', 'num_nulls'='180023', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_profit set stats ('row_count'='720000376', 'ndv'='2014057', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19840.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_promo_sk set stats ('row_count'='720000376', 'ndv'='1489', 'num_nulls'='180016', 'min_value'='1', 'max_value'='1500', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ship_customer_sk set stats ('row_count'='720000376', 'ndv'='12074547', 'num_nulls'='179966', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_division_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') + """ + + sql """ + alter table store modify column s_floor_space set stats ('row_count'='1002', 'ndv'='752', 'num_nulls'='6', 'min_value'='5002549', 'max_value'='9997773', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_tax_percentage set stats ('row_count'='1002', 'ndv'='12', 'num_nulls'='8', 'min_value'='0.00', 'max_value'='0.11', 'data_size'='4008') + """ + + sql """ + alter table time_dim modify column t_time_id set stats ('row_count'='86400', 'ndv'='85663', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPAAAA', 'data_size'='1382400') + """ + + sql """ + alter table time_dim modify column t_time_sk set stats ('row_count'='86400', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='691200') + """ + + sql """ + alter table store_returns modify column sr_fee set stats ('row_count'='287999764', 'ndv'='9958', 'num_nulls'='10081860', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_reason_sk set stats ('row_count'='287999764', 'ndv'='65', 'num_nulls'='10087936', 'min_value'='1', 'max_value'='65', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_store_credit set stats ('row_count'='287999764', 'ndv'='698161', 'num_nulls'='10077188', 'min_value'='0.00', 'max_value'='17792.48', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_ticket_number set stats ('row_count'='287999764', 'ndv'='168770768', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_ext_list_price set stats ('row_count'='2879987999', 'ndv'='770971', 'num_nulls'='129593800', 'min_value'='1.00', 'max_value'='20000.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ext_sales_price set stats ('row_count'='2879987999', 'ndv'='754248', 'num_nulls'='129589177', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_net_profit set stats ('row_count'='2879987999', 'ndv'='1497362', 'num_nulls'='129572933', 'min_value'='-10000.00', 'max_value'='9986.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_promo_sk set stats ('row_count'='2879987999', 'ndv'='1489', 'num_nulls'='129597096', 'min_value'='1', 'max_value'='1500', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_code set stats ('row_count'='20', 'ndv'='4', 'num_nulls'='0', 'min_value'='AIR', 'max_value'='SURFACE', 'data_size'='87') + """ + + sql """ + alter table ship_mode modify column sm_contract set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='2mM8l', 'max_value'='yVfotg7Tio3MVhBg6Bkn', 'data_size'='252') + """ + + sql """ + alter table customer modify column c_current_hdemo_sk set stats ('row_count'='12000000', 'ndv'='7251', 'num_nulls'='418736', 'min_value'='1', 'max_value'='7200', 'data_size'='96000000') + """ + + sql """ + alter table dbgen_version modify column dv_create_date set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2023-07-06', 'max_value'='2023-07-06', 'data_size'='4') + """ + + sql """ + alter table dbgen_version modify column dv_create_time set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2017-05-13 00:00:00', 'max_value'='2017-05-13 00:00:00', 'data_size'='8') + """ +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/load.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/load.groovy new file mode 100644 index 00000000000000..94ff5a97d8b216 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/load.groovy @@ -0,0 +1,2520 @@ +// 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("load") { + String database = context.config.getDbNameByFile(context.file) + sql "drop database if exists ${database}" + sql "create database ${database}" + sql "use ${database}" + + sql ''' + drop table if exists customer_demographics + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer_demographics ( + cd_demo_sk int not null, + cd_gender varchar(1), + cd_marital_status varchar(1), + cd_education_status varchar(20), + cd_purchase_estimate integer, + cd_credit_rating varchar(10), + cd_dep_count integer, + cd_dep_employed_count integer, + cd_dep_college_count integer + ) + DUPLICATE KEY(cd_demo_sk) + DISTRIBUTED BY HASH(cd_demo_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists reason + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS reason ( + r_reason_sk int not null, + r_reason_id varchar(16) not null, + r_reason_desc varchar(100) + ) + DUPLICATE KEY(r_reason_sk) + DISTRIBUTED BY HASH(r_reason_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists date_dim + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS date_dim ( + d_date_sk int not null, + d_date_id varchar(16) not null, + d_date datev2, + d_month_seq integer, + d_week_seq integer, + d_quarter_seq integer, + d_year integer, + d_dow integer, + d_moy integer, + d_dom integer, + d_qoy integer, + d_fy_year integer, + d_fy_quarter_seq integer, + d_fy_week_seq integer, + d_day_name varchar(9), + d_quarter_name varchar(6), + d_holiday varchar(1), + d_weekend varchar(1), + d_following_holiday varchar(1), + d_first_dom integer, + d_last_dom integer, + d_same_day_ly integer, + d_same_day_lq integer, + d_current_day varchar(1), + d_current_week varchar(1), + d_current_month varchar(1), + d_current_quarter varchar(1), + d_current_year varchar(1) + ) + DUPLICATE KEY(d_date_sk) + DISTRIBUTED BY HASH(d_date_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists warehouse + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS warehouse ( + w_warehouse_sk int not null, + w_warehouse_id varchar(16) not null, + w_warehouse_name varchar(20), + w_warehouse_sq_ft integer, + w_street_number varchar(10), + w_street_name varchar(60), + w_street_type varchar(15), + w_suite_number varchar(10), + w_city varchar(60), + w_county varchar(30), + w_state varchar(2), + w_zip varchar(10), + w_country varchar(20), + w_gmt_offset decimalv3(5,2) + ) + DUPLICATE KEY(w_warehouse_sk) + DISTRIBUTED BY HASH(w_warehouse_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_sales ( + cs_sold_date_sk int, + cs_item_sk int not null, + cs_order_number int not null, + cs_sold_time_sk int, + cs_ship_date_sk int, + cs_bill_customer_sk int, + cs_bill_cdemo_sk int, + cs_bill_hdemo_sk int, + cs_bill_addr_sk int, + cs_ship_customer_sk int, + cs_ship_cdemo_sk int, + cs_ship_hdemo_sk int, + cs_ship_addr_sk int, + cs_call_center_sk int, + cs_catalog_page_sk int, + cs_ship_mode_sk int, + cs_warehouse_sk int, + cs_promo_sk int, + cs_quantity int, + cs_wholesale_cost decimalv3(7,2), + cs_list_price decimalv3(7,2), + cs_sales_price decimalv3(7,2), + cs_ext_discount_amt decimalv3(7,2), + cs_ext_sales_price decimalv3(7,2), + cs_ext_wholesale_cost decimalv3(7,2), + cs_ext_list_price decimalv3(7,2), + cs_ext_tax decimalv3(7,2), + cs_coupon_amt decimalv3(7,2), + cs_ext_ship_cost decimalv3(7,2), + cs_net_paid decimalv3(7,2), + cs_net_paid_inc_tax decimalv3(7,2), + cs_net_paid_inc_ship decimalv3(7,2), + cs_net_paid_inc_ship_tax decimalv3(7,2), + cs_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`cs_sold_date_sk`, `cs_item_sk`, `cs_order_number`) + DISTRIBUTED BY HASH(cs_item_sk, cs_order_number) BUCKETS 261 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists call_center + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS call_center ( + cc_call_center_sk int not null, + cc_call_center_id varchar(16) not null, + cc_rec_start_date date, + cc_rec_end_date date, + cc_closed_date_sk integer, + cc_open_date_sk integer, + cc_name varchar(50), + cc_class varchar(50), + cc_employees integer, + cc_sq_ft integer, + cc_hours varchar(20), + cc_manager varchar(40), + cc_mkt_id integer, + cc_mkt_class varchar(50), + cc_mkt_desc varchar(100), + cc_market_manager varchar(40), + cc_division integer, + cc_division_name varchar(50), + cc_company integer, + cc_company_name varchar(50), + cc_street_number varchar(10), + cc_street_name varchar(60), + cc_street_type varchar(15), + cc_suite_number varchar(10), + cc_city varchar(60), + cc_county varchar(30), + cc_state varchar(2), + cc_zip varchar(10), + cc_country varchar(20), + cc_gmt_offset decimalv3(5,2), + cc_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(cc_call_center_sk) + DISTRIBUTED BY HASH(cc_call_center_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists inventory + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS inventory ( + inv_date_sk int not null, + inv_item_sk int not null, + inv_warehouse_sk int, + inv_quantity_on_hand integer + ) + DUPLICATE KEY(inv_date_sk, inv_item_sk, inv_warehouse_sk) + DISTRIBUTED BY HASH(inv_item_sk) BUCKETS 63 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_returns ( + cr_returned_date_sk int, + cr_item_sk int not null, + cr_order_number int not null, + cr_returned_time_sk int, + cr_refunded_customer_sk int, + cr_refunded_cdemo_sk int, + cr_refunded_hdemo_sk int, + cr_refunded_addr_sk int, + cr_returning_customer_sk int, + cr_returning_cdemo_sk int, + cr_returning_hdemo_sk int, + cr_returning_addr_sk int, + cr_call_center_sk int, + cr_catalog_page_sk int, + cr_ship_mode_sk int, + cr_warehouse_sk int, + cr_reason_sk int, + cr_return_quantity integer, + cr_return_amount decimalv3(7,2), + cr_return_tax decimalv3(7,2), + cr_return_amt_inc_tax decimalv3(7,2), + cr_fee decimalv3(7,2), + cr_return_ship_cost decimalv3(7,2), + cr_refunded_cash decimalv3(7,2), + cr_reversed_charge decimalv3(7,2), + cr_store_credit decimalv3(7,2), + cr_net_loss decimalv3(7,2) + ) + DUPLICATE KEY(`cr_returned_date_sk`, `cr_item_sk`, `cr_order_number`) + DISTRIBUTED BY HASH(cr_item_sk, cr_order_number) BUCKETS 36 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists household_demographics + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS household_demographics ( + hd_demo_sk int not null, + hd_income_band_sk int, + hd_buy_potential varchar(15), + hd_dep_count integer, + hd_vehicle_count integer + ) + DUPLICATE KEY(hd_demo_sk) + DISTRIBUTED BY HASH(hd_demo_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists customer_address + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer_address ( + ca_address_sk int not null, + ca_address_id varchar(16) not null, + ca_street_number varchar(10), + ca_street_name varchar(60), + ca_street_type varchar(15), + ca_suite_number varchar(10), + ca_city varchar(60), + ca_county varchar(30), + ca_state varchar(2), + ca_zip varchar(10), + ca_country varchar(20), + ca_gmt_offset decimalv3(5,2), + ca_location_type varchar(20) + ) + DUPLICATE KEY(ca_address_sk) + DISTRIBUTED BY HASH(ca_address_sk) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists income_band + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS income_band ( + ib_income_band_sk int not null, + ib_lower_bound integer, + ib_upper_bound integer + ) + DUPLICATE KEY(ib_income_band_sk) + DISTRIBUTED BY HASH(ib_income_band_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists catalog_page + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS catalog_page ( + cp_catalog_page_sk int not null, + cp_catalog_page_id varchar(16) not null, + cp_start_date_sk integer, + cp_end_date_sk integer, + cp_department varchar(50), + cp_catalog_number integer, + cp_catalog_page_number integer, + cp_description varchar(100), + cp_type varchar(100) + ) + DUPLICATE KEY(cp_catalog_page_sk) + DISTRIBUTED BY HASH(cp_catalog_page_sk) BUCKETS 3 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists item + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS item ( + i_item_sk int not null, + i_item_id varchar(16) not null, + i_rec_start_date datev2, + i_rec_end_date datev2, + i_item_desc varchar(200), + i_current_price decimalv3(7,2), + i_wholesale_cost decimalv3(7,2), + i_brand_id integer, + i_brand varchar(50), + i_class_id integer, + i_class char(50), + i_category_id integer, + i_category varchar(50), + i_manufact_id integer, + i_manufact varchar(50), + i_size varchar(20), + i_formulation varchar(20), + i_color varchar(20), + i_units varchar(10), + i_container varchar(10), + i_manager_id integer, + i_product_name varchar(50) + ) + DUPLICATE KEY(i_item_sk) + DISTRIBUTED BY HASH(i_item_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_returns ( + wr_returned_date_sk int, + wr_item_sk int not null, + wr_order_number int not null, + wr_returned_time_sk int, + wr_refunded_customer_sk int, + wr_refunded_cdemo_sk int, + wr_refunded_hdemo_sk int, + wr_refunded_addr_sk int, + wr_returning_customer_sk int, + wr_returning_cdemo_sk int, + wr_returning_hdemo_sk int, + wr_returning_addr_sk int, + wr_web_page_sk int, + wr_reason_sk int, + wr_return_quantity integer, + wr_return_amt decimalv3(7,2), + wr_return_tax decimalv3(7,2), + wr_return_amt_inc_tax decimalv3(7,2), + wr_fee decimalv3(7,2), + wr_return_ship_cost decimalv3(7,2), + wr_refunded_cash decimalv3(7,2), + wr_reversed_charge decimalv3(7,2), + wr_account_credit decimalv3(7,2), + wr_net_loss decimalv3(7,2) + ) + DUPLICATE KEY(`wr_returned_date_sk`, `wr_item_sk`, `wr_order_number`) + DISTRIBUTED BY HASH(`wr_item_sk`, `wr_order_number`) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_site + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_site ( + web_site_sk int not null, + web_site_id varchar(16) not null, + web_rec_start_date datev2, + web_rec_end_date datev2, + web_name varchar(50), + web_open_date_sk int, + web_close_date_sk int, + web_class varchar(50), + web_manager varchar(40), + web_mkt_id integer, + web_mkt_class varchar(50), + web_mkt_desc varchar(100), + web_market_manager varchar(40), + web_company_id integer, + web_company_name varchar(50), + web_street_number varchar(10), + web_street_name varchar(60), + web_street_type varchar(15), + web_suite_number varchar(10), + web_city varchar(60), + web_county varchar(30), + web_state varchar(2), + web_zip varchar(10), + web_country varchar(20), + web_gmt_offset decimalv3(5,2), + web_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(web_site_sk) + DISTRIBUTED BY HASH(web_site_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists promotion + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS promotion ( + p_promo_sk int not null, + p_promo_id varchar(16) not null, + p_start_date_sk int, + p_end_date_sk int, + p_item_sk int, + p_cost decimalv3(15,2), + p_response_targe integer, + p_promo_name varchar(50), + p_channel_dmail varchar(1), + p_channel_email varchar(1), + p_channel_catalog varchar(1), + p_channel_tv varchar(1), + p_channel_radio varchar(1), + p_channel_press varchar(1), + p_channel_event varchar(1), + p_channel_demo varchar(1), + p_channel_details varchar(100), + p_purpose varchar(15), + p_discount_active varchar(1) + ) + DUPLICATE KEY(p_promo_sk) + DISTRIBUTED BY HASH(p_promo_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_sales ( + ws_sold_date_sk int, + ws_item_sk int not null, + ws_order_number int not null, + ws_sold_time_sk int, + ws_ship_date_sk int, + ws_bill_customer_sk int, + ws_bill_cdemo_sk int, + ws_bill_hdemo_sk int, + ws_bill_addr_sk int, + ws_ship_customer_sk int, + ws_ship_cdemo_sk int, + ws_ship_hdemo_sk int, + ws_ship_addr_sk int, + ws_web_page_sk int, + ws_web_site_sk int, + ws_ship_mode_sk int, + ws_warehouse_sk int, + ws_promo_sk int, + ws_quantity integer, + ws_wholesale_cost decimalv3(7,2), + ws_list_price decimalv3(7,2), + ws_sales_price decimalv3(7,2), + ws_ext_discount_amt decimalv3(7,2), + ws_ext_sales_price decimalv3(7,2), + ws_ext_wholesale_cost decimalv3(7,2), + ws_ext_list_price decimalv3(7,2), + ws_ext_tax decimalv3(7,2), + ws_coupon_amt decimalv3(7,2), + ws_ext_ship_cost decimalv3(7,2), + ws_net_paid decimalv3(7,2), + ws_net_paid_inc_tax decimalv3(7,2), + ws_net_paid_inc_ship decimalv3(7,2), + ws_net_paid_inc_ship_tax decimalv3(7,2), + ws_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`ws_sold_date_sk`, `ws_item_sk`, `ws_order_number`) + DISTRIBUTED BY HASH(ws_item_sk, ws_order_number) BUCKETS 126 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store ( + s_store_sk int not null, + s_store_id varchar(16) not null, + s_rec_start_date datev2, + s_rec_end_date datev2, + s_closed_date_sk int, + s_store_name varchar(50), + s_number_employees integer, + s_floor_space integer, + s_hours varchar(20), + s_manager varchar(40), + s_market_id integer, + s_geography_class varchar(100), + s_market_desc varchar(100), + s_market_manager varchar(40), + s_division_id integer, + s_division_name varchar(50), + s_company_id integer, + s_company_name varchar(50), + s_street_number varchar(10), + s_street_name varchar(60), + s_street_type varchar(15), + s_suite_number varchar(10), + s_city varchar(60), + s_county varchar(30), + s_state varchar(2), + s_zip varchar(10), + s_country varchar(20), + s_gmt_offset decimalv3(5,2), + s_tax_percentage decimalv3(5,2) + ) + DUPLICATE KEY(s_store_sk) + DISTRIBUTED BY HASH(s_store_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists time_dim + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS time_dim ( + t_time_sk int not null, + t_time_id varchar(16) not null, + t_time integer, + t_hour integer, + t_minute integer, + t_second integer, + t_am_pm varchar(2), + t_shift varchar(20), + t_sub_shift varchar(20), + t_meal_time varchar(20) + ) + DUPLICATE KEY(t_time_sk) + DISTRIBUTED BY HASH(t_time_sk) BUCKETS 9 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists web_page + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS web_page ( + wp_web_page_sk int not null, + wp_web_page_id varchar(16) not null, + wp_rec_start_date datev2, + wp_rec_end_date datev2, + wp_creation_date_sk int, + wp_access_date_sk int, + wp_autogen_flag varchar(1), + wp_customer_sk int, + wp_url varchar(100), + wp_type varchar(50), + wp_char_count integer, + wp_link_count integer, + wp_image_count integer, + wp_max_ad_count integer + ) + DUPLICATE KEY(wp_web_page_sk) + DISTRIBUTED BY HASH(wp_web_page_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store_returns + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store_returns ( + sr_returned_date_sk int, + sr_item_sk int not null, + sr_ticket_number int not null, + sr_return_time_sk int, + sr_customer_sk int, + sr_cdemo_sk int, + sr_hdemo_sk int, + sr_addr_sk int, + sr_store_sk int, + sr_reason_sk int, + sr_return_quantity integer, + sr_return_amt decimalv3(7,2), + sr_return_tax decimalv3(7,2), + sr_return_amt_inc_tax decimalv3(7,2), + sr_fee decimalv3(7,2), + sr_return_ship_cost decimalv3(7,2), + sr_refunded_cash decimalv3(7,2), + sr_reversed_charge decimalv3(7,2), + sr_store_credit decimalv3(7,2), + sr_net_loss decimalv3(7,2) + ) + duplicate key(`sr_returned_date_sk`, `sr_item_sk`, `sr_ticket_number`) + distributed by hash (sr_item_sk, sr_ticket_number) buckets 36 + properties ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists store_sales + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS store_sales ( + ss_sold_date_sk int, + ss_item_sk int not null, + ss_ticket_number int not null, + ss_sold_time_sk int, + ss_customer_sk int, + ss_cdemo_sk int, + ss_hdemo_sk int, + ss_addr_sk int, + ss_store_sk int, + ss_promo_sk int, + ss_quantity integer, + ss_wholesale_cost decimalv3(7,2), + ss_list_price decimalv3(7,2), + ss_sales_price decimalv3(7,2), + ss_ext_discount_amt decimalv3(7,2), + ss_ext_sales_price decimalv3(7,2), + ss_ext_wholesale_cost decimalv3(7,2), + ss_ext_list_price decimalv3(7,2), + ss_ext_tax decimalv3(7,2), + ss_coupon_amt decimalv3(7,2), + ss_net_paid decimalv3(7,2), + ss_net_paid_inc_tax decimalv3(7,2), + ss_net_profit decimalv3(7,2) + ) + DUPLICATE KEY(`ss_sold_date_sk`, `ss_item_sk`, `ss_ticket_number`) + DISTRIBUTED BY HASH(ss_item_sk, ss_ticket_number) BUCKETS 261 + PROPERTIES ( + "replication_num" = "1", + "colocate_with" = "store" + ) + ''' + + sql ''' + drop table if exists ship_mode + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS ship_mode ( + sm_ship_mode_sk int not null, + sm_ship_mode_id varchar(16) not null, + sm_type varchar(30), + sm_code varchar(10), + sm_carrier varchar(20), + sm_contract varchar(20) + ) + DUPLICATE KEY(sm_ship_mode_sk) + DISTRIBUTED BY HASH(sm_ship_mode_sk) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists customer + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS customer ( + c_customer_sk int not null, + c_customer_id varchar(16) not null, + c_current_cdemo_sk int, + c_current_hdemo_sk int, + c_current_addr_sk int, + c_first_shipto_date_sk int, + c_first_sales_date_sk int, + c_salutation varchar(10), + c_first_name varchar(20), + c_last_name varchar(30), + c_preferred_cust_flag varchar(1), + c_birth_day integer, + c_birth_month integer, + c_birth_year integer, + c_birth_country varchar(20), + c_login varchar(13), + c_email_address varchar(50), + c_last_review_date_sk int + ) + DUPLICATE KEY(c_customer_sk) + DISTRIBUTED BY HASH(c_customer_sk) BUCKETS 18 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql ''' + drop table if exists dbgen_version + ''' + + sql ''' + CREATE TABLE IF NOT EXISTS dbgen_version + ( + dv_version varchar(16) , + dv_create_date datev2 , + dv_create_time datetime , + dv_cmdline_args varchar(200) + ) + DUPLICATE KEY(dv_version) + DISTRIBUTED BY HASH(dv_version) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + ''' + + sql """ + alter table customer_demographics modify column cd_dep_employed_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table date_dim modify column d_day_name set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='Friday', 'max_value'='Wednesday', 'data_size'='521779') + """ + + sql """ + alter table date_dim modify column d_following_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_same_day_ly set stats ('row_count'='73049', 'ndv'='72450', 'num_nulls'='0', 'min_value'='2414657', 'max_value'='2487705', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_city set stats ('row_count'='20', 'ndv'='12', 'num_nulls'='0', 'min_value'='Fairview', 'max_value'='Shiloh', 'data_size'='183') + """ + + sql """ + alter table warehouse modify column w_street_type set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='71') + """ + + sql """ + alter table catalog_sales modify column cs_call_center_sk set stats ('row_count'='1439980416', 'ndv'='42', 'num_nulls'='7199711', 'min_value'='1', 'max_value'='42', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_ship set stats ('row_count'='1439980416', 'ndv'='2505826', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='43956.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_sales_price set stats ('row_count'='1439980416', 'ndv'='29306', 'num_nulls'='7200276', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_class set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='large', 'max_value'='small', 'data_size'='226') + """ + + sql """ + alter table call_center modify column cc_country set stats ('row_count'='42', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='546') + """ + + sql """ + alter table call_center modify column cc_county set stats ('row_count'='42', 'ndv'='16', 'num_nulls'='0', 'min_value'='Barrow County', 'max_value'='Williamson County', 'data_size'='627') + """ + + sql """ + alter table call_center modify column cc_mkt_class set stats ('row_count'='42', 'ndv'='36', 'num_nulls'='0', 'min_value'='A bit narrow forms matter animals. Consist', 'max_value'='Yesterday new men can make moreov', 'data_size'='1465') + """ + + sql """ + alter table call_center modify column cc_sq_ft set stats ('row_count'='42', 'ndv'='31', 'num_nulls'='0', 'min_value'='-1890660328', 'max_value'='2122480316', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_state set stats ('row_count'='42', 'ndv'='14', 'num_nulls'='0', 'min_value'='FL', 'max_value'='WV', 'data_size'='84') + """ + + sql """ + alter table inventory modify column inv_warehouse_sk set stats ('row_count'='783000000', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='6264000000') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2881609', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_cash set stats ('row_count'='143996756', 'ndv'='1107525', 'num_nulls'='2879192', 'min_value'='0.00', 'max_value'='26955.24', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2881314', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_amt_inc_tax set stats ('row_count'='143996756', 'ndv'='1544502', 'num_nulls'='2881886', 'min_value'='0.00', 'max_value'='30418.06', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returning_addr_sk set stats ('row_count'='143996756', 'ndv'='6015811', 'num_nulls'='2883215', 'min_value'='1', 'max_value'='6000000', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_buy_potential set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='0-500', 'max_value'='Unknown', 'data_size'='54000') + """ + + sql """ + alter table customer_address modify column ca_address_id set stats ('row_count'='6000000', 'ndv'='5984931', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPEAA', 'data_size'='96000000') + """ + + sql """ + alter table customer_address modify column ca_address_sk set stats ('row_count'='6000000', 'ndv'='6015811', 'num_nulls'='0', 'min_value'='1', 'max_value'='6000000', 'data_size'='48000000') + """ + + sql """ + alter table customer_address modify column ca_country set stats ('row_count'='6000000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='75661794') + """ + + sql """ + alter table customer_address modify column ca_location_type set stats ('row_count'='6000000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='single family', 'data_size'='52372545') + """ + + sql """ + alter table customer_address modify column ca_street_number set stats ('row_count'='6000000', 'ndv'='1002', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='16837336') + """ + + sql """ + alter table customer_address modify column ca_suite_number set stats ('row_count'='6000000', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='45911575') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_id set stats ('row_count'='30000', 'ndv'='29953', 'num_nulls'='0', 'min_value'='AAAAAAAAAAABAAAA', 'max_value'='AAAAAAAAPPPGAAAA', 'data_size'='480000') + """ + + sql """ + alter table item modify column i_rec_end_date set stats ('row_count'='300000', 'ndv'='3', 'num_nulls'='150000', 'min_value'='1999-10-27', 'max_value'='2001-10-26', 'data_size'='1200000') + """ + + sql """ + alter table web_returns modify column wr_refunded_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239971', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_reversed_charge set stats ('row_count'='71997522', 'ndv'='692680', 'num_nulls'='3239546', 'min_value'='0.00', 'max_value'='23194.77', 'data_size'='287990088') + """ + + sql """ + alter table web_site modify column web_state set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='0', 'min_value'='AL', 'max_value'='WV', 'data_size'='108') + """ + + sql """ + alter table promotion modify column p_end_date_sk set stats ('row_count'='1500', 'ndv'='683', 'num_nulls'='18', 'min_value'='2450113', 'max_value'='2450967', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_bill_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='180139', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ext_ship_cost set stats ('row_count'='720000376', 'ndv'='567477', 'num_nulls'='180084', 'min_value'='0.00', 'max_value'='14950.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_addr_sk set stats ('row_count'='720000376', 'ndv'='6015811', 'num_nulls'='179848', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ship_mode_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180017', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_warehouse_sk set stats ('row_count'='720000376', 'ndv'='20', 'num_nulls'='180105', 'min_value'='1', 'max_value'='20', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_company_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') + """ + + sql """ + alter table store modify column s_gmt_offset set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='6', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_manager set stats ('row_count'='1002', 'ndv'='739', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Clifton', 'data_size'='12649') + """ + + sql """ + alter table store modify column s_street_number set stats ('row_count'='1002', 'ndv'='521', 'num_nulls'='0', 'min_value'='', 'max_value'='999', 'data_size'='2874') + """ + + sql """ + alter table time_dim modify column t_meal_time set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='lunch', 'data_size'='248400') + """ + + sql """ + alter table time_dim modify column t_time set stats ('row_count'='86400', 'ndv'='86684', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='345600') + """ + + sql """ + alter table web_page modify column wp_creation_date_sk set stats ('row_count'='3000', 'ndv'='199', 'num_nulls'='33', 'min_value'='2450604', 'max_value'='2450815', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_customer_sk set stats ('row_count'='3000', 'ndv'='713', 'num_nulls'='2147', 'min_value'='9522', 'max_value'='11995685', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_max_ad_count set stats ('row_count'='3000', 'ndv'='5', 'num_nulls'='31', 'min_value'='0', 'max_value'='4', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_url set stats ('row_count'='3000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='http://www.foo.com', 'data_size'='53406') + """ + + sql """ + alter table store_returns modify column sr_refunded_cash set stats ('row_count'='287999764', 'ndv'='928470', 'num_nulls'='10081294', 'min_value'='0.00', 'max_value'='18173.96', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_tax set stats ('row_count'='287999764', 'ndv'='117247', 'num_nulls'='10081332', 'min_value'='0.00', 'max_value'='1682.04', 'data_size'='1151999056') + """ + + sql """ + alter table store_sales modify column ss_customer_sk set stats ('row_count'='2879987999', 'ndv'='12157481', 'num_nulls'='129590766', 'min_value'='1', 'max_value'='12000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_hdemo_sk set stats ('row_count'='2879987999', 'ndv'='7251', 'num_nulls'='129594559', 'min_value'='1', 'max_value'='7200', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_store_sk set stats ('row_count'='2879987999', 'ndv'='499', 'num_nulls'='129572050', 'min_value'='1', 'max_value'='1000', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_ship_mode_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') + """ + + sql """ + alter table ship_mode modify column sm_ship_mode_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table customer modify column c_first_name set stats ('row_count'='12000000', 'ndv'='5140', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma', 'data_size'='67593278') + """ + + sql """ + alter table customer modify column c_first_sales_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='419856', 'min_value'='2448998', 'max_value'='2452648', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_first_shipto_date_sk set stats ('row_count'='12000000', 'ndv'='3644', 'num_nulls'='420769', 'min_value'='2449028', 'max_value'='2452678', 'data_size'='96000000') + """ + + sql """ + alter table customer_demographics modify column cd_dep_college_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table date_dim modify column d_dow set stats ('row_count'='73049', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_fy_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_qoy set stats ('row_count'='73049', 'ndv'='4', 'num_nulls'='0', 'min_value'='1', 'max_value'='4', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_quarter_seq set stats ('row_count'='73049', 'ndv'='801', 'num_nulls'='0', 'min_value'='1', 'max_value'='801', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_street_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Elm', 'data_size'='176') + """ + + sql """ + alter table warehouse modify column w_suite_number set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite X', 'data_size'='150') + """ + + sql """ + alter table catalog_sales modify column cs_bill_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7202134', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_bill_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7198837', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ext_ship_cost set stats ('row_count'='1439980416', 'ndv'='573238', 'num_nulls'='7202537', 'min_value'='0.00', 'max_value'='14994.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='California', 'max_value'='Pacific Northwest_2', 'data_size'='572') + """ + + sql """ + alter table call_center modify column cc_street_name set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='1st', 'max_value'='Willow', 'data_size'='356') + """ + + sql """ + alter table call_center modify column cc_zip set stats ('row_count'='42', 'ndv'='19', 'num_nulls'='0', 'min_value'='18605', 'max_value'='98048', 'data_size'='210') + """ + + sql """ + alter table inventory modify column inv_quantity_on_hand set stats ('row_count'='783000000', 'ndv'='1006', 'num_nulls'='39153758', 'min_value'='0', 'max_value'='1000', 'data_size'='3132000000') + """ + + sql """ + alter table catalog_returns modify column cr_catalog_page_sk set stats ('row_count'='143996756', 'ndv'='17005', 'num_nulls'='2882502', 'min_value'='1', 'max_value'='25207', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_income_band_sk set stats ('row_count'='7200', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='57600') + """ + + sql """ + alter table catalog_page modify column cp_description set stats ('row_count'='30000', 'ndv'='30141', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters worry both workers. Fascinating characters take cheap never alive studies. Direct, old', 'data_size'='2215634') + """ + + sql """ + alter table item modify column i_item_id set stats ('row_count'='300000', 'ndv'='150851', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPBAAA', 'data_size'='4800000') + """ + + sql """ + alter table web_returns modify column wr_account_credit set stats ('row_count'='71997522', 'ndv'='683955', 'num_nulls'='3241972', 'min_value'='0.00', 'max_value'='23166.33', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_net_loss set stats ('row_count'='71997522', 'ndv'='815608', 'num_nulls'='3240573', 'min_value'='0.50', 'max_value'='15887.84', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_amt set stats ('row_count'='71997522', 'ndv'='808311', 'num_nulls'='3238405', 'min_value'='0.00', 'max_value'='29191.00', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_amt_inc_tax set stats ('row_count'='71997522', 'ndv'='1359913', 'num_nulls'='3239765', 'min_value'='0.00', 'max_value'='30393.01', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_return_quantity set stats ('row_count'='71997522', 'ndv'='100', 'num_nulls'='3238643', 'min_value'='1', 'max_value'='100', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returning_addr_sk set stats ('row_count'='71997522', 'ndv'='6015811', 'num_nulls'='3239658', 'min_value'='1', 'max_value'='6000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_returning_customer_sk set stats ('row_count'='71997522', 'ndv'='12119220', 'num_nulls'='3237281', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_mkt_desc set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Acres see else children. Mutual too', 'max_value'='Windows increase to a differences. Other parties might in', 'data_size'='3473') + """ + + sql """ + alter table web_site modify column web_mkt_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='1', 'min_value'='1', 'max_value'='6', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_rec_end_date set stats ('row_count'='54', 'ndv'='3', 'num_nulls'='27', 'min_value'='1999-08-16', 'max_value'='2001-08-15', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_site_id set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='864') + """ + + sql """ + alter table web_site modify column web_street_type set stats ('row_count'='54', 'ndv'='20', 'num_nulls'='0', 'min_value'='Ave', 'max_value'='Wy', 'data_size'='208') + """ + + sql """ + alter table promotion modify column p_channel_demo set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') + """ + + sql """ + alter table promotion modify column p_channel_details set stats ('row_count'='1500', 'ndv'='1490', 'num_nulls'='0', 'min_value'='', 'max_value'='Young, valuable companies watch walls. Payments can flour', 'data_size'='59126') + """ + + sql """ + alter table promotion modify column p_channel_event set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') + """ + + sql """ + alter table promotion modify column p_discount_active set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1473') + """ + + sql """ + alter table promotion modify column p_promo_sk set stats ('row_count'='1500', 'ndv'='1489', 'num_nulls'='0', 'min_value'='1', 'max_value'='1500', 'data_size'='12000') + """ + + sql """ + alter table promotion modify column p_purpose set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='10374') + """ + + sql """ + alter table web_sales modify column ws_bill_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='179788', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_sold_date_sk set stats ('row_count'='720000376', 'ndv'='1820', 'num_nulls'='179921', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_web_site_sk set stats ('row_count'='720000376', 'ndv'='54', 'num_nulls'='179930', 'min_value'='1', 'max_value'='54', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_city set stats ('row_count'='1002', 'ndv'='55', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='9238') + """ + + sql """ + alter table store modify column s_company_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='7', 'min_value'='1', 'max_value'='1', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_county set stats ('row_count'='1002', 'ndv'='28', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='14291') + """ + + sql """ + alter table store modify column s_geography_class set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6972') + """ + + sql """ + alter table store modify column s_hours set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='8AM-8AM', 'data_size'='7088') + """ + + sql """ + alter table store modify column s_store_id set stats ('row_count'='1002', 'ndv'='501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPBAAAAA', 'data_size'='16032') + """ + + sql """ + alter table store modify column s_zip set stats ('row_count'='1002', 'ndv'='354', 'num_nulls'='0', 'min_value'='', 'max_value'='99454', 'data_size'='4975') + """ + + sql """ + alter table time_dim modify column t_am_pm set stats ('row_count'='86400', 'ndv'='2', 'num_nulls'='0', 'min_value'='AM', 'max_value'='PM', 'data_size'='172800') + """ + + sql """ + alter table time_dim modify column t_minute set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') + """ + + sql """ + alter table web_page modify column wp_web_page_id set stats ('row_count'='3000', 'ndv'='1501', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPKAAAAA', 'data_size'='48000') + """ + + sql """ + alter table web_page modify column wp_web_page_sk set stats ('row_count'='3000', 'ndv'='2984', 'num_nulls'='0', 'min_value'='1', 'max_value'='3000', 'data_size'='24000') + """ + + sql """ + alter table store_returns modify column sr_return_amt set stats ('row_count'='287999764', 'ndv'='671228', 'num_nulls'='10080055', 'min_value'='0.00', 'max_value'='19434.00', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_returned_date_sk set stats ('row_count'='287999764', 'ndv'='2010', 'num_nulls'='10079607', 'min_value'='2450820', 'max_value'='2452822', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_ext_tax set stats ('row_count'='2879987999', 'ndv'='149597', 'num_nulls'='129588732', 'min_value'='0.00', 'max_value'='1797.48', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_current_cdemo_sk set stats ('row_count'='12000000', 'ndv'='1913901', 'num_nulls'='419895', 'min_value'='1', 'max_value'='1920800', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_customer_id set stats ('row_count'='12000000', 'ndv'='11921032', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAABAA', 'max_value'='AAAAAAAAPPPPPKAA', 'data_size'='192000000') + """ + + sql """ + alter table date_dim modify column d_current_day set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_current_month set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_date set stats ('row_count'='73049', 'ndv'='73250', 'num_nulls'='0', 'min_value'='1900-01-02', 'max_value'='2100-01-01', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_moy set stats ('row_count'='73049', 'ndv'='12', 'num_nulls'='0', 'min_value'='1', 'max_value'='12', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_gmt_offset set stats ('row_count'='20', 'ndv'='3', 'num_nulls'='1', 'min_value'='-7.00', 'max_value'='-5.00', 'data_size'='80') + """ + + sql """ + alter table warehouse modify column w_warehouse_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table warehouse modify column w_warehouse_sq_ft set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='1', 'min_value'='73065', 'max_value'='977787', 'data_size'='80') + """ + + sql """ + alter table catalog_sales modify column cs_ext_sales_price set stats ('row_count'='1439980416', 'ndv'='1100662', 'num_nulls'='7199625', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ext_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='393180', 'num_nulls'='7199876', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_item_sk set stats ('row_count'='1439980416', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_tax set stats ('row_count'='1439980416', 'ndv'='2422238', 'num_nulls'='7200702', 'min_value'='0.00', 'max_value'='32376.27', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_date_sk set stats ('row_count'='1439980416', 'ndv'='1933', 'num_nulls'='7200707', 'min_value'='2450817', 'max_value'='2452744', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_warehouse_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7200688', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_division set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_division_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='164') + """ + + sql """ + alter table call_center modify column cc_manager set stats ('row_count'='42', 'ndv'='28', 'num_nulls'='0', 'min_value'='Alden Snyder', 'max_value'='Wayne Ray', 'data_size'='519') + """ + + sql """ + alter table call_center modify column cc_rec_start_date set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='1998-01-01', 'max_value'='2002-01-01', 'data_size'='168') + """ + + sql """ + alter table catalog_returns modify column cr_call_center_sk set stats ('row_count'='143996756', 'ndv'='42', 'num_nulls'='2881668', 'min_value'='1', 'max_value'='42', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_net_loss set stats ('row_count'='143996756', 'ndv'='911034', 'num_nulls'='2881704', 'min_value'='0.50', 'max_value'='16095.08', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_customer_sk set stats ('row_count'='143996756', 'ndv'='12156363', 'num_nulls'='2879017', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_refunded_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882107', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_returning_customer_sk set stats ('row_count'='143996756', 'ndv'='12157481', 'num_nulls'='2879023', 'min_value'='1', 'max_value'='12000000', 'data_size'='1151974048') + """ + + sql """ + alter table customer_address modify column ca_gmt_offset set stats ('row_count'='6000000', 'ndv'='6', 'num_nulls'='180219', 'min_value'='-10.00', 'max_value'='-5.00', 'data_size'='24000000') + """ + + sql """ + alter table item modify column i_color set stats ('row_count'='300000', 'ndv'='93', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow', 'data_size'='1610293') + """ + + sql """ + alter table item modify column i_manufact set stats ('row_count'='300000', 'ndv'='1004', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripri', 'data_size'='3379693') + """ + + sql """ + alter table item modify column i_product_name set stats ('row_count'='300000', 'ndv'='294994', 'num_nulls'='0', 'min_value'='', 'max_value'='pripripripripriought', 'data_size'='6849199') + """ + + sql """ + alter table web_returns modify column wr_returned_time_sk set stats ('row_count'='71997522', 'ndv'='87677', 'num_nulls'='3238574', 'min_value'='0', 'max_value'='86399', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_manager set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='William Young', 'data_size'='658') + """ + + sql """ + alter table web_site modify column web_mkt_class set stats ('row_count'='54', 'ndv'='40', 'num_nulls'='0', 'min_value'='', 'max_value'='Written, political plans show to the models. T', 'data_size'='1822') + """ + + sql """ + alter table web_site modify column web_rec_start_date set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='2', 'min_value'='1997-08-16', 'max_value'='2001-08-16', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_street_number set stats ('row_count'='54', 'ndv'='36', 'num_nulls'='0', 'min_value'='', 'max_value'='983', 'data_size'='154') + """ + + sql """ + alter table promotion modify column p_channel_catalog set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1482') + """ + + sql """ + alter table promotion modify column p_promo_id set stats ('row_count'='1500', 'ndv'='1519', 'num_nulls'='0', 'min_value'='AAAAAAAAAABAAAAA', 'max_value'='AAAAAAAAPPEAAAAA', 'data_size'='24000') + """ + + sql """ + alter table web_sales modify column ws_bill_customer_sk set stats ('row_count'='720000376', 'ndv'='12103729', 'num_nulls'='179817', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_list_price set stats ('row_count'='720000376', 'ndv'='29396', 'num_nulls'='180053', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_sales_price set stats ('row_count'='720000376', 'ndv'='29288', 'num_nulls'='180005', 'min_value'='0.00', 'max_value'='300.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_hdemo_sk set stats ('row_count'='720000376', 'ndv'='7251', 'num_nulls'='179824', 'min_value'='1', 'max_value'='7200', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_closed_date_sk set stats ('row_count'='1002', 'ndv'='163', 'num_nulls'='729', 'min_value'='2450820', 'max_value'='2451313', 'data_size'='8016') + """ + + sql """ + alter table store modify column s_division_id set stats ('row_count'='1002', 'ndv'='1', 'num_nulls'='6', 'min_value'='1', 'max_value'='1', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_market_desc set stats ('row_count'='1002', 'ndv'='765', 'num_nulls'='0', 'min_value'='', 'max_value'='Yesterday left factors handle continuing co', 'data_size'='57638') + """ + + sql """ + alter table store modify column s_market_id set stats ('row_count'='1002', 'ndv'='10', 'num_nulls'='8', 'min_value'='1', 'max_value'='10', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_state set stats ('row_count'='1002', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='WV', 'data_size'='1994') + """ + + sql """ + alter table store modify column s_store_sk set stats ('row_count'='1002', 'ndv'='988', 'num_nulls'='0', 'min_value'='1', 'max_value'='1002', 'data_size'='8016') + """ + + sql """ + alter table store modify column s_street_name set stats ('row_count'='1002', 'ndv'='549', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Oak', 'data_size'='8580') + """ + + sql """ + alter table web_page modify column wp_access_date_sk set stats ('row_count'='3000', 'ndv'='101', 'num_nulls'='31', 'min_value'='2452548', 'max_value'='2452648', 'data_size'='24000') + """ + + sql """ + alter table web_page modify column wp_char_count set stats ('row_count'='3000', 'ndv'='1883', 'num_nulls'='42', 'min_value'='303', 'max_value'='8523', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_addr_sk set stats ('row_count'='287999764', 'ndv'='6015811', 'num_nulls'='10082311', 'min_value'='1', 'max_value'='6000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_return_time_sk set stats ('row_count'='287999764', 'ndv'='32660', 'num_nulls'='10082805', 'min_value'='28799', 'max_value'='61199', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_store_sk set stats ('row_count'='287999764', 'ndv'='499', 'num_nulls'='10081871', 'min_value'='1', 'max_value'='1000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_coupon_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_sales_price set stats ('row_count'='2879987999', 'ndv'='19780', 'num_nulls'='129598061', 'min_value'='0.00', 'max_value'='200.00', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_birth_country set stats ('row_count'='12000000', 'ndv'='211', 'num_nulls'='0', 'min_value'='', 'max_value'='ZIMBABWE', 'data_size'='100750845') + """ + + sql """ + alter table customer modify column c_birth_month set stats ('row_count'='12000000', 'ndv'='12', 'num_nulls'='419629', 'min_value'='1', 'max_value'='12', 'data_size'='48000000') + """ + + sql """ + alter table customer modify column c_customer_sk set stats ('row_count'='12000000', 'ndv'='12157481', 'num_nulls'='0', 'min_value'='1', 'max_value'='12000000', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_email_address set stats ('row_count'='12000000', 'ndv'='11642077', 'num_nulls'='0', 'min_value'='', 'max_value'='Zulma.Young@aDhzZzCzYN.edu', 'data_size'='318077849') + """ + + sql """ + alter table customer modify column c_last_review_date_sk set stats ('row_count'='12000000', 'ndv'='366', 'num_nulls'='419900', 'min_value'='2452283', 'max_value'='2452648', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_preferred_cust_flag set stats ('row_count'='12000000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='11580510') + """ + + sql """ + alter table dbgen_version modify column dv_version set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='3.2.0', 'max_value'='3.2.0', 'data_size'='5') + """ + + sql """ + alter table customer_demographics modify column cd_purchase_estimate set stats ('row_count'='1920800', 'ndv'='20', 'num_nulls'='0', 'min_value'='500', 'max_value'='10000', 'data_size'='7683200') + """ + + sql """ + alter table reason modify column r_reason_id set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPDAAAAAA', 'data_size'='1040') + """ + + sql """ + alter table reason modify column r_reason_sk set stats ('row_count'='65', 'ndv'='65', 'num_nulls'='0', 'min_value'='1', 'max_value'='65', 'data_size'='520') + """ + + sql """ + alter table date_dim modify column d_current_week set stats ('row_count'='73049', 'ndv'='1', 'num_nulls'='0', 'min_value'='N', 'max_value'='N', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_first_dom set stats ('row_count'='73049', 'ndv'='2410', 'num_nulls'='0', 'min_value'='2415021', 'max_value'='2488070', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_fy_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_last_dom set stats ('row_count'='73049', 'ndv'='2419', 'num_nulls'='0', 'min_value'='2415020', 'max_value'='2488372', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_month_seq set stats ('row_count'='73049', 'ndv'='2398', 'num_nulls'='0', 'min_value'='0', 'max_value'='2400', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_quarter_name set stats ('row_count'='73049', 'ndv'='799', 'num_nulls'='0', 'min_value'='1900Q1', 'max_value'='2100Q1', 'data_size'='438294') + """ + + sql """ + alter table warehouse modify column w_county set stats ('row_count'='20', 'ndv'='14', 'num_nulls'='0', 'min_value'='Bronx County', 'max_value'='Ziebach County', 'data_size'='291') + """ + + sql """ + alter table warehouse modify column w_street_number set stats ('row_count'='20', 'ndv'='19', 'num_nulls'='0', 'min_value'='', 'max_value'='957', 'data_size'='54') + """ + + sql """ + alter table warehouse modify column w_warehouse_name set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='', 'max_value'='Therefore urg', 'data_size'='307') + """ + + sql """ + alter table catalog_sales modify column cs_ext_discount_amt set stats ('row_count'='1439980416', 'ndv'='1100115', 'num_nulls'='7201054', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid_inc_ship_tax set stats ('row_count'='1439980416', 'ndv'='3312360', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46593.36', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_promo_sk set stats ('row_count'='1439980416', 'ndv'='1489', 'num_nulls'='7202844', 'min_value'='1', 'max_value'='1500', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_call_center_id set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPBAAAAAA', 'data_size'='672') + """ + + sql """ + alter table call_center modify column cc_employees set stats ('row_count'='42', 'ndv'='30', 'num_nulls'='0', 'min_value'='69020', 'max_value'='6879074', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_suite_number set stats ('row_count'='42', 'ndv'='18', 'num_nulls'='0', 'min_value'='Suite 0', 'max_value'='Suite W', 'data_size'='326') + """ + + sql """ + alter table catalog_returns modify column cr_item_sk set stats ('row_count'='143996756', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_reason_sk set stats ('row_count'='143996756', 'ndv'='65', 'num_nulls'='2881950', 'min_value'='1', 'max_value'='65', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_ship_cost set stats ('row_count'='143996756', 'ndv'='483467', 'num_nulls'='2883436', 'min_value'='0.00', 'max_value'='14273.28', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_ship_mode_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2879879', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_store_credit set stats ('row_count'='143996756', 'ndv'='802237', 'num_nulls'='2880469', 'min_value'='0.00', 'max_value'='23215.15', 'data_size'='575987024') + """ + + sql """ + alter table customer_address modify column ca_city set stats ('row_count'='6000000', 'ndv'='977', 'num_nulls'='0', 'min_value'='', 'max_value'='Zion', 'data_size'='52096290') + """ + + sql """ + alter table customer_address modify column ca_state set stats ('row_count'='6000000', 'ndv'='52', 'num_nulls'='0', 'min_value'='', 'max_value'='WY', 'data_size'='11640128') + """ + + sql """ + alter table customer_address modify column ca_street_name set stats ('row_count'='6000000', 'ndv'='8173', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodland Woodland', 'data_size'='50697257') + """ + + sql """ + alter table customer_address modify column ca_street_type set stats ('row_count'='6000000', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='24441630') + """ + + sql """ + alter table catalog_page modify column cp_catalog_number set stats ('row_count'='30000', 'ndv'='109', 'num_nulls'='297', 'min_value'='1', 'max_value'='109', 'data_size'='120000') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_number set stats ('row_count'='30000', 'ndv'='279', 'num_nulls'='294', 'min_value'='1', 'max_value'='277', 'data_size'='120000') + """ + + sql """ + alter table catalog_page modify column cp_catalog_page_sk set stats ('row_count'='30000', 'ndv'='30439', 'num_nulls'='0', 'min_value'='1', 'max_value'='30000', 'data_size'='240000') + """ + + sql """ + alter table catalog_page modify column cp_start_date_sk set stats ('row_count'='30000', 'ndv'='91', 'num_nulls'='286', 'min_value'='2450815', 'max_value'='2453005', 'data_size'='120000') + """ + + sql """ + alter table item modify column i_rec_start_date set stats ('row_count'='300000', 'ndv'='4', 'num_nulls'='784', 'min_value'='1997-10-27', 'max_value'='2001-10-27', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_units set stats ('row_count'='300000', 'ndv'='22', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='1253652') + """ + + sql """ + alter table web_returns modify column wr_refunded_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238545', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_return_ship_cost set stats ('row_count'='71997522', 'ndv'='451263', 'num_nulls'='3239048', 'min_value'='0.00', 'max_value'='14352.10', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returned_date_sk set stats ('row_count'='71997522', 'ndv'='2188', 'num_nulls'='3239259', 'min_value'='2450819', 'max_value'='2453002', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_returning_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3239192', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_suite_number set stats ('row_count'='54', 'ndv'='38', 'num_nulls'='0', 'min_value'='Suite 100', 'max_value'='Suite Y', 'data_size'='430') + """ + + sql """ + alter table promotion modify column p_start_date_sk set stats ('row_count'='1500', 'ndv'='685', 'num_nulls'='23', 'min_value'='2450096', 'max_value'='2450915', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_coupon_amt set stats ('row_count'='720000376', 'ndv'='1505315', 'num_nulls'='179933', 'min_value'='0.00', 'max_value'='28824.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ext_wholesale_cost set stats ('row_count'='720000376', 'ndv'='393180', 'num_nulls'='180060', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_ship set stats ('row_count'='720000376', 'ndv'='2414838', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='44263.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_date_sk set stats ('row_count'='720000376', 'ndv'='1952', 'num_nulls'='180011', 'min_value'='2450817', 'max_value'='2452762', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_web_page_sk set stats ('row_count'='720000376', 'ndv'='2984', 'num_nulls'='179732', 'min_value'='1', 'max_value'='3000', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_country set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='12961') + """ + + sql """ + alter table store modify column s_store_name set stats ('row_count'='1002', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='3916') + """ + + sql """ + alter table time_dim modify column t_second set stats ('row_count'='86400', 'ndv'='60', 'num_nulls'='0', 'min_value'='0', 'max_value'='59', 'data_size'='345600') + """ + + sql """ + alter table time_dim modify column t_sub_shift set stats ('row_count'='86400', 'ndv'='4', 'num_nulls'='0', 'min_value'='afternoon', 'max_value'='night', 'data_size'='597600') + """ + + sql """ + alter table web_page modify column wp_image_count set stats ('row_count'='3000', 'ndv'='7', 'num_nulls'='26', 'min_value'='1', 'max_value'='7', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_type set stats ('row_count'='3000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='welcome', 'data_size'='18867') + """ + + sql """ + alter table store_returns modify column sr_customer_sk set stats ('row_count'='287999764', 'ndv'='12157481', 'num_nulls'='10081624', 'min_value'='1', 'max_value'='12000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_hdemo_sk set stats ('row_count'='287999764', 'ndv'='7251', 'num_nulls'='10083275', 'min_value'='1', 'max_value'='7200', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_addr_sk set stats ('row_count'='2879987999', 'ndv'='6015811', 'num_nulls'='129589799', 'min_value'='1', 'max_value'='6000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_item_sk set stats ('row_count'='2879987999', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_quantity set stats ('row_count'='2879987999', 'ndv'='100', 'num_nulls'='129584258', 'min_value'='1', 'max_value'='100', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ticket_number set stats ('row_count'='2879987999', 'ndv'='238830448', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='9905', 'num_nulls'='129590273', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='11519951996') + """ + + sql """ + alter table ship_mode modify column sm_type set stats ('row_count'='20', 'ndv'='6', 'num_nulls'='0', 'min_value'='EXPRESS', 'max_value'='TWO DAY', 'data_size'='150') + """ + + sql """ + alter table customer modify column c_current_addr_sk set stats ('row_count'='12000000', 'ndv'='5243359', 'num_nulls'='0', 'min_value'='3', 'max_value'='6000000', 'data_size'='96000000') + """ + + sql """ + alter table customer modify column c_last_name set stats ('row_count'='12000000', 'ndv'='4990', 'num_nulls'='0', 'min_value'='', 'max_value'='Zuniga', 'data_size'='70991730') + """ + + sql """ + alter table dbgen_version modify column dv_cmdline_args set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'max_value'='-SCALE 1000 -PARALLEL 64 -CHILD 1 -TERMINATE N -DIR /mnt/datadisk0/tpcds1t/tpcds-data', 'data_size'='86') + """ + + sql """ + alter table date_dim modify column d_current_quarter set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_date_sk set stats ('row_count'='73049', 'ndv'='73042', 'num_nulls'='0', 'min_value'='2415022', 'max_value'='2488070', 'data_size'='584392') + """ + + sql """ + alter table date_dim modify column d_holiday set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table warehouse modify column w_country set stats ('row_count'='20', 'ndv'='1', 'num_nulls'='0', 'min_value'='United States', 'max_value'='United States', 'data_size'='260') + """ + + sql """ + alter table warehouse modify column w_state set stats ('row_count'='20', 'ndv'='13', 'num_nulls'='0', 'min_value'='AL', 'max_value'='TN', 'data_size'='40') + """ + + sql """ + alter table catalog_sales modify column cs_bill_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7199539', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_bill_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201919', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_net_paid set stats ('row_count'='1439980416', 'ndv'='1809875', 'num_nulls'='7197668', 'min_value'='0.00', 'max_value'='29943.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_addr_sk set stats ('row_count'='1439980416', 'ndv'='6015811', 'num_nulls'='7198232', 'min_value'='1', 'max_value'='6000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_mode_sk set stats ('row_count'='1439980416', 'ndv'='20', 'num_nulls'='7201083', 'min_value'='1', 'max_value'='20', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_sold_date_sk set stats ('row_count'='1439980416', 'ndv'='1835', 'num_nulls'='7203326', 'min_value'='2450815', 'max_value'='2452654', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_sold_time_sk set stats ('row_count'='1439980416', 'ndv'='87677', 'num_nulls'='7201329', 'min_value'='0', 'max_value'='86399', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_wholesale_cost set stats ('row_count'='1439980416', 'ndv'='9905', 'num_nulls'='7201098', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='5759921664') + """ + + sql """ + alter table call_center modify column cc_company_name set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='able', 'max_value'='pri', 'data_size'='160') + """ + + sql """ + alter table call_center modify column cc_market_manager set stats ('row_count'='42', 'ndv'='35', 'num_nulls'='0', 'min_value'='Cesar Allen', 'max_value'='William Larsen', 'data_size'='524') + """ + + sql """ + alter table call_center modify column cc_mkt_id set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_street_type set stats ('row_count'='42', 'ndv'='11', 'num_nulls'='0', 'min_value'='Avenue', 'max_value'='Way', 'data_size'='184') + """ + + sql """ + alter table catalog_returns modify column cr_return_tax set stats ('row_count'='143996756', 'ndv'='149828', 'num_nulls'='2881611', 'min_value'='0.00', 'max_value'='2511.58', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returning_cdemo_sk set stats ('row_count'='143996756', 'ndv'='1916366', 'num_nulls'='2880543', 'min_value'='1', 'max_value'='1920800', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_returning_hdemo_sk set stats ('row_count'='143996756', 'ndv'='7251', 'num_nulls'='2882692', 'min_value'='1', 'max_value'='7200', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_reversed_charge set stats ('row_count'='143996756', 'ndv'='802509', 'num_nulls'='2881215', 'min_value'='0.00', 'max_value'='24033.84', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_warehouse_sk set stats ('row_count'='143996756', 'ndv'='20', 'num_nulls'='2882192', 'min_value'='1', 'max_value'='20', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_demo_sk set stats ('row_count'='7200', 'ndv'='7251', 'num_nulls'='0', 'min_value'='1', 'max_value'='7200', 'data_size'='57600') + """ + + sql """ + alter table household_demographics modify column hd_vehicle_count set stats ('row_count'='7200', 'ndv'='6', 'num_nulls'='0', 'min_value'='-1', 'max_value'='4', 'data_size'='28800') + """ + + sql """ + alter table customer_address modify column ca_zip set stats ('row_count'='6000000', 'ndv'='9253', 'num_nulls'='0', 'min_value'='', 'max_value'='99981', 'data_size'='29097610') + """ + + sql """ + alter table income_band modify column ib_income_band_sk set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='1', 'max_value'='20', 'data_size'='160') + """ + + sql """ + alter table catalog_page modify column cp_type set stats ('row_count'='30000', 'ndv'='4', 'num_nulls'='0', 'min_value'='', 'max_value'='quarterly', 'data_size'='227890') + """ + + sql """ + alter table item modify column i_brand set stats ('row_count'='300000', 'ndv'='714', 'num_nulls'='0', 'min_value'='', 'max_value'='univunivamalg #9', 'data_size'='4834917') + """ + + sql """ + alter table item modify column i_formulation set stats ('row_count'='300000', 'ndv'='224757', 'num_nulls'='0', 'min_value'='', 'max_value'='yellow98911509228741', 'data_size'='5984460') + """ + + sql """ + alter table item modify column i_item_desc set stats ('row_count'='300000', 'ndv'='217721', 'num_nulls'='0', 'min_value'='', 'max_value'='Youngsters used to save quite colour', 'data_size'='30093342') + """ + + sql """ + alter table web_returns modify column wr_fee set stats ('row_count'='71997522', 'ndv'='9958', 'num_nulls'='3238926', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_item_sk set stats ('row_count'='71997522', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_reason_sk set stats ('row_count'='71997522', 'ndv'='65', 'num_nulls'='3238897', 'min_value'='1', 'max_value'='65', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_refunded_customer_sk set stats ('row_count'='71997522', 'ndv'='12117831', 'num_nulls'='3242433', 'min_value'='1', 'max_value'='12000000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_city set stats ('row_count'='54', 'ndv'='31', 'num_nulls'='0', 'min_value'='', 'max_value'='Woodlawn', 'data_size'='491') + """ + + sql """ + alter table web_site modify column web_close_date_sk set stats ('row_count'='54', 'ndv'='18', 'num_nulls'='10', 'min_value'='2441265', 'max_value'='2446218', 'data_size'='432') + """ + + sql """ + alter table web_site modify column web_company_id set stats ('row_count'='54', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_company_name set stats ('row_count'='54', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='203') + """ + + sql """ + alter table web_site modify column web_county set stats ('row_count'='54', 'ndv'='25', 'num_nulls'='0', 'min_value'='', 'max_value'='Williamson County', 'data_size'='762') + """ + + sql """ + alter table web_site modify column web_name set stats ('row_count'='54', 'ndv'='10', 'num_nulls'='0', 'min_value'='', 'max_value'='site_8', 'data_size'='312') + """ + + sql """ + alter table web_site modify column web_open_date_sk set stats ('row_count'='54', 'ndv'='27', 'num_nulls'='1', 'min_value'='2450373', 'max_value'='2450807', 'data_size'='432') + """ + + sql """ + alter table promotion modify column p_channel_dmail set stats ('row_count'='1500', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='1483') + """ + + sql """ + alter table promotion modify column p_channel_press set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') + """ + + sql """ + alter table promotion modify column p_channel_radio set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1479') + """ + + sql """ + alter table promotion modify column p_cost set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='18', 'min_value'='1000.00', 'max_value'='1000.00', 'data_size'='12000') + """ + + sql """ + alter table web_sales modify column ws_ext_tax set stats ('row_count'='720000376', 'ndv'='211413', 'num_nulls'='179695', 'min_value'='0.00', 'max_value'='2682.90', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_item_sk set stats ('row_count'='720000376', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_net_paid set stats ('row_count'='720000376', 'ndv'='1749360', 'num_nulls'='179970', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_ship_tax set stats ('row_count'='720000376', 'ndv'='3224829', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='46004.19', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_paid_inc_tax set stats ('row_count'='720000376', 'ndv'='2354996', 'num_nulls'='179972', 'min_value'='0.00', 'max_value'='32492.90', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_order_number set stats ('row_count'='720000376', 'ndv'='60401176', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_quantity set stats ('row_count'='720000376', 'ndv'='100', 'num_nulls'='179781', 'min_value'='1', 'max_value'='100', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ship_cdemo_sk set stats ('row_count'='720000376', 'ndv'='1916366', 'num_nulls'='180290', 'min_value'='1', 'max_value'='1920800', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_sold_time_sk set stats ('row_count'='720000376', 'ndv'='87677', 'num_nulls'='179980', 'min_value'='0', 'max_value'='86399', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_street_type set stats ('row_count'='1002', 'ndv'='21', 'num_nulls'='0', 'min_value'='', 'max_value'='Wy', 'data_size'='4189') + """ + + sql """ + alter table web_page modify column wp_autogen_flag set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='0', 'min_value'='', 'max_value'='Y', 'data_size'='2962') + """ + + sql """ + alter table web_page modify column wp_rec_start_date set stats ('row_count'='3000', 'ndv'='4', 'num_nulls'='29', 'min_value'='1997-09-03', 'max_value'='2001-09-03', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_net_loss set stats ('row_count'='287999764', 'ndv'='714210', 'num_nulls'='10080716', 'min_value'='0.50', 'max_value'='10776.08', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_amt_inc_tax set stats ('row_count'='287999764', 'ndv'='1259368', 'num_nulls'='10076879', 'min_value'='0.00', 'max_value'='20454.63', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_quantity set stats ('row_count'='287999764', 'ndv'='100', 'num_nulls'='10082815', 'min_value'='1', 'max_value'='100', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_return_ship_cost set stats ('row_count'='287999764', 'ndv'='355844', 'num_nulls'='10081927', 'min_value'='0.00', 'max_value'='9767.34', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_reversed_charge set stats ('row_count'='287999764', 'ndv'='700618', 'num_nulls'='10085976', 'min_value'='0.00', 'max_value'='17339.42', 'data_size'='1151999056') + """ + + sql """ + alter table store_sales modify column ss_net_paid_inc_tax set stats ('row_count'='2879987999', 'ndv'='1681767', 'num_nulls'='129609050', 'min_value'='0.00', 'max_value'='21769.48', 'data_size'='11519951996') + """ + + sql """ + alter table customer modify column c_birth_day set stats ('row_count'='12000000', 'ndv'='31', 'num_nulls'='420361', 'min_value'='1', 'max_value'='31', 'data_size'='48000000') + """ + + sql """ + alter table customer_demographics modify column cd_credit_rating set stats ('row_count'='1920800', 'ndv'='4', 'num_nulls'='0', 'min_value'='Good', 'max_value'='Unknown', 'data_size'='13445600') + """ + + sql """ + alter table customer_demographics modify column cd_demo_sk set stats ('row_count'='1920800', 'ndv'='1916366', 'num_nulls'='0', 'min_value'='1', 'max_value'='1920800', 'data_size'='15366400') + """ + + sql """ + alter table customer_demographics modify column cd_dep_count set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='0', 'max_value'='6', 'data_size'='7683200') + """ + + sql """ + alter table customer_demographics modify column cd_education_status set stats ('row_count'='1920800', 'ndv'='7', 'num_nulls'='0', 'min_value'='2 yr Degree', 'max_value'='Unknown', 'data_size'='18384800') + """ + + sql """ + alter table customer_demographics modify column cd_gender set stats ('row_count'='1920800', 'ndv'='2', 'num_nulls'='0', 'min_value'='F', 'max_value'='M', 'data_size'='1920800') + """ + + sql """ + alter table customer_demographics modify column cd_marital_status set stats ('row_count'='1920800', 'ndv'='5', 'num_nulls'='0', 'min_value'='D', 'max_value'='W', 'data_size'='1920800') + """ + + sql """ + alter table date_dim modify column d_date_id set stats ('row_count'='73049', 'ndv'='72907', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAAFCAA', 'max_value'='AAAAAAAAPPPPECAA', 'data_size'='1168784') + """ + + sql """ + alter table date_dim modify column d_fy_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_year set stats ('row_count'='73049', 'ndv'='202', 'num_nulls'='0', 'min_value'='1900', 'max_value'='2100', 'data_size'='292196') + """ + + sql """ + alter table warehouse modify column w_warehouse_id set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPAAAAAAA', 'data_size'='320') + """ + + sql """ + alter table catalog_sales modify column cs_ext_list_price set stats ('row_count'='1439980416', 'ndv'='1160303', 'num_nulls'='7199542', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ext_tax set stats ('row_count'='1439980416', 'ndv'='215267', 'num_nulls'='7200412', 'min_value'='0.00', 'max_value'='2673.27', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_quantity set stats ('row_count'='1439980416', 'ndv'='100', 'num_nulls'='7202885', 'min_value'='1', 'max_value'='100', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_ship_cdemo_sk set stats ('row_count'='1439980416', 'ndv'='1916366', 'num_nulls'='7200151', 'min_value'='1', 'max_value'='1920800', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_customer_sk set stats ('row_count'='1439980416', 'ndv'='12157481', 'num_nulls'='7201507', 'min_value'='1', 'max_value'='12000000', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_company set stats ('row_count'='42', 'ndv'='6', 'num_nulls'='0', 'min_value'='1', 'max_value'='6', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_mkt_desc set stats ('row_count'='42', 'ndv'='33', 'num_nulls'='0', 'min_value'='Arms increase controversial, present so', 'max_value'='Young tests could buy comfortable, local users; o', 'data_size'='2419') + """ + + sql """ + alter table call_center modify column cc_open_date_sk set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='2450794', 'max_value'='2451146', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_rec_end_date set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='21', 'min_value'='2000-01-01', 'max_value'='2001-12-31', 'data_size'='168') + """ + + sql """ + alter table catalog_returns modify column cr_order_number set stats ('row_count'='143996756', 'ndv'='93476424', 'num_nulls'='0', 'min_value'='2', 'max_value'='160000000', 'data_size'='1151974048') + """ + + sql """ + alter table catalog_returns modify column cr_return_amount set stats ('row_count'='143996756', 'ndv'='882831', 'num_nulls'='2880424', 'min_value'='0.00', 'max_value'='28805.04', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returned_date_sk set stats ('row_count'='143996756', 'ndv'='2108', 'num_nulls'='0', 'min_value'='2450821', 'max_value'='2452924', 'data_size'='1151974048') + """ + + sql """ + alter table income_band modify column ib_upper_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='10000', 'max_value'='200000', 'data_size'='80') + """ + + sql """ + alter table catalog_page modify column cp_department set stats ('row_count'='30000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='DEPARTMENT', 'data_size'='297110') + """ + + sql """ + alter table catalog_page modify column cp_end_date_sk set stats ('row_count'='30000', 'ndv'='97', 'num_nulls'='302', 'min_value'='2450844', 'max_value'='2453186', 'data_size'='120000') + """ + + sql """ + alter table item modify column i_brand_id set stats ('row_count'='300000', 'ndv'='951', 'num_nulls'='763', 'min_value'='1001001', 'max_value'='10016017', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_category set stats ('row_count'='300000', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='Women', 'data_size'='1766742') + """ + + sql """ + alter table item modify column i_class_id set stats ('row_count'='300000', 'ndv'='16', 'num_nulls'='722', 'min_value'='1', 'max_value'='16', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_item_sk set stats ('row_count'='300000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2400000') + """ + + sql """ + alter table item modify column i_manufact_id set stats ('row_count'='300000', 'ndv'='1005', 'num_nulls'='761', 'min_value'='1', 'max_value'='1000', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_wholesale_cost set stats ('row_count'='300000', 'ndv'='7243', 'num_nulls'='740', 'min_value'='0.02', 'max_value'='89.49', 'data_size'='1200000') + """ + + sql """ + alter table web_returns modify column wr_refunded_cdemo_sk set stats ('row_count'='71997522', 'ndv'='1916366', 'num_nulls'='3240352', 'min_value'='1', 'max_value'='1920800', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_return_tax set stats ('row_count'='71997522', 'ndv'='137392', 'num_nulls'='3237729', 'min_value'='0.00', 'max_value'='2551.16', 'data_size'='287990088') + """ + + sql """ + alter table web_returns modify column wr_returning_hdemo_sk set stats ('row_count'='71997522', 'ndv'='7251', 'num_nulls'='3238239', 'min_value'='1', 'max_value'='7200', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_web_page_sk set stats ('row_count'='71997522', 'ndv'='2984', 'num_nulls'='3240387', 'min_value'='1', 'max_value'='3000', 'data_size'='575980176') + """ + + sql """ + alter table web_site modify column web_class set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='371') + """ + + sql """ + alter table web_site modify column web_zip set stats ('row_count'='54', 'ndv'='32', 'num_nulls'='0', 'min_value'='14593', 'max_value'='99431', 'data_size'='270') + """ + + sql """ + alter table promotion modify column p_channel_email set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1480') + """ + + sql """ + alter table promotion modify column p_item_sk set stats ('row_count'='1500', 'ndv'='1467', 'num_nulls'='19', 'min_value'='184', 'max_value'='299990', 'data_size'='12000') + """ + + sql """ + alter table promotion modify column p_promo_name set stats ('row_count'='1500', 'ndv'='11', 'num_nulls'='0', 'min_value'='', 'max_value'='pri', 'data_size'='5896') + """ + + sql """ + alter table web_sales modify column ws_ext_discount_amt set stats ('row_count'='720000376', 'ndv'='1093513', 'num_nulls'='179851', 'min_value'='0.00', 'max_value'='29982.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_ext_list_price set stats ('row_count'='720000376', 'ndv'='1160303', 'num_nulls'='179866', 'min_value'='1.00', 'max_value'='30000.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_wholesale_cost set stats ('row_count'='720000376', 'ndv'='9905', 'num_nulls'='179834', 'min_value'='1.00', 'max_value'='100.00', 'data_size'='2880001504') + """ + + sql """ + alter table store modify column s_market_manager set stats ('row_count'='1002', 'ndv'='732', 'num_nulls'='0', 'min_value'='', 'max_value'='Zane Perez', 'data_size'='12823') + """ + + sql """ + alter table store modify column s_number_employees set stats ('row_count'='1002', 'ndv'='101', 'num_nulls'='8', 'min_value'='200', 'max_value'='300', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_rec_end_date set stats ('row_count'='1002', 'ndv'='3', 'num_nulls'='501', 'min_value'='1999-03-13', 'max_value'='2001-03-12', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_rec_start_date set stats ('row_count'='1002', 'ndv'='4', 'num_nulls'='7', 'min_value'='1997-03-13', 'max_value'='2001-03-13', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_suite_number set stats ('row_count'='1002', 'ndv'='76', 'num_nulls'='0', 'min_value'='', 'max_value'='Suite Y', 'data_size'='7866') + """ + + sql """ + alter table time_dim modify column t_hour set stats ('row_count'='86400', 'ndv'='24', 'num_nulls'='0', 'min_value'='0', 'max_value'='23', 'data_size'='345600') + """ + + sql """ + alter table time_dim modify column t_shift set stats ('row_count'='86400', 'ndv'='3', 'num_nulls'='0', 'min_value'='first', 'max_value'='third', 'data_size'='460800') + """ + + sql """ + alter table web_page modify column wp_link_count set stats ('row_count'='3000', 'ndv'='24', 'num_nulls'='27', 'min_value'='2', 'max_value'='25', 'data_size'='12000') + """ + + sql """ + alter table web_page modify column wp_rec_end_date set stats ('row_count'='3000', 'ndv'='3', 'num_nulls'='1500', 'min_value'='1999-09-03', 'max_value'='2001-09-02', 'data_size'='12000') + """ + + sql """ + alter table store_returns modify column sr_cdemo_sk set stats ('row_count'='287999764', 'ndv'='1916366', 'num_nulls'='10076902', 'min_value'='1', 'max_value'='1920800', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_item_sk set stats ('row_count'='287999764', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_cdemo_sk set stats ('row_count'='2879987999', 'ndv'='1916366', 'num_nulls'='129602155', 'min_value'='1', 'max_value'='1920800', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_ext_discount_amt set stats ('row_count'='2879987999', 'ndv'='1161208', 'num_nulls'='129609101', 'min_value'='0.00', 'max_value'='19778.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ext_wholesale_cost set stats ('row_count'='2879987999', 'ndv'='393180', 'num_nulls'='129595018', 'min_value'='1.00', 'max_value'='10000.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_list_price set stats ('row_count'='2879987999', 'ndv'='19640', 'num_nulls'='129597020', 'min_value'='1.00', 'max_value'='200.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_net_paid set stats ('row_count'='2879987999', 'ndv'='1288646', 'num_nulls'='129599407', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_sold_date_sk set stats ('row_count'='2879987999', 'ndv'='1820', 'num_nulls'='129600843', 'min_value'='2450816', 'max_value'='2452642', 'data_size'='23039903992') + """ + + sql """ + alter table store_sales modify column ss_sold_time_sk set stats ('row_count'='2879987999', 'ndv'='47252', 'num_nulls'='129593012', 'min_value'='28800', 'max_value'='75599', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_carrier set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='AIRBORNE', 'max_value'='ZOUROS', 'data_size'='133') + """ + + sql """ + alter table customer modify column c_birth_year set stats ('row_count'='12000000', 'ndv'='69', 'num_nulls'='419584', 'min_value'='1924', 'max_value'='1992', 'data_size'='48000000') + """ + + sql """ + alter table customer modify column c_login set stats ('row_count'='12000000', 'ndv'='1', 'num_nulls'='0', 'min_value'='', 'max_value'='', 'data_size'='0') + """ + + sql """ + alter table customer modify column c_salutation set stats ('row_count'='12000000', 'ndv'='7', 'num_nulls'='0', 'min_value'='', 'max_value'='Sir', 'data_size'='37544445') + """ + + sql """ + alter table reason modify column r_reason_desc set stats ('row_count'='65', 'ndv'='64', 'num_nulls'='0', 'min_value'='Did not fit', 'max_value'='unauthoized purchase', 'data_size'='848') + """ + + sql """ + alter table date_dim modify column d_current_year set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table date_dim modify column d_dom set stats ('row_count'='73049', 'ndv'='31', 'num_nulls'='0', 'min_value'='1', 'max_value'='31', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_same_day_lq set stats ('row_count'='73049', 'ndv'='72231', 'num_nulls'='0', 'min_value'='2414930', 'max_value'='2487978', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'num_nulls'='0', 'min_value'='1', 'max_value'='10436', 'data_size'='292196') + """ + + sql """ + alter table date_dim modify column d_weekend set stats ('row_count'='73049', 'ndv'='2', 'num_nulls'='0', 'min_value'='N', 'max_value'='Y', 'data_size'='73049') + """ + + sql """ + alter table warehouse modify column w_zip set stats ('row_count'='20', 'ndv'='18', 'num_nulls'='0', 'min_value'='19231', 'max_value'='89275', 'data_size'='100') + """ + + sql """ + alter table catalog_sales modify column cs_catalog_page_sk set stats ('row_count'='1439980416', 'ndv'='17005', 'num_nulls'='7199032', 'min_value'='1', 'max_value'='25207', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_coupon_amt set stats ('row_count'='1439980416', 'ndv'='1578778', 'num_nulls'='7198116', 'min_value'='0.00', 'max_value'='28730.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_list_price set stats ('row_count'='1439980416', 'ndv'='29396', 'num_nulls'='7201549', 'min_value'='1.00', 'max_value'='300.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_net_profit set stats ('row_count'='1439980416', 'ndv'='2058398', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19962.00', 'data_size'='5759921664') + """ + + sql """ + alter table catalog_sales modify column cs_order_number set stats ('row_count'='1439980416', 'ndv'='159051824', 'num_nulls'='0', 'min_value'='1', 'max_value'='160000000', 'data_size'='11519843328') + """ + + sql """ + alter table catalog_sales modify column cs_ship_hdemo_sk set stats ('row_count'='1439980416', 'ndv'='7251', 'num_nulls'='7201542', 'min_value'='1', 'max_value'='7200', 'data_size'='11519843328') + """ + + sql """ + alter table call_center modify column cc_call_center_sk set stats ('row_count'='42', 'ndv'='42', 'num_nulls'='0', 'min_value'='1', 'max_value'='42', 'data_size'='336') + """ + + sql """ + alter table call_center modify column cc_city set stats ('row_count'='42', 'ndv'='17', 'num_nulls'='0', 'min_value'='Antioch', 'max_value'='Spring Hill', 'data_size'='386') + """ + + sql """ + alter table call_center modify column cc_closed_date_sk set stats ('row_count'='42', 'ndv'='0', 'num_nulls'='42', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_gmt_offset set stats ('row_count'='42', 'ndv'='4', 'num_nulls'='0', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='168') + """ + + sql """ + alter table call_center modify column cc_hours set stats ('row_count'='42', 'ndv'='3', 'num_nulls'='0', 'min_value'='8AM-12AM', 'max_value'='8AM-8AM', 'data_size'='300') + """ + + sql """ + alter table call_center modify column cc_street_number set stats ('row_count'='42', 'ndv'='21', 'num_nulls'='0', 'min_value'='38', 'max_value'='999', 'data_size'='120') + """ + + sql """ + alter table call_center modify column cc_tax_percentage set stats ('row_count'='42', 'ndv'='12', 'num_nulls'='0', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='168') + """ + + sql """ + alter table inventory modify column inv_date_sk set stats ('row_count'='783000000', 'ndv'='261', 'num_nulls'='0', 'min_value'='2450815', 'max_value'='2452635', 'data_size'='6264000000') + """ + + sql """ + alter table inventory modify column inv_item_sk set stats ('row_count'='783000000', 'ndv'='295433', 'num_nulls'='0', 'min_value'='1', 'max_value'='300000', 'data_size'='6264000000') + """ + + sql """ + alter table catalog_returns modify column cr_fee set stats ('row_count'='143996756', 'ndv'='9958', 'num_nulls'='2882168', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_return_quantity set stats ('row_count'='143996756', 'ndv'='100', 'num_nulls'='2878774', 'min_value'='1', 'max_value'='100', 'data_size'='575987024') + """ + + sql """ + alter table catalog_returns modify column cr_returned_time_sk set stats ('row_count'='143996756', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='1151974048') + """ + + sql """ + alter table household_demographics modify column hd_dep_count set stats ('row_count'='7200', 'ndv'='10', 'num_nulls'='0', 'min_value'='0', 'max_value'='9', 'data_size'='28800') + """ + + sql """ + alter table customer_address modify column ca_county set stats ('row_count'='6000000', 'ndv'='1825', 'num_nulls'='0', 'min_value'='', 'max_value'='Ziebach County', 'data_size'='81254984') + """ + + sql """ + alter table income_band modify column ib_lower_bound set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='0', 'max_value'='190001', 'data_size'='80') + """ + + sql """ + alter table item modify column i_category_id set stats ('row_count'='300000', 'ndv'='10', 'num_nulls'='766', 'min_value'='1', 'max_value'='10', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_class set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='0', 'min_value'='', 'max_value'='womens watch', 'data_size'='2331199') + """ + + sql """ + alter table item modify column i_container set stats ('row_count'='300000', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='2094652') + """ + + sql """ + alter table item modify column i_current_price set stats ('row_count'='300000', 'ndv'='9685', 'num_nulls'='775', 'min_value'='0.09', 'max_value'='99.99', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_manager_id set stats ('row_count'='300000', 'ndv'='100', 'num_nulls'='744', 'min_value'='1', 'max_value'='100', 'data_size'='1200000') + """ + + sql """ + alter table item modify column i_size set stats ('row_count'='300000', 'ndv'='8', 'num_nulls'='0', 'min_value'='', 'max_value'='small', 'data_size'='1296134') + """ + + sql """ + alter table web_returns modify column wr_order_number set stats ('row_count'='71997522', 'ndv'='42383708', 'num_nulls'='0', 'min_value'='1', 'max_value'='60000000', 'data_size'='575980176') + """ + + sql """ + alter table web_returns modify column wr_refunded_cash set stats ('row_count'='71997522', 'ndv'='955369', 'num_nulls'='3240493', 'min_value'='0.00', 'max_value'='26992.92', 'data_size'='287990088') + """ + + sql """ + alter table web_site modify column web_country set stats ('row_count'='54', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='United States', 'data_size'='689') + """ + + sql """ + alter table web_site modify column web_gmt_offset set stats ('row_count'='54', 'ndv'='4', 'num_nulls'='1', 'min_value'='-8.00', 'max_value'='-5.00', 'data_size'='216') + """ + + sql """ + alter table web_site modify column web_market_manager set stats ('row_count'='54', 'ndv'='46', 'num_nulls'='0', 'min_value'='', 'max_value'='Zachery Oneil', 'data_size'='691') + """ + + sql """ + alter table web_site modify column web_site_sk set stats ('row_count'='54', 'ndv'='54', 'num_nulls'='0', 'min_value'='1', 'max_value'='54', 'data_size'='432') + """ + + sql """ + alter table web_site modify column web_street_name set stats ('row_count'='54', 'ndv'='53', 'num_nulls'='0', 'min_value'='', 'max_value'='Wilson Ridge', 'data_size'='471') + """ + + sql """ + alter table web_site modify column web_tax_percentage set stats ('row_count'='54', 'ndv'='13', 'num_nulls'='1', 'min_value'='0.00', 'max_value'='0.12', 'data_size'='216') + """ + + sql """ + alter table promotion modify column p_channel_tv set stats ('row_count'='1500', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='N', 'data_size'='1481') + """ + + sql """ + alter table promotion modify column p_response_targe set stats ('row_count'='1500', 'ndv'='1', 'num_nulls'='27', 'min_value'='1', 'max_value'='1', 'data_size'='6000') + """ + + sql """ + alter table web_sales modify column ws_bill_addr_sk set stats ('row_count'='720000376', 'ndv'='6015742', 'num_nulls'='179648', 'min_value'='1', 'max_value'='6000000', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ext_sales_price set stats ('row_count'='720000376', 'ndv'='1091003', 'num_nulls'='180023', 'min_value'='0.00', 'max_value'='29810.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_net_profit set stats ('row_count'='720000376', 'ndv'='2014057', 'num_nulls'='0', 'min_value'='-10000.00', 'max_value'='19840.00', 'data_size'='2880001504') + """ + + sql """ + alter table web_sales modify column ws_promo_sk set stats ('row_count'='720000376', 'ndv'='1489', 'num_nulls'='180016', 'min_value'='1', 'max_value'='1500', 'data_size'='5760003008') + """ + + sql """ + alter table web_sales modify column ws_ship_customer_sk set stats ('row_count'='720000376', 'ndv'='12074547', 'num_nulls'='179966', 'min_value'='1', 'max_value'='12000000', 'data_size'='5760003008') + """ + + sql """ + alter table store modify column s_division_name set stats ('row_count'='1002', 'ndv'='2', 'num_nulls'='0', 'min_value'='', 'max_value'='Unknown', 'data_size'='6965') + """ + + sql """ + alter table store modify column s_floor_space set stats ('row_count'='1002', 'ndv'='752', 'num_nulls'='6', 'min_value'='5002549', 'max_value'='9997773', 'data_size'='4008') + """ + + sql """ + alter table store modify column s_tax_percentage set stats ('row_count'='1002', 'ndv'='12', 'num_nulls'='8', 'min_value'='0.00', 'max_value'='0.11', 'data_size'='4008') + """ + + sql """ + alter table time_dim modify column t_time_id set stats ('row_count'='86400', 'ndv'='85663', 'num_nulls'='0', 'min_value'='AAAAAAAAAAAABAAA', 'max_value'='AAAAAAAAPPPPAAAA', 'data_size'='1382400') + """ + + sql """ + alter table time_dim modify column t_time_sk set stats ('row_count'='86400', 'ndv'='87677', 'num_nulls'='0', 'min_value'='0', 'max_value'='86399', 'data_size'='691200') + """ + + sql """ + alter table store_returns modify column sr_fee set stats ('row_count'='287999764', 'ndv'='9958', 'num_nulls'='10081860', 'min_value'='0.50', 'max_value'='100.00', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_reason_sk set stats ('row_count'='287999764', 'ndv'='65', 'num_nulls'='10087936', 'min_value'='1', 'max_value'='65', 'data_size'='2303998112') + """ + + sql """ + alter table store_returns modify column sr_store_credit set stats ('row_count'='287999764', 'ndv'='698161', 'num_nulls'='10077188', 'min_value'='0.00', 'max_value'='17792.48', 'data_size'='1151999056') + """ + + sql """ + alter table store_returns modify column sr_ticket_number set stats ('row_count'='287999764', 'ndv'='168770768', 'num_nulls'='0', 'min_value'='1', 'max_value'='240000000', 'data_size'='2303998112') + """ + + sql """ + alter table store_sales modify column ss_ext_list_price set stats ('row_count'='2879987999', 'ndv'='770971', 'num_nulls'='129593800', 'min_value'='1.00', 'max_value'='20000.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_ext_sales_price set stats ('row_count'='2879987999', 'ndv'='754248', 'num_nulls'='129589177', 'min_value'='0.00', 'max_value'='19972.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_net_profit set stats ('row_count'='2879987999', 'ndv'='1497362', 'num_nulls'='129572933', 'min_value'='-10000.00', 'max_value'='9986.00', 'data_size'='11519951996') + """ + + sql """ + alter table store_sales modify column ss_promo_sk set stats ('row_count'='2879987999', 'ndv'='1489', 'num_nulls'='129597096', 'min_value'='1', 'max_value'='1500', 'data_size'='23039903992') + """ + + sql """ + alter table ship_mode modify column sm_code set stats ('row_count'='20', 'ndv'='4', 'num_nulls'='0', 'min_value'='AIR', 'max_value'='SURFACE', 'data_size'='87') + """ + + sql """ + alter table ship_mode modify column sm_contract set stats ('row_count'='20', 'ndv'='20', 'num_nulls'='0', 'min_value'='2mM8l', 'max_value'='yVfotg7Tio3MVhBg6Bkn', 'data_size'='252') + """ + + sql """ + alter table customer modify column c_current_hdemo_sk set stats ('row_count'='12000000', 'ndv'='7251', 'num_nulls'='418736', 'min_value'='1', 'max_value'='7200', 'data_size'='96000000') + """ + + sql """ + alter table dbgen_version modify column dv_create_date set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2023-07-06', 'max_value'='2023-07-06', 'data_size'='4') + """ + + sql """ + alter table dbgen_version modify column dv_create_time set stats ('row_count'='1', 'ndv'='1', 'num_nulls'='0', 'min_value'='2017-05-13 00:00:00', 'max_value'='2017-05-13 00:00:00', 'data_size'='8') + """ +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query1.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query1.groovy new file mode 100644 index 00000000000000..914a0af2189b84 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query1.groovy @@ -0,0 +1,86 @@ +/* + * 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("query1") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with customer_total_return as +(select sr_customer_sk as ctr_customer_sk +,sr_store_sk as ctr_store_sk +,sum(SR_FEE) as ctr_total_return +from store_returns +,date_dim +where sr_returned_date_sk = d_date_sk +and d_year =2000 +group by sr_customer_sk +,sr_store_sk) + select c_customer_id +from customer_total_return ctr1 +,store +,customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 +from customer_total_return ctr2 +where ctr1.ctr_store_sk = ctr2.ctr_store_sk) +and s_store_sk = ctr1.ctr_store_sk +and s_state = 'TN' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100""" + qt_ds_shape_1 ''' + explain shape plan + with customer_total_return as +(select sr_customer_sk as ctr_customer_sk +,sr_store_sk as ctr_store_sk +,sum(SR_FEE) as ctr_total_return +from store_returns +,date_dim +where sr_returned_date_sk = d_date_sk +and d_year =2000 +group by sr_customer_sk +,sr_store_sk) + select c_customer_id +from customer_total_return ctr1 +,store +,customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 +from customer_total_return ctr2 +where ctr1.ctr_store_sk = ctr2.ctr_store_sk) +and s_store_sk = ctr1.ctr_store_sk +and s_state = 'TN' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query10.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query10.groovy new file mode 100644 index 00000000000000..ea222751007140 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query10.groovy @@ -0,0 +1,154 @@ +/* + * 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("query10") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3, + cd_dep_count, + count(*) cnt4, + cd_dep_employed_count, + count(*) cnt5, + cd_dep_college_count, + count(*) cnt6 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_county in ('Fairfield County','Campbell County','Washtenaw County','Escambia County','Cleburne County') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 and 3+3) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 ANd 3+3) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 and 3+3)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count +limit 100""" + qt_ds_shape_10 ''' + explain shape plan + select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3, + cd_dep_count, + count(*) cnt4, + cd_dep_employed_count, + count(*) cnt5, + cd_dep_college_count, + count(*) cnt6 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_county in ('Fairfield County','Campbell County','Washtenaw County','Escambia County','Cleburne County') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 and 3+3) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 ANd 3+3) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 3 and 3+3)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query11.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query11.groovy new file mode 100644 index 00000000000000..09086cf80e9f82 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query11.groovy @@ -0,0 +1,198 @@ +/* + * 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("query11") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1998 + and t_s_secyear.dyear = 1998+1 + and t_w_firstyear.dyear = 1998 + and t_w_secyear.dyear = 1998+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0 end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address +limit 100""" + qt_ds_shape_11 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1998 + and t_s_secyear.dyear = 1998+1 + and t_w_firstyear.dyear = 1998 + and t_w_secyear.dyear = 1998+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0 end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query12.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query12.groovy new file mode 100644 index 00000000000000..ae0b8e7452158e --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query12.groovy @@ -0,0 +1,104 @@ +/* + * 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("query12") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ws_ext_sales_price) as itemrevenue + ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over + (partition by i_class) as revenueratio +from + web_sales + ,item + ,date_dim +where + ws_item_sk = i_item_sk + and i_category in ('Men', 'Books', 'Electronics') + and ws_sold_date_sk = d_date_sk + and d_date between cast('2001-06-15' as date) + and (cast('2001-06-15' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100""" + qt_ds_shape_12 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ws_ext_sales_price) as itemrevenue + ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over + (partition by i_class) as revenueratio +from + web_sales + ,item + ,date_dim +where + ws_item_sk = i_item_sk + and i_category in ('Men', 'Books', 'Electronics') + and ws_sold_date_sk = d_date_sk + and d_date between cast('2001-06-15' as date) + and (cast('2001-06-15' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query13.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query13.groovy new file mode 100644 index 00000000000000..55883a36ae7e95 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query13.groovy @@ -0,0 +1,140 @@ +/* + * 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("query13") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select avg(ss_quantity) + ,avg(ss_ext_sales_price) + ,avg(ss_ext_wholesale_cost) + ,sum(ss_ext_wholesale_cost) + from store_sales + ,store + ,customer_demographics + ,household_demographics + ,customer_address + ,date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and((ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'M' + and cd_education_status = 'College' + and ss_sales_price between 100.00 and 150.00 + and hd_dep_count = 3 + )or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'D' + and cd_education_status = 'Primary' + and ss_sales_price between 50.00 and 100.00 + and hd_dep_count = 1 + ) or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'W' + and cd_education_status = '2 yr Degree' + and ss_sales_price between 150.00 and 200.00 + and hd_dep_count = 1 + )) + and((ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('IL', 'TN', 'TX') + and ss_net_profit between 100 and 200 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('WY', 'OH', 'ID') + and ss_net_profit between 150 and 300 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('MS', 'SC', 'IA') + and ss_net_profit between 50 and 250 + )) +""" + qt_ds_shape_13 ''' + explain shape plan + select avg(ss_quantity) + ,avg(ss_ext_sales_price) + ,avg(ss_ext_wholesale_cost) + ,sum(ss_ext_wholesale_cost) + from store_sales + ,store + ,customer_demographics + ,household_demographics + ,customer_address + ,date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and((ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'M' + and cd_education_status = 'College' + and ss_sales_price between 100.00 and 150.00 + and hd_dep_count = 3 + )or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'D' + and cd_education_status = 'Primary' + and ss_sales_price between 50.00 and 100.00 + and hd_dep_count = 1 + ) or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'W' + and cd_education_status = '2 yr Degree' + and ss_sales_price between 150.00 and 200.00 + and hd_dep_count = 1 + )) + and((ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('IL', 'TN', 'TX') + and ss_net_profit between 100 and 200 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('WY', 'OH', 'ID') + and ss_net_profit between 150 and 300 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('MS', 'SC', 'IA') + and ss_net_profit between 50 and 250 + )) + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query14.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query14.groovy new file mode 100644 index 00000000000000..753fec2e26658f --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query14.groovy @@ -0,0 +1,244 @@ +/* + * 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("query14") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with cross_items as + (select i_item_sk ss_item_sk + from item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from store_sales + ,item iss + ,date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 1999 AND 1999 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from catalog_sales + ,item ics + ,date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 1999 AND 1999 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from web_sales + ,item iws + ,date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 1999 AND 1999 + 2) + t where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), +avg_sales as + (select avg(quantity*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from store_sales + ,date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from catalog_sales + ,date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from web_sales + ,date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2) x) + select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales) + from( + select 'store' channel, i_brand_id,i_class_id + ,i_category_id,sum(ss_quantity*ss_list_price) sales + , count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales) + union all + select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity*cs_list_price) sales, count(*) number_sales + from catalog_sales + ,item + ,date_dim + where cs_item_sk in (select ss_item_sk from cross_items) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales) + union all + select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity*ws_list_price) sales , count(*) number_sales + from web_sales + ,item + ,date_dim + where ws_item_sk in (select ss_item_sk from cross_items) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ws_quantity*ws_list_price) > (select average_sales from avg_sales) + ) y + group by rollup (channel, i_brand_id,i_class_id,i_category_id) + order by channel,i_brand_id,i_class_id,i_category_id + limit 100""" + qt_ds_shape_14 ''' + explain shape plan + with cross_items as + (select i_item_sk ss_item_sk + from item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from store_sales + ,item iss + ,date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 1999 AND 1999 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from catalog_sales + ,item ics + ,date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 1999 AND 1999 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from web_sales + ,item iws + ,date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 1999 AND 1999 + 2) + t where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), +avg_sales as + (select avg(quantity*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from store_sales + ,date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from catalog_sales + ,date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from web_sales + ,date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 1999 and 1999 + 2) x) + select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales) + from( + select 'store' channel, i_brand_id,i_class_id + ,i_category_id,sum(ss_quantity*ss_list_price) sales + , count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales) + union all + select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity*cs_list_price) sales, count(*) number_sales + from catalog_sales + ,item + ,date_dim + where cs_item_sk in (select ss_item_sk from cross_items) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales) + union all + select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity*ws_list_price) sales , count(*) number_sales + from web_sales + ,item + ,date_dim + where ws_item_sk in (select ss_item_sk from cross_items) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1999+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ws_quantity*ws_list_price) > (select average_sales from avg_sales) + ) y + group by rollup (channel, i_brand_id,i_class_id,i_category_id) + order by channel,i_brand_id,i_class_id,i_category_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query15.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query15.groovy new file mode 100644 index 00000000000000..5ae2eb30d1ee1c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query15.groovy @@ -0,0 +1,76 @@ +/* + * 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("query15") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select ca_zip + ,sum(cs_sales_price) + from catalog_sales + ,customer + ,customer_address + ,date_dim + where cs_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', + '85392', '85460', '80348', '81792') + or ca_state in ('CA','WA','GA') + or cs_sales_price > 500) + and cs_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 2001 + group by ca_zip + order by ca_zip + limit 100""" + qt_ds_shape_15 ''' + explain shape plan + select ca_zip + ,sum(cs_sales_price) + from catalog_sales + ,customer + ,customer_address + ,date_dim + where cs_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', + '85392', '85460', '80348', '81792') + or ca_state in ('CA','WA','GA') + or cs_sales_price > 500) + and cs_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 2001 + group by ca_zip + order by ca_zip + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query16.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query16.groovy new file mode 100644 index 00000000000000..2e8c4098fa2e85 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query16.groovy @@ -0,0 +1,98 @@ +/* + * 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("query16") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + count(distinct cs_order_number) as "order count" + ,sum(cs_ext_ship_cost) as "total shipping cost" + ,sum(cs_net_profit) as "total net profit" +from + catalog_sales cs1 + ,date_dim + ,customer_address + ,call_center +where + d_date between '2002-4-01' and + (cast('2002-4-01' as date) + interval 60 day) +and cs1.cs_ship_date_sk = d_date_sk +and cs1.cs_ship_addr_sk = ca_address_sk +and ca_state = 'PA' +and cs1.cs_call_center_sk = cc_call_center_sk +and cc_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County' +) +and exists (select * + from catalog_sales cs2 + where cs1.cs_order_number = cs2.cs_order_number + and cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk) +and not exists(select * + from catalog_returns cr1 + where cs1.cs_order_number = cr1.cr_order_number) +order by count(distinct cs_order_number) +limit 100""" + qt_ds_shape_16 ''' + explain shape plan + select + count(distinct cs_order_number) as "order count" + ,sum(cs_ext_ship_cost) as "total shipping cost" + ,sum(cs_net_profit) as "total net profit" +from + catalog_sales cs1 + ,date_dim + ,customer_address + ,call_center +where + d_date between '2002-4-01' and + (cast('2002-4-01' as date) + interval 60 day) +and cs1.cs_ship_date_sk = d_date_sk +and cs1.cs_ship_addr_sk = ca_address_sk +and ca_state = 'PA' +and cs1.cs_call_center_sk = cc_call_center_sk +and cc_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County' +) +and exists (select * + from catalog_sales cs2 + where cs1.cs_order_number = cs2.cs_order_number + and cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk) +and not exists(select * + from catalog_returns cr1 + where cs1.cs_order_number = cr1.cr_order_number) +order by count(distinct cs_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query17.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query17.groovy new file mode 100644 index 00000000000000..1c973e7d09aadc --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query17.groovy @@ -0,0 +1,126 @@ +/* + * 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("query17") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,s_state + ,count(ss_quantity) as store_sales_quantitycount + ,avg(ss_quantity) as store_sales_quantityave + ,stddev_samp(ss_quantity) as store_sales_quantitystdev + ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov + ,count(sr_return_quantity) as store_returns_quantitycount + ,avg(sr_return_quantity) as store_returns_quantityave + ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev + ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov + ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave + ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev + ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov + from store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where d1.d_quarter_name = '2001Q1' + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100""" + qt_ds_shape_17 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,s_state + ,count(ss_quantity) as store_sales_quantitycount + ,avg(ss_quantity) as store_sales_quantityave + ,stddev_samp(ss_quantity) as store_sales_quantitystdev + ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov + ,count(sr_return_quantity) as store_returns_quantitycount + ,avg(sr_return_quantity) as store_returns_quantityave + ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev + ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov + ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave + ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev + ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov + from store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where d1.d_quarter_name = '2001Q1' + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query18.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query18.groovy new file mode 100644 index 00000000000000..8592f99318d195 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query18.groovy @@ -0,0 +1,104 @@ +/* + * 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("query18") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id, + ca_country, + ca_state, + ca_county, + avg( cast(cs_quantity as decimal(12,2))) agg1, + avg( cast(cs_list_price as decimal(12,2))) agg2, + avg( cast(cs_coupon_amt as decimal(12,2))) agg3, + avg( cast(cs_sales_price as decimal(12,2))) agg4, + avg( cast(cs_net_profit as decimal(12,2))) agg5, + avg( cast(c_birth_year as decimal(12,2))) agg6, + avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7 + from catalog_sales, customer_demographics cd1, + customer_demographics cd2, customer, customer_address, date_dim, item + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd1.cd_demo_sk and + cs_bill_customer_sk = c_customer_sk and + cd1.cd_gender = 'F' and + cd1.cd_education_status = 'Primary' and + c_current_cdemo_sk = cd2.cd_demo_sk and + c_current_addr_sk = ca_address_sk and + c_birth_month in (1,3,7,11,10,4) and + d_year = 2001 and + ca_state in ('AL','MO','TN' + ,'GA','MT','IN','CA') + group by rollup (i_item_id, ca_country, ca_state, ca_county) + order by ca_country, + ca_state, + ca_county, + i_item_id + limit 100""" + qt_ds_shape_18 ''' + explain shape plan + select i_item_id, + ca_country, + ca_state, + ca_county, + avg( cast(cs_quantity as decimal(12,2))) agg1, + avg( cast(cs_list_price as decimal(12,2))) agg2, + avg( cast(cs_coupon_amt as decimal(12,2))) agg3, + avg( cast(cs_sales_price as decimal(12,2))) agg4, + avg( cast(cs_net_profit as decimal(12,2))) agg5, + avg( cast(c_birth_year as decimal(12,2))) agg6, + avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7 + from catalog_sales, customer_demographics cd1, + customer_demographics cd2, customer, customer_address, date_dim, item + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd1.cd_demo_sk and + cs_bill_customer_sk = c_customer_sk and + cd1.cd_gender = 'F' and + cd1.cd_education_status = 'Primary' and + c_current_cdemo_sk = cd2.cd_demo_sk and + c_current_addr_sk = ca_address_sk and + c_birth_month in (1,3,7,11,10,4) and + d_year = 2001 and + ca_state in ('AL','MO','TN' + ,'GA','MT','IN','CA') + group by rollup (i_item_id, ca_country, ca_state, ca_county) + order by ca_country, + ca_state, + ca_county, + i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query19.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query19.groovy new file mode 100644 index 00000000000000..bb1dca6574e40d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query19.groovy @@ -0,0 +1,86 @@ +/* + * 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("query19") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item,customer,customer_address,store + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=14 + and d_moy=11 + and d_year=2002 + and ss_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and substr(ca_zip,1,5) <> substr(s_zip,1,5) + and ss_store_sk = s_store_sk + group by i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact + order by ext_price desc + ,i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact +limit 100 """ + qt_ds_shape_19 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item,customer,customer_address,store + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=14 + and d_moy=11 + and d_year=2002 + and ss_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and substr(ca_zip,1,5) <> substr(s_zip,1,5) + and ss_store_sk = s_store_sk + group by i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact + order by ext_price desc + ,i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query2.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query2.groovy new file mode 100644 index 00000000000000..7ae18743e60774 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query2.groovy @@ -0,0 +1,156 @@ +/* + * 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("query2") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with wscs as + (select sold_date_sk + ,sales_price + from (select ws_sold_date_sk sold_date_sk + ,ws_ext_sales_price sales_price + from web_sales + union all + select cs_sold_date_sk sold_date_sk + ,cs_ext_sales_price sales_price + from catalog_sales) t), + wswscs as + (select d_week_seq, + sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales + from wscs + ,date_dim + where d_date_sk = sold_date_sk + group by d_week_seq) + select d_week_seq1 + ,round(sun_sales1/sun_sales2,2) + ,round(mon_sales1/mon_sales2,2) + ,round(tue_sales1/tue_sales2,2) + ,round(wed_sales1/wed_sales2,2) + ,round(thu_sales1/thu_sales2,2) + ,round(fri_sales1/fri_sales2,2) + ,round(sat_sales1/sat_sales2,2) + from + (select wswscs.d_week_seq d_week_seq1 + ,sun_sales sun_sales1 + ,mon_sales mon_sales1 + ,tue_sales tue_sales1 + ,wed_sales wed_sales1 + ,thu_sales thu_sales1 + ,fri_sales fri_sales1 + ,sat_sales sat_sales1 + from wswscs,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998) y, + (select wswscs.d_week_seq d_week_seq2 + ,sun_sales sun_sales2 + ,mon_sales mon_sales2 + ,tue_sales tue_sales2 + ,wed_sales wed_sales2 + ,thu_sales thu_sales2 + ,fri_sales fri_sales2 + ,sat_sales sat_sales2 + from wswscs + ,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998+1) z + where d_week_seq1=d_week_seq2-53 + order by d_week_seq1""" + qt_ds_shape_2 ''' + explain shape plan + with wscs as + (select sold_date_sk + ,sales_price + from (select ws_sold_date_sk sold_date_sk + ,ws_ext_sales_price sales_price + from web_sales + union all + select cs_sold_date_sk sold_date_sk + ,cs_ext_sales_price sales_price + from catalog_sales) t), + wswscs as + (select d_week_seq, + sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales + from wscs + ,date_dim + where d_date_sk = sold_date_sk + group by d_week_seq) + select d_week_seq1 + ,round(sun_sales1/sun_sales2,2) + ,round(mon_sales1/mon_sales2,2) + ,round(tue_sales1/tue_sales2,2) + ,round(wed_sales1/wed_sales2,2) + ,round(thu_sales1/thu_sales2,2) + ,round(fri_sales1/fri_sales2,2) + ,round(sat_sales1/sat_sales2,2) + from + (select wswscs.d_week_seq d_week_seq1 + ,sun_sales sun_sales1 + ,mon_sales mon_sales1 + ,tue_sales tue_sales1 + ,wed_sales wed_sales1 + ,thu_sales thu_sales1 + ,fri_sales fri_sales1 + ,sat_sales sat_sales1 + from wswscs,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998) y, + (select wswscs.d_week_seq d_week_seq2 + ,sun_sales sun_sales2 + ,mon_sales mon_sales2 + ,tue_sales tue_sales2 + ,wed_sales wed_sales2 + ,thu_sales thu_sales2 + ,fri_sales fri_sales2 + ,sat_sales sat_sales2 + from wswscs + ,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998+1) z + where d_week_seq1=d_week_seq2-53 + order by d_week_seq1 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query20.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query20.groovy new file mode 100644 index 00000000000000..914be027b5b4d8 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query20.groovy @@ -0,0 +1,96 @@ +/* + * 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("query20") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(cs_ext_sales_price) as itemrevenue + ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over + (partition by i_class) as revenueratio + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and i_category in ('Books', 'Music', 'Sports') + and cs_sold_date_sk = d_date_sk + and d_date between cast('2002-06-18' as date) + and (cast('2002-06-18' as date) + interval 30 day) + group by i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + order by i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100""" + qt_ds_shape_20 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(cs_ext_sales_price) as itemrevenue + ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over + (partition by i_class) as revenueratio + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and i_category in ('Books', 'Music', 'Sports') + and cs_sold_date_sk = d_date_sk + and d_date between cast('2002-06-18' as date) + and (cast('2002-06-18' as date) + interval 30 day) + group by i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + order by i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query21.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query21.groovy new file mode 100644 index 00000000000000..b8e7943e7fd265 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query21.groovy @@ -0,0 +1,97 @@ +/* + * 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("query21") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'SET enable_fold_constant_by_be = false' //plan shape will be different + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * + from(select w_warehouse_name + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('1999-06-22' as date)) + then inv_quantity_on_hand + else 0 end) as inv_before + ,sum(case when (cast(d_date as date) >= cast ('1999-06-22' as date)) + then inv_quantity_on_hand + else 0 end) as inv_after + from inventory + ,warehouse + ,item + ,date_dim + where i_current_price between 0.99 and 1.49 + and i_item_sk = inv_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_date between (cast ('1999-06-22' as date) - interval 30 day) + and (cast ('1999-06-22' as date) + interval 30 day) + group by w_warehouse_name, i_item_id) x + where (case when inv_before > 0 + then inv_after / inv_before + else null + end) between 2.0/3.0 and 3.0/2.0 + order by w_warehouse_name + ,i_item_id + limit 100""" + qt_ds_shape_21 ''' + explain shape plan + select * + from(select w_warehouse_name + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('1999-06-22' as date)) + then inv_quantity_on_hand + else 0 end) as inv_before + ,sum(case when (cast(d_date as date) >= cast ('1999-06-22' as date)) + then inv_quantity_on_hand + else 0 end) as inv_after + from inventory + ,warehouse + ,item + ,date_dim + where i_current_price between 0.99 and 1.49 + and i_item_sk = inv_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_date between (cast ('1999-06-22' as date) - interval 30 day) + and (cast ('1999-06-22' as date) + interval 30 day) + group by w_warehouse_name, i_item_id) x + where (case when inv_before > 0 + then inv_after / inv_before + else null + end) between 2.0/3.0 and 3.0/2.0 + order by w_warehouse_name + ,i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query22.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query22.groovy new file mode 100644 index 00000000000000..28907748d9b2ba --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query22.groovy @@ -0,0 +1,76 @@ +/* + * 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("query22") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_product_name + ,i_brand + ,i_class + ,i_category + ,avg(inv_quantity_on_hand) qoh + from inventory + ,date_dim + ,item + where inv_date_sk=d_date_sk + and inv_item_sk=i_item_sk + and d_month_seq between 1200 and 1200 + 11 + group by rollup(i_product_name + ,i_brand + ,i_class + ,i_category) +order by qoh, i_product_name, i_brand, i_class, i_category +limit 100""" + qt_ds_shape_22 ''' + explain shape plan + select i_product_name + ,i_brand + ,i_class + ,i_category + ,avg(inv_quantity_on_hand) qoh + from inventory + ,date_dim + ,item + where inv_date_sk=d_date_sk + and inv_item_sk=i_item_sk + and d_month_seq between 1200 and 1200 + 11 + group by rollup(i_product_name + ,i_brand + ,i_class + ,i_category) +order by qoh, i_product_name, i_brand, i_class, i_category +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query23.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query23.groovy new file mode 100644 index 00000000000000..8a384adc63eb10 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query23.groovy @@ -0,0 +1,143 @@ +/* + * 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("query23") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + multi_sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set enable_runtime_filter_prune=false; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=false; + set enable_stats=true; + set runtime_filter_type=8; + set broadcast_row_count_limit = 30000000; + set enable_nereids_timeout = false; + set enable_pipeline_engine = true; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set push_topn_to_agg = true; + set topn_opt_limit_threshold=1024; + """ + + def ds = """with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from store_sales + ,date_dim + ,item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by substr(i_item_desc,1,30),i_item_sk,d_date + having count(*) >4), + max_store_sales as + (select max(csales) tpcds_cmax + from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales + from store_sales + ,customer + ,date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by c_customer_sk) t), +best_ss_customer as + (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales + from store_sales + ,customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select + * +from + max_store_sales)) + select sum(sales) + from (select cs_quantity*cs_list_price sales + from catalog_sales + ,date_dim + where d_year = 2000 + and d_moy = 7 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + union all + select ws_quantity*ws_list_price sales + from web_sales + ,date_dim + where d_year = 2000 + and d_moy = 7 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) t2 + limit 100""" + qt_ds_shape_23 ''' + explain shape plan + with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from store_sales + ,date_dim + ,item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by substr(i_item_desc,1,30),i_item_sk,d_date + having count(*) >4), + max_store_sales as + (select max(csales) tpcds_cmax + from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales + from store_sales + ,customer + ,date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by c_customer_sk) t), +best_ss_customer as + (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales + from store_sales + ,customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select + * +from + max_store_sales)) + select sum(sales) + from (select cs_quantity*cs_list_price sales + from catalog_sales + ,date_dim + where d_year = 2000 + and d_moy = 7 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + union all + select ws_quantity*ws_list_price sales + from web_sales + ,date_dim + where d_year = 2000 + and d_moy = 7 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) t2 + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query24.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query24.groovy new file mode 100644 index 00000000000000..07aab6781c5a5c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query24.groovy @@ -0,0 +1,146 @@ +/* + * 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("query24") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ssales as +(select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_net_paid) netpaid +from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address +where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_current_addr_sk = ca_address_sk + and c_birth_country <> upper(ca_country) + and s_zip = ca_zip +and s_market_id=5 +group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) +select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid +from ssales +where i_color = 'aquamarine' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name +""" + qt_ds_shape_24 ''' + explain shape plan + with ssales as +(select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_net_paid) netpaid +from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address +where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_current_addr_sk = ca_address_sk + and c_birth_country <> upper(ca_country) + and s_zip = ca_zip +and s_market_id=5 +group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) +select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid +from ssales +where i_color = 'aquamarine' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query25.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query25.groovy new file mode 100644 index 00000000000000..f9b37733278bc4 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query25.groovy @@ -0,0 +1,132 @@ +/* + * 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("query25") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,max(ss_net_profit) as store_sales_profit + ,max(sr_net_loss) as store_returns_loss + ,max(cs_net_profit) as catalog_sales_profit + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1999 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 10 + and d2.d_year = 1999 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_moy between 4 and 10 + and d3.d_year = 1999 + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100""" + qt_ds_shape_25 ''' + explain shape plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,max(ss_net_profit) as store_sales_profit + ,max(sr_net_loss) as store_returns_loss + ,max(cs_net_profit) as catalog_sales_profit + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1999 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 10 + and d2.d_year = 1999 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_moy between 4 and 10 + and d3.d_year = 1999 + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query26.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query26.groovy new file mode 100644 index 00000000000000..e599258eb5453b --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query26.groovy @@ -0,0 +1,78 @@ +/* + * 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("query26") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id, + avg(cs_quantity) agg1, + avg(cs_list_price) agg2, + avg(cs_coupon_amt) agg3, + avg(cs_sales_price) agg4 + from catalog_sales, customer_demographics, date_dim, item, promotion + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd_demo_sk and + cs_promo_sk = p_promo_sk and + cd_gender = 'M' and + cd_marital_status = 'W' and + cd_education_status = 'Unknown' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2002 + group by i_item_id + order by i_item_id + limit 100""" + qt_ds_shape_26 ''' + explain shape plan + select i_item_id, + avg(cs_quantity) agg1, + avg(cs_list_price) agg2, + avg(cs_coupon_amt) agg3, + avg(cs_sales_price) agg4 + from catalog_sales, customer_demographics, date_dim, item, promotion + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd_demo_sk and + cs_promo_sk = p_promo_sk and + cd_gender = 'M' and + cd_marital_status = 'W' and + cd_education_status = 'Unknown' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2002 + group by i_item_id + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query27.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query27.groovy new file mode 100644 index 00000000000000..312b29a2056d36 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query27.groovy @@ -0,0 +1,82 @@ +/* + * 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("query27") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id, + s_state, grouping(s_state) g_state, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, store, item + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_store_sk = s_store_sk and + ss_cdemo_sk = cd_demo_sk and + cd_gender = 'M' and + cd_marital_status = 'W' and + cd_education_status = 'Secondary' and + d_year = 1999 and + s_state in ('TN','TN', 'TN', 'TN', 'TN', 'TN') + group by rollup (i_item_id, s_state) + order by i_item_id + ,s_state + limit 100""" + qt_ds_shape_27 ''' + explain shape plan + select i_item_id, + s_state, grouping(s_state) g_state, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, store, item + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_store_sk = s_store_sk and + ss_cdemo_sk = cd_demo_sk and + cd_gender = 'M' and + cd_marital_status = 'W' and + cd_education_status = 'Secondary' and + d_year = 1999 and + s_state in ('TN','TN', 'TN', 'TN', 'TN', 'TN') + group by rollup (i_item_id, s_state) + order by i_item_id + ,s_state + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query28.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query28.groovy new file mode 100644 index 00000000000000..a8151135102b1c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query28.groovy @@ -0,0 +1,142 @@ +/* + * 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("query28") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * +from (select avg(ss_list_price) B1_LP + ,count(ss_list_price) B1_CNT + ,count(distinct ss_list_price) B1_CNTD + from store_sales + where ss_quantity between 0 and 5 + and (ss_list_price between 107 and 107+10 + or ss_coupon_amt between 1319 and 1319+1000 + or ss_wholesale_cost between 60 and 60+20)) B1, + (select avg(ss_list_price) B2_LP + ,count(ss_list_price) B2_CNT + ,count(distinct ss_list_price) B2_CNTD + from store_sales + where ss_quantity between 6 and 10 + and (ss_list_price between 23 and 23+10 + or ss_coupon_amt between 825 and 825+1000 + or ss_wholesale_cost between 43 and 43+20)) B2, + (select avg(ss_list_price) B3_LP + ,count(ss_list_price) B3_CNT + ,count(distinct ss_list_price) B3_CNTD + from store_sales + where ss_quantity between 11 and 15 + and (ss_list_price between 74 and 74+10 + or ss_coupon_amt between 4381 and 4381+1000 + or ss_wholesale_cost between 57 and 57+20)) B3, + (select avg(ss_list_price) B4_LP + ,count(ss_list_price) B4_CNT + ,count(distinct ss_list_price) B4_CNTD + from store_sales + where ss_quantity between 16 and 20 + and (ss_list_price between 89 and 89+10 + or ss_coupon_amt between 3117 and 3117+1000 + or ss_wholesale_cost between 68 and 68+20)) B4, + (select avg(ss_list_price) B5_LP + ,count(ss_list_price) B5_CNT + ,count(distinct ss_list_price) B5_CNTD + from store_sales + where ss_quantity between 21 and 25 + and (ss_list_price between 58 and 58+10 + or ss_coupon_amt between 9402 and 9402+1000 + or ss_wholesale_cost between 38 and 38+20)) B5, + (select avg(ss_list_price) B6_LP + ,count(ss_list_price) B6_CNT + ,count(distinct ss_list_price) B6_CNTD + from store_sales + where ss_quantity between 26 and 30 + and (ss_list_price between 64 and 64+10 + or ss_coupon_amt between 5792 and 5792+1000 + or ss_wholesale_cost between 73 and 73+20)) B6 +limit 100""" + qt_ds_shape_28 ''' + explain shape plan + select * +from (select avg(ss_list_price) B1_LP + ,count(ss_list_price) B1_CNT + ,count(distinct ss_list_price) B1_CNTD + from store_sales + where ss_quantity between 0 and 5 + and (ss_list_price between 107 and 107+10 + or ss_coupon_amt between 1319 and 1319+1000 + or ss_wholesale_cost between 60 and 60+20)) B1, + (select avg(ss_list_price) B2_LP + ,count(ss_list_price) B2_CNT + ,count(distinct ss_list_price) B2_CNTD + from store_sales + where ss_quantity between 6 and 10 + and (ss_list_price between 23 and 23+10 + or ss_coupon_amt between 825 and 825+1000 + or ss_wholesale_cost between 43 and 43+20)) B2, + (select avg(ss_list_price) B3_LP + ,count(ss_list_price) B3_CNT + ,count(distinct ss_list_price) B3_CNTD + from store_sales + where ss_quantity between 11 and 15 + and (ss_list_price between 74 and 74+10 + or ss_coupon_amt between 4381 and 4381+1000 + or ss_wholesale_cost between 57 and 57+20)) B3, + (select avg(ss_list_price) B4_LP + ,count(ss_list_price) B4_CNT + ,count(distinct ss_list_price) B4_CNTD + from store_sales + where ss_quantity between 16 and 20 + and (ss_list_price between 89 and 89+10 + or ss_coupon_amt between 3117 and 3117+1000 + or ss_wholesale_cost between 68 and 68+20)) B4, + (select avg(ss_list_price) B5_LP + ,count(ss_list_price) B5_CNT + ,count(distinct ss_list_price) B5_CNTD + from store_sales + where ss_quantity between 21 and 25 + and (ss_list_price between 58 and 58+10 + or ss_coupon_amt between 9402 and 9402+1000 + or ss_wholesale_cost between 38 and 38+20)) B5, + (select avg(ss_list_price) B6_LP + ,count(ss_list_price) B6_CNT + ,count(distinct ss_list_price) B6_CNTD + from store_sales + where ss_quantity between 26 and 30 + and (ss_list_price between 64 and 64+10 + or ss_coupon_amt between 5792 and 5792+1000 + or ss_wholesale_cost between 73 and 73+20)) B6 +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query29.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query29.groovy new file mode 100644 index 00000000000000..e1116a865dd8da --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query29.groovy @@ -0,0 +1,130 @@ +/* + * 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("query29") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,max(ss_quantity) as store_sales_quantity + ,max(sr_return_quantity) as store_returns_quantity + ,max(cs_quantity) as catalog_sales_quantity + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1998 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 4 + 3 + and d2.d_year = 1998 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_year in (1998,1998+1,1998+2) + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100""" + qt_ds_shape_29 ''' + explain shape plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,max(ss_quantity) as store_sales_quantity + ,max(sr_return_quantity) as store_returns_quantity + ,max(cs_quantity) as catalog_sales_quantity + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1998 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 4 + 3 + and d2.d_year = 1998 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_year in (1998,1998+1,1998+2) + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query3.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query3.groovy new file mode 100644 index 00000000000000..aace9720f393ff --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query3.groovy @@ -0,0 +1,78 @@ +/* + * 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("query3") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manufact_id = 816 + and dt.d_moy=11 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,sum_agg desc + ,brand_id + limit 100""" + qt_ds_shape_3 ''' + explain shape plan + select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manufact_id = 816 + and dt.d_moy=11 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,sum_agg desc + ,brand_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query30.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query30.groovy new file mode 100644 index 00000000000000..6afc169c8ae2dc --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query30.groovy @@ -0,0 +1,98 @@ +/* + * 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("query30") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with customer_total_return as + (select wr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(wr_return_amt) as ctr_total_return + from web_returns + ,date_dim + ,customer_address + where wr_returned_date_sk = d_date_sk + and d_year =2000 + and wr_returning_addr_sk = ca_address_sk + group by wr_returning_customer_sk + ,ca_state) + select c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'AR' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return +limit 100""" + qt_ds_shape_30 ''' + explain shape plan + with customer_total_return as + (select wr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(wr_return_amt) as ctr_total_return + from web_returns + ,date_dim + ,customer_address + where wr_returned_date_sk = d_date_sk + and d_year =2000 + and wr_returning_addr_sk = ca_address_sk + group by wr_returning_customer_sk + ,ca_state) + select c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'AR' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query31.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query31.groovy new file mode 100644 index 00000000000000..bb11fdd0951d77 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query31.groovy @@ -0,0 +1,140 @@ +/* + * 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("query31") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss as + (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales + from store_sales,date_dim,customer_address + where ss_sold_date_sk = d_date_sk + and ss_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year), + ws as + (select ca_county,d_qoy, d_year,sum(ws_ext_sales_price) as web_sales + from web_sales,date_dim,customer_address + where ws_sold_date_sk = d_date_sk + and ws_bill_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year) + select + ss1.ca_county + ,ss1.d_year + ,ws2.web_sales/ws1.web_sales web_q1_q2_increase + ,ss2.store_sales/ss1.store_sales store_q1_q2_increase + ,ws3.web_sales/ws2.web_sales web_q2_q3_increase + ,ss3.store_sales/ss2.store_sales store_q2_q3_increase + from + ss ss1 + ,ss ss2 + ,ss ss3 + ,ws ws1 + ,ws ws2 + ,ws ws3 + where + ss1.d_qoy = 1 + and ss1.d_year = 1999 + and ss1.ca_county = ss2.ca_county + and ss2.d_qoy = 2 + and ss2.d_year = 1999 + and ss2.ca_county = ss3.ca_county + and ss3.d_qoy = 3 + and ss3.d_year = 1999 + and ss1.ca_county = ws1.ca_county + and ws1.d_qoy = 1 + and ws1.d_year = 1999 + and ws1.ca_county = ws2.ca_county + and ws2.d_qoy = 2 + and ws2.d_year = 1999 + and ws1.ca_county = ws3.ca_county + and ws3.d_qoy = 3 + and ws3.d_year =1999 + and case when ws1.web_sales > 0 then ws2.web_sales/ws1.web_sales else null end + > case when ss1.store_sales > 0 then ss2.store_sales/ss1.store_sales else null end + and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end + > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end + order by store_q2_q3_increase""" + qt_ds_shape_31 ''' + explain shape plan + with ss as + (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales + from store_sales,date_dim,customer_address + where ss_sold_date_sk = d_date_sk + and ss_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year), + ws as + (select ca_county,d_qoy, d_year,sum(ws_ext_sales_price) as web_sales + from web_sales,date_dim,customer_address + where ws_sold_date_sk = d_date_sk + and ws_bill_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year) + select + ss1.ca_county + ,ss1.d_year + ,ws2.web_sales/ws1.web_sales web_q1_q2_increase + ,ss2.store_sales/ss1.store_sales store_q1_q2_increase + ,ws3.web_sales/ws2.web_sales web_q2_q3_increase + ,ss3.store_sales/ss2.store_sales store_q2_q3_increase + from + ss ss1 + ,ss ss2 + ,ss ss3 + ,ws ws1 + ,ws ws2 + ,ws ws3 + where + ss1.d_qoy = 1 + and ss1.d_year = 1999 + and ss1.ca_county = ss2.ca_county + and ss2.d_qoy = 2 + and ss2.d_year = 1999 + and ss2.ca_county = ss3.ca_county + and ss3.d_qoy = 3 + and ss3.d_year = 1999 + and ss1.ca_county = ws1.ca_county + and ws1.d_qoy = 1 + and ws1.d_year = 1999 + and ws1.ca_county = ws2.ca_county + and ws2.d_qoy = 2 + and ws2.d_year = 1999 + and ws1.ca_county = ws3.ca_county + and ws3.d_qoy = 3 + and ws3.d_year =1999 + and case when ws1.web_sales > 0 then ws2.web_sales/ws1.web_sales else null end + > case when ss1.store_sales > 0 then ss2.store_sales/ss1.store_sales else null end + and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end + > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end + order by store_q2_q3_increase + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query32.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query32.groovy new file mode 100644 index 00000000000000..37185f3ed80424 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query32.groovy @@ -0,0 +1,95 @@ +/* + * 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("query32") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + multi_sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set enable_runtime_filter_prune=false; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=false; + set enable_stats=true; + set runtime_filter_type=8; + set broadcast_row_count_limit = 30000000; + set enable_nereids_timeout = false; + set enable_pipeline_engine = true; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set push_topn_to_agg = true; + set topn_opt_limit_threshold=1024; + """ + + def ds = """select sum(cs_ext_discount_amt) as "excess discount amount" +from + catalog_sales + ,item + ,date_dim +where +i_manufact_id = 722 +and i_item_sk = cs_item_sk +and d_date between '2001-03-09' and + (cast('2001-03-09' as date) + interval 90 day) +and d_date_sk = cs_sold_date_sk +and cs_ext_discount_amt + > ( + select + 1.3 * avg(cs_ext_discount_amt) + from + catalog_sales + ,date_dim + where + cs_item_sk = i_item_sk + and d_date between '2001-03-09' and + (cast('2001-03-09' as date) + interval 90 day) + and d_date_sk = cs_sold_date_sk + ) +limit 100""" + qt_ds_shape_32 ''' + explain shape plan + select sum(cs_ext_discount_amt) as "excess discount amount" +from + catalog_sales + ,item + ,date_dim +where +i_manufact_id = 722 +and i_item_sk = cs_item_sk +and d_date between '2001-03-09' and + (cast('2001-03-09' as date) + interval 90 day) +and d_date_sk = cs_sold_date_sk +and cs_ext_discount_amt + > ( + select + 1.3 * avg(cs_ext_discount_amt) + from + catalog_sales + ,date_dim + where + cs_item_sk = i_item_sk + and d_date between '2001-03-09' and + (cast('2001-03-09' as date) + interval 90 day) + and d_date_sk = cs_sold_date_sk + ) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query33.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query33.groovy new file mode 100644 index 00000000000000..96697c0d984595 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query33.groovy @@ -0,0 +1,186 @@ +/* + * 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("query33") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss as ( + select + i_manufact_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + cs as ( + select + i_manufact_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + ws as ( + select + i_manufact_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id) + select i_manufact_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_manufact_id + order by total_sales +limit 100""" + qt_ds_shape_33 ''' + explain shape plan + with ss as ( + select + i_manufact_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + cs as ( + select + i_manufact_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + ws as ( + select + i_manufact_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Books')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id) + select i_manufact_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_manufact_id + order by total_sales +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query34.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query34.groovy new file mode 100644 index 00000000000000..c222d6b0bece02 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query34.groovy @@ -0,0 +1,98 @@ +/* + * 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("query34") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) + and (household_demographics.hd_buy_potential = '1001-5000' or + household_demographics.hd_buy_potential = '0-500') + and household_demographics.hd_vehicle_count > 0 + and (case when household_demographics.hd_vehicle_count > 0 + then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count + else null + end) > 1.2 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dn,customer + where ss_customer_sk = c_customer_sk + and cnt between 15 and 20 + order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number""" + qt_ds_shape_34 ''' + explain shape plan + select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) + and (household_demographics.hd_buy_potential = '1001-5000' or + household_demographics.hd_buy_potential = '0-500') + and household_demographics.hd_vehicle_count > 0 + and (case when household_demographics.hd_vehicle_count > 0 + then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count + else null + end) > 1.2 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dn,customer + where ss_customer_sk = c_customer_sk + and cnt between 15 and 20 + order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query35.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query35.groovy new file mode 100644 index 00000000000000..f4bdeb2db8c61c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query35.groovy @@ -0,0 +1,152 @@ +/* + * 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("query35") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + count(*) cnt1, + avg(cd_dep_count), + stddev_samp(cd_dep_count), + sum(cd_dep_count), + cd_dep_employed_count, + count(*) cnt2, + avg(cd_dep_employed_count), + stddev_samp(cd_dep_employed_count), + sum(cd_dep_employed_count), + cd_dep_college_count, + count(*) cnt3, + avg(cd_dep_college_count), + stddev_samp(cd_dep_college_count), + sum(cd_dep_college_count) + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4)) + group by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + limit 100""" + qt_ds_shape_35 ''' + explain shape plan + select + ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + count(*) cnt1, + avg(cd_dep_count), + stddev_samp(cd_dep_count), + sum(cd_dep_count), + cd_dep_employed_count, + count(*) cnt2, + avg(cd_dep_employed_count), + stddev_samp(cd_dep_employed_count), + sum(cd_dep_employed_count), + cd_dep_college_count, + count(*) cnt3, + avg(cd_dep_college_count), + stddev_samp(cd_dep_college_count), + sum(cd_dep_college_count) + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4)) + group by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query36.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query36.groovy new file mode 100644 index 00000000000000..a1310d235ec796 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query36.groovy @@ -0,0 +1,96 @@ +/* + * 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("query36") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,item + ,store + where + d1.d_year = 2000 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and s_state in ('TN','TN','TN','TN', + 'TN','TN','TN','TN') + group by rollup(i_category,i_class) + order by + lochierarchy desc + ,case when lochierarchy = 0 then i_category end + ,rank_within_parent + limit 100""" + qt_ds_shape_36 ''' + explain shape plan + select + sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,item + ,store + where + d1.d_year = 2000 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and s_state in ('TN','TN','TN','TN', + 'TN','TN','TN','TN') + group by rollup(i_category,i_class) + order by + lochierarchy desc + ,case when lochierarchy = 0 then i_category end + ,rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query37.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query37.groovy new file mode 100644 index 00000000000000..5d48768e9b866b --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query37.groovy @@ -0,0 +1,70 @@ +/* + * 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("query37") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, catalog_sales + where i_current_price between 29 and 29 + 30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2002-03-29' as date) and (cast('2002-03-29' as date) + interval 60 day) + and i_manufact_id in (705,742,777,944) + and inv_quantity_on_hand between 100 and 500 + and cs_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100""" + qt_ds_shape_37 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, catalog_sales + where i_current_price between 29 and 29 + 30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2002-03-29' as date) and (cast('2002-03-29' as date) + interval 60 day) + and i_manufact_id in (705,742,777,944) + and inv_quantity_on_hand between 100 and 500 + and cs_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query38.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query38.groovy new file mode 100644 index 00000000000000..06e3857fb30f3f --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query38.groovy @@ -0,0 +1,85 @@ +/* + * 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("query38") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + multi_sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set enable_runtime_filter_prune=false; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=false; + set enable_stats=true; + set runtime_filter_type=8; + set broadcast_row_count_limit = 30000000; + set enable_nereids_timeout = false; + set enable_pipeline_engine = true; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set push_topn_to_agg = true; + set topn_opt_limit_threshold=1024; + """ + + def ds = """select count(*) from ( + select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 +) hot_cust +limit 100""" + qt_ds_shape_38 ''' + explain shape plan + select count(*) from ( + select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1189 and 1189 + 11 +) hot_cust +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query39.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query39.groovy new file mode 100644 index 00000000000000..a7e321c22656f8 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query39.groovy @@ -0,0 +1,90 @@ +/* + * 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("query39") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0 then null else stdev/mean end cov + from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean + from inventory + ,item + ,warehouse + ,date_dim + where inv_item_sk = i_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_year =2000 + group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo + where case mean when 0 then 0 else stdev/mean end > 1) +select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov + ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov +from inv inv1,inv inv2 +where inv1.i_item_sk = inv2.i_item_sk + and inv1.w_warehouse_sk = inv2.w_warehouse_sk + and inv1.d_moy=1 + and inv2.d_moy=1+1 +order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov + ,inv2.d_moy,inv2.mean, inv2.cov""" + qt_ds_shape_39 ''' + explain shape plan + with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0 then null else stdev/mean end cov + from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean + from inventory + ,item + ,warehouse + ,date_dim + where inv_item_sk = i_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_year =2000 + group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo + where case mean when 0 then 0 else stdev/mean end > 1) +select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov + ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov +from inv inv1,inv inv2 +where inv1.i_item_sk = inv2.i_item_sk + and inv1.w_warehouse_sk = inv2.w_warehouse_sk + and inv1.d_moy=1 + and inv2.d_moy=1+1 +order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov + ,inv2.d_moy,inv2.mean, inv2.cov + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query4.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query4.groovy new file mode 100644 index 00000000000000..f03af2536173de --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query4.groovy @@ -0,0 +1,268 @@ +/* + * 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("query4") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total + ,'c' sale_type + from customer + ,catalog_sales + ,date_dim + where c_customer_sk = cs_bill_customer_sk + and cs_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year +union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_c_firstyear + ,year_total t_c_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_c_secyear.customer_id + and t_s_firstyear.customer_id = t_c_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_c_firstyear.sale_type = 'c' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_c_secyear.sale_type = 'c' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1999 + and t_s_secyear.dyear = 1999+1 + and t_c_firstyear.dyear = 1999 + and t_c_secyear.dyear = 1999+1 + and t_w_firstyear.dyear = 1999 + and t_w_secyear.dyear = 1999+1 + and t_s_firstyear.year_total > 0 + and t_c_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100""" + qt_ds_shape_4 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total + ,'c' sale_type + from customer + ,catalog_sales + ,date_dim + where c_customer_sk = cs_bill_customer_sk + and cs_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year +union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_c_firstyear + ,year_total t_c_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_c_secyear.customer_id + and t_s_firstyear.customer_id = t_c_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_c_firstyear.sale_type = 'c' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_c_secyear.sale_type = 'c' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1999 + and t_s_secyear.dyear = 1999+1 + and t_c_firstyear.dyear = 1999 + and t_c_secyear.dyear = 1999+1 + and t_w_firstyear.dyear = 1999 + and t_w_secyear.dyear = 1999+1 + and t_s_firstyear.year_total > 0 + and t_c_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query40.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query40.groovy new file mode 100644 index 00000000000000..38cfafa6560581 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query40.groovy @@ -0,0 +1,92 @@ +/* + * 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("query40") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2001-05-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('2001-05-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after + from + catalog_sales left outer join catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,warehouse + ,item + ,date_dim + where + i_current_price between 0.99 and 1.49 + and i_item_sk = cs_item_sk + and cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and d_date between (cast ('2001-05-02' as date) - interval 30 day) + and (cast ('2001-05-02' as date) + interval 30 day) + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100""" + qt_ds_shape_40 ''' + explain shape plan + select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2001-05-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('2001-05-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after + from + catalog_sales left outer join catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,warehouse + ,item + ,date_dim + where + i_current_price between 0.99 and 1.49 + and i_item_sk = cs_item_sk + and cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and d_date between (cast ('2001-05-02' as date) - interval 30 day) + and (cast ('2001-05-02' as date) + interval 30 day) + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query41.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query41.groovy new file mode 100644 index 00000000000000..b9c4a9231e533c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query41.groovy @@ -0,0 +1,140 @@ +/* + * 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("query41") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select distinct(i_product_name) + from item i1 + where i_manufact_id between 704 and 704+40 + and (select count(*) as item_cnt + from item + where (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'forest' or i_color = 'lime') and + (i_units = 'Pallet' or i_units = 'Pound') and + (i_size = 'economy' or i_size = 'small') + ) or + (i_category = 'Women' and + (i_color = 'navy' or i_color = 'slate') and + (i_units = 'Gross' or i_units = 'Bunch') and + (i_size = 'extra large' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'powder' or i_color = 'sky') and + (i_units = 'Dozen' or i_units = 'Lb') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'maroon' or i_color = 'smoke') and + (i_units = 'Ounce' or i_units = 'Case') and + (i_size = 'economy' or i_size = 'small') + ))) or + (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'dark' or i_color = 'aquamarine') and + (i_units = 'Ton' or i_units = 'Tbl') and + (i_size = 'economy' or i_size = 'small') + ) or + (i_category = 'Women' and + (i_color = 'frosted' or i_color = 'plum') and + (i_units = 'Dram' or i_units = 'Box') and + (i_size = 'extra large' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'papaya' or i_color = 'peach') and + (i_units = 'Bundle' or i_units = 'Carton') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'firebrick' or i_color = 'sienna') and + (i_units = 'Cup' or i_units = 'Each') and + (i_size = 'economy' or i_size = 'small') + )))) > 0 + order by i_product_name + limit 100""" + qt_ds_shape_41 ''' + explain shape plan + select distinct(i_product_name) + from item i1 + where i_manufact_id between 704 and 704+40 + and (select count(*) as item_cnt + from item + where (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'forest' or i_color = 'lime') and + (i_units = 'Pallet' or i_units = 'Pound') and + (i_size = 'economy' or i_size = 'small') + ) or + (i_category = 'Women' and + (i_color = 'navy' or i_color = 'slate') and + (i_units = 'Gross' or i_units = 'Bunch') and + (i_size = 'extra large' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'powder' or i_color = 'sky') and + (i_units = 'Dozen' or i_units = 'Lb') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'maroon' or i_color = 'smoke') and + (i_units = 'Ounce' or i_units = 'Case') and + (i_size = 'economy' or i_size = 'small') + ))) or + (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'dark' or i_color = 'aquamarine') and + (i_units = 'Ton' or i_units = 'Tbl') and + (i_size = 'economy' or i_size = 'small') + ) or + (i_category = 'Women' and + (i_color = 'frosted' or i_color = 'plum') and + (i_units = 'Dram' or i_units = 'Box') and + (i_size = 'extra large' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'papaya' or i_color = 'peach') and + (i_units = 'Bundle' or i_units = 'Carton') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'firebrick' or i_color = 'sienna') and + (i_units = 'Cup' or i_units = 'Each') and + (i_size = 'economy' or i_size = 'small') + )))) > 0 + order by i_product_name + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query42.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query42.groovy new file mode 100644 index 00000000000000..e4f6a9da4b376a --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query42.groovy @@ -0,0 +1,80 @@ +/* + * 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("query42") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select dt.d_year + ,item.i_category_id + ,item.i_category + ,sum(ss_ext_sales_price) + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=11 + and dt.d_year=1998 + group by dt.d_year + ,item.i_category_id + ,item.i_category + order by sum(ss_ext_sales_price) desc,dt.d_year + ,item.i_category_id + ,item.i_category +limit 100 """ + qt_ds_shape_42 ''' + explain shape plan + select dt.d_year + ,item.i_category_id + ,item.i_category + ,sum(ss_ext_sales_price) + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=11 + and dt.d_year=1998 + group by dt.d_year + ,item.i_category_id + ,item.i_category + order by sum(ss_ext_sales_price) desc,dt.d_year + ,item.i_category_id + ,item.i_category +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query43.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query43.groovy new file mode 100644 index 00000000000000..e4231b09aa6738 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query43.groovy @@ -0,0 +1,74 @@ +/* + * 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("query43") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select s_store_name, s_store_id, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from date_dim, store_sales, store + where d_date_sk = ss_sold_date_sk and + s_store_sk = ss_store_sk and + s_gmt_offset = -5 and + d_year = 2000 + group by s_store_name, s_store_id + order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales + limit 100""" + qt_ds_shape_43 ''' + explain shape plan + select s_store_name, s_store_id, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from date_dim, store_sales, store + where d_date_sk = ss_sold_date_sk and + s_store_sk = ss_store_sk and + s_gmt_offset = -5 and + d_year = 2000 + group by s_store_name, s_store_id + order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query44.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query44.groovy new file mode 100644 index 00000000000000..fc972137d59b27 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query44.groovy @@ -0,0 +1,106 @@ +/* + * 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("query44") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing +from(select * + from (select item_sk,rank() over (order by rank_col asc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 4 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 4 + and ss_hdemo_sk is null + group by ss_store_sk))V1)V11 + where rnk < 11) asceding, + (select * + from (select item_sk,rank() over (order by rank_col desc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 4 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 4 + and ss_hdemo_sk is null + group by ss_store_sk))V2)V21 + where rnk < 11) descending, +item i1, +item i2 +where asceding.rnk = descending.rnk + and i1.i_item_sk=asceding.item_sk + and i2.i_item_sk=descending.item_sk +order by asceding.rnk +limit 100""" + qt_ds_shape_44 ''' + explain shape plan + select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing +from(select * + from (select item_sk,rank() over (order by rank_col asc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 4 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 4 + and ss_hdemo_sk is null + group by ss_store_sk))V1)V11 + where rnk < 11) asceding, + (select * + from (select item_sk,rank() over (order by rank_col desc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 4 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 4 + and ss_hdemo_sk is null + group by ss_store_sk))V2)V21 + where rnk < 11) descending, +item i1, +item i2 +where asceding.rnk = descending.rnk + and i1.i_item_sk=asceding.item_sk + and i2.i_item_sk=descending.item_sk +order by asceding.rnk +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query45.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query45.groovy new file mode 100644 index 00000000000000..ee73c4d7287a41 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query45.groovy @@ -0,0 +1,76 @@ +/* + * 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("query45") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select ca_zip, ca_city, sum(ws_sales_price) + from web_sales, customer, customer_address, date_dim, item + where ws_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ws_item_sk = i_item_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792') + or + i_item_id in (select i_item_id + from item + where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29) + ) + ) + and ws_sold_date_sk = d_date_sk + and d_qoy = 1 and d_year = 2000 + group by ca_zip, ca_city + order by ca_zip, ca_city + limit 100""" + qt_ds_shape_45 ''' + explain shape plan + select ca_zip, ca_city, sum(ws_sales_price) + from web_sales, customer, customer_address, date_dim, item + where ws_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ws_item_sk = i_item_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792') + or + i_item_id in (select i_item_id + from item + where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29) + ) + ) + and ws_sold_date_sk = d_date_sk + and d_qoy = 1 and d_year = 2000 + group by ca_zip, ca_city + order by ca_zip, ca_city + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query46.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query46.groovy new file mode 100644 index 00000000000000..dd33c8ae9192d7 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query46.groovy @@ -0,0 +1,106 @@ +/* + * 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("query46") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and (household_demographics.hd_dep_count = 8 or + household_demographics.hd_vehicle_count= 0) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_city in ('Midway','Fairview','Fairview','Midway','Fairview') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + limit 100""" + qt_ds_shape_46 ''' + explain shape plan + select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and (household_demographics.hd_dep_count = 8 or + household_demographics.hd_vehicle_count= 0) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_city in ('Midway','Fairview','Fairview','Midway','Fairview') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query47.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query47.groovy new file mode 100644 index 00000000000000..d523df26a65240 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query47.groovy @@ -0,0 +1,138 @@ +/* + * 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("query47") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with v1 as( + select i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, + s_store_name, s_company_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + s_store_name, s_company_name + order by d_year, d_moy) rn + from item, store_sales, date_dim, store + where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + ( + d_year = 2000 or + ( d_year = 2000-1 and d_moy =12) or + ( d_year = 2000+1 and d_moy =1) + ) + group by i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy), + v2 as( + select v1.s_store_name, v1.s_company_name + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1.s_store_name = v1_lag.s_store_name and + v1.s_store_name = v1_lead.s_store_name and + v1.s_company_name = v1_lag.s_company_name and + v1.s_company_name = v1_lead.s_company_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2000 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, nsum + limit 100""" + qt_ds_shape_47 ''' + explain shape plan + with v1 as( + select i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, + s_store_name, s_company_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + s_store_name, s_company_name + order by d_year, d_moy) rn + from item, store_sales, date_dim, store + where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + ( + d_year = 2000 or + ( d_year = 2000-1 and d_moy =12) or + ( d_year = 2000+1 and d_moy =1) + ) + group by i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy), + v2 as( + select v1.s_store_name, v1.s_company_name + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1.s_store_name = v1_lag.s_store_name and + v1.s_store_name = v1_lead.s_store_name and + v1.s_company_name = v1_lag.s_company_name and + v1.s_company_name = v1_lead.s_company_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2000 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, nsum + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query48.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query48.groovy new file mode 100644 index 00000000000000..3a2258662d5e48 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query48.groovy @@ -0,0 +1,170 @@ +/* + * 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("query48") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select sum (ss_quantity) + from store_sales, store, customer_demographics, customer_address, date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and + ( + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'S' + and + cd_education_status = 'Secondary' + and + ss_sales_price between 100.00 and 150.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'M' + and + cd_education_status = '2 yr Degree' + and + ss_sales_price between 50.00 and 100.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'D' + and + cd_education_status = 'Advanced Degree' + and + ss_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('ND', 'NY', 'SD') + and ss_net_profit between 0 and 2000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MD', 'GA', 'KS') + and ss_net_profit between 150 and 3000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('CO', 'MN', 'NC') + and ss_net_profit between 50 and 25000 + ) + ) +""" + qt_ds_shape_48 ''' + explain shape plan + select sum (ss_quantity) + from store_sales, store, customer_demographics, customer_address, date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and + ( + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'S' + and + cd_education_status = 'Secondary' + and + ss_sales_price between 100.00 and 150.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'M' + and + cd_education_status = '2 yr Degree' + and + ss_sales_price between 50.00 and 100.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'D' + and + cd_education_status = 'Advanced Degree' + and + ss_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('ND', 'NY', 'SD') + and ss_net_profit between 0 and 2000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MD', 'GA', 'KS') + and ss_net_profit between 150 and 3000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('CO', 'MN', 'NC') + and ss_net_profit between 50 and 25000 + ) + ) + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query49.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query49.groovy new file mode 100644 index 00000000000000..a250ee0abc49cc --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query49.groovy @@ -0,0 +1,294 @@ +/* + * 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("query49") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select channel, item, return_ratio, return_rank, currency_rank from + (select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + web_sales ws left outer join web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,date_dim + where + wr.wr_return_amt > 10000 + and ws.ws_net_profit > 1 + and ws.ws_net_paid > 0 + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + catalog_sales cs left outer join catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,date_dim + where + cr.cr_return_amount > 10000 + and cs.cs_net_profit > 1 + and cs.cs_net_paid > 0 + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + store_sales sts left outer join store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,date_dim + where + sr.sr_return_amt > 10000 + and sts.ss_net_profit > 1 + and sts.ss_net_paid > 0 + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + ) + t order by 1,4,5,2 + limit 100""" + qt_ds_shape_49 ''' + explain shape plan + select channel, item, return_ratio, return_rank, currency_rank from + (select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + web_sales ws left outer join web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,date_dim + where + wr.wr_return_amt > 10000 + and ws.ws_net_profit > 1 + and ws.ws_net_paid > 0 + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + catalog_sales cs left outer join catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,date_dim + where + cr.cr_return_amount > 10000 + and cs.cs_net_profit > 1 + and cs.cs_net_paid > 0 + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + store_sales sts left outer join store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,date_dim + where + sr.sr_return_amt > 10000 + and sts.ss_net_profit > 1 + and sts.ss_net_paid > 0 + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 11 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + ) + t order by 1,4,5,2 + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query5.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query5.groovy new file mode 100644 index 00000000000000..1b549f2707ae23 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query5.groovy @@ -0,0 +1,292 @@ +/* + * 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("query5") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from store_returns + ) salesreturns, + date_dim, + store + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from catalog_returns + ) salesreturns, + date_dim, + catalog_page + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from web_returns left outer join web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + date_dim, + web_site + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and wsr_web_site_sk = web_site_sk + group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', s_store_id) id + , sales + , returns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', cp_catalog_page_id) id + , sales + , returns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) id + , sales + , returns + , (profit - profit_loss) as profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100""" + qt_ds_shape_5 ''' + explain shape plan + with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from store_returns + ) salesreturns, + date_dim, + store + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from catalog_returns + ) salesreturns, + date_dim, + catalog_page + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from web_returns left outer join web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + date_dim, + web_site + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and wsr_web_site_sk = web_site_sk + group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', s_store_id) id + , sales + , returns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', cp_catalog_page_id) id + , sales + , returns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) id + , sales + , returns + , (profit - profit_loss) as profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query50.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query50.groovy new file mode 100644 index 00000000000000..8ccc569590b75f --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query50.groovy @@ -0,0 +1,154 @@ +/* + * 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("query50") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and + (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and + (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and + (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + store_sales + ,store_returns + ,store + ,date_dim d1 + ,date_dim d2 +where + d2.d_year = 2001 +and d2.d_moy = 8 +and ss_ticket_number = sr_ticket_number +and ss_item_sk = sr_item_sk +and ss_sold_date_sk = d1.d_date_sk +and sr_returned_date_sk = d2.d_date_sk +and ss_customer_sk = sr_customer_sk +and ss_store_sk = s_store_sk +group by + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +order by s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +limit 100""" + qt_ds_shape_50 ''' + explain shape plan + select + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and + (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and + (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and + (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + store_sales + ,store_returns + ,store + ,date_dim d1 + ,date_dim d2 +where + d2.d_year = 2001 +and d2.d_moy = 8 +and ss_ticket_number = sr_ticket_number +and ss_item_sk = sr_item_sk +and ss_sold_date_sk = d1.d_date_sk +and sr_returned_date_sk = d2.d_date_sk +and ss_customer_sk = sr_customer_sk +and ss_store_sk = s_store_sk +group by + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +order by s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query51.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query51.groovy new file mode 100644 index 00000000000000..a98b98ec910062 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query51.groovy @@ -0,0 +1,126 @@ +/* + * 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("query51") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """WITH web_v1 as ( +select + ws_item_sk item_sk, d_date, + sum(sum(ws_sales_price)) + over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from web_sales + ,date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+11 + and ws_item_sk is not NULL +group by ws_item_sk, d_date), +store_v1 as ( +select + ss_item_sk item_sk, d_date, + sum(sum(ss_sales_price)) + over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from store_sales + ,date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+11 + and ss_item_sk is not NULL +group by ss_item_sk, d_date) + select * +from (select item_sk + ,d_date + ,web_sales + ,store_sales + ,max(web_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative + ,max(store_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative + from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk + ,case when web.d_date is not null then web.d_date else store.d_date end d_date + ,web.cume_sales web_sales + ,store.cume_sales store_sales + from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk + and web.d_date = store.d_date) + )x )y +where web_cumulative > store_cumulative +order by item_sk + ,d_date +limit 100""" + qt_ds_shape_51 ''' + explain shape plan + WITH web_v1 as ( +select + ws_item_sk item_sk, d_date, + sum(sum(ws_sales_price)) + over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from web_sales + ,date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+11 + and ws_item_sk is not NULL +group by ws_item_sk, d_date), +store_v1 as ( +select + ss_item_sk item_sk, d_date, + sum(sum(ss_sales_price)) + over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from store_sales + ,date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+11 + and ss_item_sk is not NULL +group by ss_item_sk, d_date) + select * +from (select item_sk + ,d_date + ,web_sales + ,store_sales + ,max(web_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative + ,max(store_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative + from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk + ,case when web.d_date is not null then web.d_date else store.d_date end d_date + ,web.cume_sales web_sales + ,store.cume_sales store_sales + from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk + and web.d_date = store.d_date) + )x )y +where web_cumulative > store_cumulative +order by item_sk + ,d_date +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query52.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query52.groovy new file mode 100644 index 00000000000000..880f3afd167272 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query52.groovy @@ -0,0 +1,80 @@ +/* + * 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("query52") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=2000 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 """ + qt_ds_shape_52 ''' + explain shape plan + select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=2000 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query53.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query53.groovy new file mode 100644 index 00000000000000..42e7a3474ba745 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query53.groovy @@ -0,0 +1,92 @@ +/* + * 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("query53") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * from +(select i_manufact_id, +sum(ss_sales_price) sum_sales, +avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and +ss_sold_date_sk = d_date_sk and +ss_store_sk = s_store_sk and +d_month_seq in (1186,1186+1,1186+2,1186+3,1186+4,1186+5,1186+6,1186+7,1186+8,1186+9,1186+10,1186+11) and +((i_category in ('Books','Children','Electronics') and +i_class in ('personal','portable','reference','self-help') and +i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) +or(i_category in ('Women','Music','Men') and +i_class in ('accessories','classical','fragrances','pants') and +i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manufact_id, d_qoy ) tmp1 +where case when avg_quarterly_sales > 0 + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null end > 0.1 +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100""" + qt_ds_shape_53 ''' + explain shape plan + select * from +(select i_manufact_id, +sum(ss_sales_price) sum_sales, +avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and +ss_sold_date_sk = d_date_sk and +ss_store_sk = s_store_sk and +d_month_seq in (1186,1186+1,1186+2,1186+3,1186+4,1186+5,1186+6,1186+7,1186+8,1186+9,1186+10,1186+11) and +((i_category in ('Books','Children','Electronics') and +i_class in ('personal','portable','reference','self-help') and +i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) +or(i_category in ('Women','Music','Men') and +i_class in ('accessories','classical','fragrances','pants') and +i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manufact_id, d_qoy ) tmp1 +where case when avg_quarterly_sales > 0 + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null end > 0.1 +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query54.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query54.groovy new file mode 100644 index 00000000000000..ce8295e9299723 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query54.groovy @@ -0,0 +1,148 @@ +/* + * 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("query54") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=12' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Music' + and i_class = 'country' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 1 + and d_year = 1999 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 1999 and d_moy = 1) + and (select distinct d_month_seq+3 + from date_dim where d_year = 1999 and d_moy = 1) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100""" + qt_ds_shape_54 ''' + explain shape plan + with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Music' + and i_class = 'country' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 1 + and d_year = 1999 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 1999 and d_moy = 1) + and (select distinct d_month_seq+3 + from date_dim where d_year = 1999 and d_moy = 1) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query55.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query55.groovy new file mode 100644 index 00000000000000..70fe7265786519 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query55.groovy @@ -0,0 +1,64 @@ +/* + * 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("query55") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=52 + and d_moy=11 + and d_year=2000 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 """ + qt_ds_shape_55 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=52 + and d_moy=11 + and d_year=2000 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query56.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query56.groovy new file mode 100644 index 00000000000000..2aaceceedb6e45 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query56.groovy @@ -0,0 +1,174 @@ +/* + * 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("query56") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales, + i_item_id + limit 100""" + qt_ds_shape_56 ''' + explain shape plan + with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','orchid','pink')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales, + i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query57.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query57.groovy new file mode 100644 index 00000000000000..47ca56f0650d3a --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query57.groovy @@ -0,0 +1,132 @@ +/* + * 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("query57") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with v1 as( + select i_category, i_brand, + cc_name, + d_year, d_moy, + sum(cs_sales_price) sum_sales, + avg(sum(cs_sales_price)) over + (partition by i_category, i_brand, + cc_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + cc_name + order by d_year, d_moy) rn + from item, catalog_sales, date_dim, call_center + where cs_item_sk = i_item_sk and + cs_sold_date_sk = d_date_sk and + cc_call_center_sk= cs_call_center_sk and + ( + d_year = 2001 or + ( d_year = 2001-1 and d_moy =12) or + ( d_year = 2001+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.i_category, v1.i_brand, v1.cc_name + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1. cc_name = v1_lag. cc_name and + v1. cc_name = v1_lead. cc_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2001 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, avg_monthly_sales + limit 100""" + qt_ds_shape_57 ''' + explain shape plan + with v1 as( + select i_category, i_brand, + cc_name, + d_year, d_moy, + sum(cs_sales_price) sum_sales, + avg(sum(cs_sales_price)) over + (partition by i_category, i_brand, + cc_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + cc_name + order by d_year, d_moy) rn + from item, catalog_sales, date_dim, call_center + where cs_item_sk = i_item_sk and + cs_sold_date_sk = d_date_sk and + cc_call_center_sk= cs_call_center_sk and + ( + d_year = 2001 or + ( d_year = 2001-1 and d_moy =12) or + ( d_year = 2001+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.i_category, v1.i_brand, v1.cc_name + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1. cc_name = v1_lag. cc_name and + v1. cc_name = v1_lead. cc_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2001 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, avg_monthly_sales + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query58.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query58.groovy new file mode 100644 index 00000000000000..0cb76fca23534c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query58.groovy @@ -0,0 +1,166 @@ +/* + * 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("query58") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from store_sales + ,item + ,date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from web_sales + ,item + ,date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq =(select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + order by item_id + ,ss_item_rev + limit 100""" + qt_ds_shape_58 ''' + explain shape plan + with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from store_sales + ,item + ,date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from web_sales + ,item + ,date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq =(select d_week_seq + from date_dim + where d_date = '2001-06-16')) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + order by item_id + ,ss_item_rev + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query59.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query59.groovy new file mode 100644 index 00000000000000..3b3ecfd9068fcc --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query59.groovy @@ -0,0 +1,124 @@ +/* + * 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("query59") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + wss.ss_store_sk = s_store_sk and + d_month_seq between 1195 and 1195 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + wss.ss_store_sk = s_store_sk and + d_month_seq between 1195+ 12 and 1195 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100""" + qt_ds_shape_59 ''' + explain shape plan + with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + wss.ss_store_sk = s_store_sk and + d_month_seq between 1195 and 1195 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + wss.ss_store_sk = s_store_sk and + d_month_seq between 1195+ 12 and 1195 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query6.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query6.groovy new file mode 100644 index 00000000000000..b1a51aa274d4f5 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query6.groovy @@ -0,0 +1,88 @@ +/* + * 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("query6") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select a.ca_state state, count(*) cnt + from customer_address a + ,customer c + ,store_sales s + ,date_dim d + ,item i + where a.ca_address_sk = c.c_current_addr_sk + and c.c_customer_sk = s.ss_customer_sk + and s.ss_sold_date_sk = d.d_date_sk + and s.ss_item_sk = i.i_item_sk + and d.d_month_seq = + (select distinct (d_month_seq) + from date_dim + where d_year = 2002 + and d_moy = 3 ) + and i.i_current_price > 1.2 * + (select avg(j.i_current_price) + from item j + where j.i_category = i.i_category) + group by a.ca_state + having count(*) >= 10 + order by cnt, a.ca_state + limit 100""" + qt_ds_shape_6 ''' + explain shape plan + select a.ca_state state, count(*) cnt + from customer_address a + ,customer c + ,store_sales s + ,date_dim d + ,item i + where a.ca_address_sk = c.c_current_addr_sk + and c.c_customer_sk = s.ss_customer_sk + and s.ss_sold_date_sk = d.d_date_sk + and s.ss_item_sk = i.i_item_sk + and d.d_month_seq = + (select distinct (d_month_seq) + from date_dim + where d_year = 2002 + and d_moy = 3 ) + and i.i_current_price > 1.2 * + (select avg(j.i_current_price) + from item j + where j.i_category = i.i_category) + group by a.ca_state + having count(*) >= 10 + order by cnt, a.ca_state + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query60.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query60.groovy new file mode 100644 index 00000000000000..f323b96ed5683a --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query60.groovy @@ -0,0 +1,192 @@ +/* + * 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("query60") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100""" + qt_ds_shape_60 ''' + explain shape plan + with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Jewelry')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 10 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query61.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query61.groovy new file mode 100644 index 00000000000000..de78bd3fe46242 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query61.groovy @@ -0,0 +1,124 @@ +/* + * 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("query61") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Home' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7 + and d_year = 2000 + and d_moy = 12) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Home' + and s_gmt_offset = -7 + and d_year = 2000 + and d_moy = 12) all_sales +order by promotions, total +limit 100""" + qt_ds_shape_61 ''' + explain shape plan + select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Home' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7 + and d_year = 2000 + and d_moy = 12) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Home' + and s_gmt_offset = -7 + and d_year = 2000 + and d_moy = 12) all_sales +order by promotions, total +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query62.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query62.groovy new file mode 100644 index 00000000000000..de6a1615115134 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query62.groovy @@ -0,0 +1,106 @@ +/* + * 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("query62") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and + (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and + (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and + (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + web_sales + ,warehouse + ,ship_mode + ,web_site + ,date_dim +where + d_month_seq between 1223 and 1223 + 11 +and ws_ship_date_sk = d_date_sk +and ws_warehouse_sk = w_warehouse_sk +and ws_ship_mode_sk = sm_ship_mode_sk +and ws_web_site_sk = web_site_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +limit 100""" + qt_ds_shape_62 ''' + explain shape plan + select + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and + (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and + (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and + (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + web_sales + ,warehouse + ,ship_mode + ,web_site + ,date_dim +where + d_month_seq between 1223 and 1223 + 11 +and ws_ship_date_sk = d_date_sk +and ws_warehouse_sk = w_warehouse_sk +and ws_ship_mode_sk = sm_ship_mode_sk +and ws_web_site_sk = web_site_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query63.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query63.groovy new file mode 100644 index 00000000000000..34b10eaefd827a --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query63.groovy @@ -0,0 +1,94 @@ +/* + * 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("query63") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * +from (select i_manager_id + ,sum(ss_sales_price) sum_sales + ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales + from item + ,store_sales + ,date_dim + ,store + where ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and d_month_seq in (1222,1222+1,1222+2,1222+3,1222+4,1222+5,1222+6,1222+7,1222+8,1222+9,1222+10,1222+11) + and (( i_category in ('Books','Children','Electronics') + and i_class in ('personal','portable','reference','self-help') + and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) + or( i_category in ('Women','Music','Men') + and i_class in ('accessories','classical','fragrances','pants') + and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manager_id, d_moy) tmp1 +where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100""" + qt_ds_shape_63 ''' + explain shape plan + select * +from (select i_manager_id + ,sum(ss_sales_price) sum_sales + ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales + from item + ,store_sales + ,date_dim + ,store + where ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and d_month_seq in (1222,1222+1,1222+2,1222+3,1222+4,1222+5,1222+6,1222+7,1222+8,1222+9,1222+10,1222+11) + and (( i_category in ('Books','Children','Electronics') + and i_class in ('personal','portable','reference','self-help') + and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) + or( i_category in ('Women','Music','Men') + and i_class in ('accessories','classical','fragrances','pants') + and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manager_id, d_moy) tmp1 +where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query64.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query64.groovy new file mode 100644 index 00000000000000..ef89e0bd0a7bc5 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query64.groovy @@ -0,0 +1,279 @@ +/* + * 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("query64") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + sql "set memo_max_group_expression_size = 1000000" + + def ds = """with cs_ui as + (select cs_item_sk + ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund + from catalog_sales + ,catalog_returns + where cs_item_sk = cr_item_sk + and cs_order_number = cr_order_number + group by cs_item_sk + having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +cross_sales as + (select i_product_name product_name + ,i_item_sk item_sk + ,s_store_name store_name + ,s_zip store_zip + ,ad1.ca_street_number b_street_number + ,ad1.ca_street_name b_street_name + ,ad1.ca_city b_city + ,ad1.ca_zip b_zip + ,ad2.ca_street_number c_street_number + ,ad2.ca_street_name c_street_name + ,ad2.ca_city c_city + ,ad2.ca_zip c_zip + ,d1.d_year as syear + ,d2.d_year as fsyear + ,d3.d_year s2year + ,count(*) cnt + ,sum(ss_wholesale_cost) s1 + ,sum(ss_list_price) s2 + ,sum(ss_coupon_amt) s3 + FROM store_sales + ,store_returns + ,cs_ui + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,customer + ,customer_demographics cd1 + ,customer_demographics cd2 + ,promotion + ,household_demographics hd1 + ,household_demographics hd2 + ,customer_address ad1 + ,customer_address ad2 + ,income_band ib1 + ,income_band ib2 + ,item + WHERE ss_store_sk = s_store_sk AND + ss_sold_date_sk = d1.d_date_sk AND + ss_customer_sk = c_customer_sk AND + ss_cdemo_sk= cd1.cd_demo_sk AND + ss_hdemo_sk = hd1.hd_demo_sk AND + ss_addr_sk = ad1.ca_address_sk and + ss_item_sk = i_item_sk and + ss_item_sk = sr_item_sk and + ss_ticket_number = sr_ticket_number and + ss_item_sk = cs_ui.cs_item_sk and + c_current_cdemo_sk = cd2.cd_demo_sk AND + c_current_hdemo_sk = hd2.hd_demo_sk AND + c_current_addr_sk = ad2.ca_address_sk and + c_first_sales_date_sk = d2.d_date_sk and + c_first_shipto_date_sk = d3.d_date_sk and + ss_promo_sk = p_promo_sk and + hd1.hd_income_band_sk = ib1.ib_income_band_sk and + hd2.hd_income_band_sk = ib2.ib_income_band_sk and + cd1.cd_marital_status <> cd2.cd_marital_status and + i_color in ('orange','lace','lawn','misty','blush','pink') and + i_current_price between 48 and 48 + 10 and + i_current_price between 48 + 1 and 48 + 15 +group by i_product_name + ,i_item_sk + ,s_store_name + ,s_zip + ,ad1.ca_street_number + ,ad1.ca_street_name + ,ad1.ca_city + ,ad1.ca_zip + ,ad2.ca_street_number + ,ad2.ca_street_name + ,ad2.ca_city + ,ad2.ca_zip + ,d1.d_year + ,d2.d_year + ,d3.d_year +) +select cs1.product_name + ,cs1.store_name + ,cs1.store_zip + ,cs1.b_street_number + ,cs1.b_street_name + ,cs1.b_city + ,cs1.b_zip + ,cs1.c_street_number + ,cs1.c_street_name + ,cs1.c_city + ,cs1.c_zip + ,cs1.syear + ,cs1.cnt + ,cs1.s1 as s11 + ,cs1.s2 as s21 + ,cs1.s3 as s31 + ,cs2.s1 as s12 + ,cs2.s2 as s22 + ,cs2.s3 as s32 + ,cs2.syear + ,cs2.cnt +from cross_sales cs1,cross_sales cs2 +where cs1.item_sk=cs2.item_sk and + cs1.syear = 1999 and + cs2.syear = 1999 + 1 and + cs2.cnt <= cs1.cnt and + cs1.store_name = cs2.store_name and + cs1.store_zip = cs2.store_zip +order by cs1.product_name + ,cs1.store_name + ,cs2.cnt + ,cs1.s1 + ,cs2.s1""" +// qt_ds_shape_64 ''' +// explain shape plan +// with cs_ui as +// (select cs_item_sk +// ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund +// from catalog_sales +// ,catalog_returns +// where cs_item_sk = cr_item_sk +// and cs_order_number = cr_order_number +// group by cs_item_sk +// having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +// cross_sales as +// (select i_product_name product_name +// ,i_item_sk item_sk +// ,s_store_name store_name +// ,s_zip store_zip +// ,ad1.ca_street_number b_street_number +// ,ad1.ca_street_name b_street_name +// ,ad1.ca_city b_city +// ,ad1.ca_zip b_zip +// ,ad2.ca_street_number c_street_number +// ,ad2.ca_street_name c_street_name +// ,ad2.ca_city c_city +// ,ad2.ca_zip c_zip +// ,d1.d_year as syear +// ,d2.d_year as fsyear +// ,d3.d_year s2year +// ,count(*) cnt +// ,sum(ss_wholesale_cost) s1 +// ,sum(ss_list_price) s2 +// ,sum(ss_coupon_amt) s3 +// FROM store_sales +// ,store_returns +// ,cs_ui +// ,date_dim d1 +// ,date_dim d2 +// ,date_dim d3 +// ,store +// ,customer +// ,customer_demographics cd1 +// ,customer_demographics cd2 +// ,promotion +// ,household_demographics hd1 +// ,household_demographics hd2 +// ,customer_address ad1 +// ,customer_address ad2 +// ,income_band ib1 +// ,income_band ib2 +// ,item +// WHERE ss_store_sk = s_store_sk AND +// ss_sold_date_sk = d1.d_date_sk AND +// ss_customer_sk = c_customer_sk AND +// ss_cdemo_sk= cd1.cd_demo_sk AND +// ss_hdemo_sk = hd1.hd_demo_sk AND +// ss_addr_sk = ad1.ca_address_sk and +// ss_item_sk = i_item_sk and +// ss_item_sk = sr_item_sk and +// ss_ticket_number = sr_ticket_number and +// ss_item_sk = cs_ui.cs_item_sk and +// c_current_cdemo_sk = cd2.cd_demo_sk AND +// c_current_hdemo_sk = hd2.hd_demo_sk AND +// c_current_addr_sk = ad2.ca_address_sk and +// c_first_sales_date_sk = d2.d_date_sk and +// c_first_shipto_date_sk = d3.d_date_sk and +// ss_promo_sk = p_promo_sk and +// hd1.hd_income_band_sk = ib1.ib_income_band_sk and +// hd2.hd_income_band_sk = ib2.ib_income_band_sk and +// cd1.cd_marital_status <> cd2.cd_marital_status and +// i_color in ('orange','lace','lawn','misty','blush','pink') and +// i_current_price between 48 and 48 + 10 and +// i_current_price between 48 + 1 and 48 + 15 +// group by i_product_name +// ,i_item_sk +// ,s_store_name +// ,s_zip +// ,ad1.ca_street_number +// ,ad1.ca_street_name +// ,ad1.ca_city +// ,ad1.ca_zip +// ,ad2.ca_street_number +// ,ad2.ca_street_name +// ,ad2.ca_city +// ,ad2.ca_zip +// ,d1.d_year +// ,d2.d_year +// ,d3.d_year +// ) +// select cs1.product_name +// ,cs1.store_name +// ,cs1.store_zip +// ,cs1.b_street_number +// ,cs1.b_street_name +// ,cs1.b_city +// ,cs1.b_zip +// ,cs1.c_street_number +// ,cs1.c_street_name +// ,cs1.c_city +// ,cs1.c_zip +// ,cs1.syear +// ,cs1.cnt +// ,cs1.s1 as s11 +// ,cs1.s2 as s21 +// ,cs1.s3 as s31 +// ,cs2.s1 as s12 +// ,cs2.s2 as s22 +// ,cs2.s3 as s32 +// ,cs2.syear +// ,cs2.cnt +// from cross_sales cs1,cross_sales cs2 +// where cs1.item_sk=cs2.item_sk and +// cs1.syear = 1999 and +// cs2.syear = 1999 + 1 and +// cs2.cnt <= cs1.cnt and +// cs1.store_name = cs2.store_name and +// cs1.store_zip = cs2.store_zip +// order by cs1.product_name +// ,cs1.store_name +// ,cs2.cnt +// ,cs1.s1 +// ,cs2.s1 +// ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query65.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query65.groovy new file mode 100644 index 00000000000000..4aeb9cb88d9c5d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query65.groovy @@ -0,0 +1,94 @@ +/* + * 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("query65") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from store, item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sa + group by ss_store_sk) sb, + (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1 * sb.ave and + s_store_sk = sc.ss_store_sk and + i_item_sk = sc.ss_item_sk + order by s_store_name, i_item_desc +limit 100""" + qt_ds_shape_65 ''' + explain shape plan + select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from store, item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sa + group by ss_store_sk) sb, + (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1 * sb.ave and + s_store_sk = sc.ss_store_sk and + i_item_sk = sc.ss_item_sk + order by s_store_name, i_item_desc +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query66.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query66.groovy new file mode 100644 index 00000000000000..3ed91231c6c2a5 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query66.groovy @@ -0,0 +1,476 @@ +/* + * 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("query66") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('ORIENTAL ', ','), ' BOXBUNDLES') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_ext_sales_price* ws_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then ws_ext_sales_price* ws_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then ws_ext_sales_price* ws_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then ws_ext_sales_price* ws_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then ws_ext_sales_price* ws_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then ws_ext_sales_price* ws_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then ws_ext_sales_price* ws_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then ws_ext_sales_price* ws_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then ws_ext_sales_price* ws_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then ws_ext_sales_price* ws_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then ws_ext_sales_price* ws_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then ws_ext_sales_price* ws_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as dec_net + from + web_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 42970 and 42970+28800 + and sm_carrier in ('ORIENTAL','BOXBUNDLES') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('ORIENTAL ', ','), ' BOXBUNDLES') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_list_price* cs_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_list_price* cs_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_list_price* cs_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_list_price* cs_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_list_price* cs_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_list_price* cs_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_list_price* cs_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_list_price* cs_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_list_price* cs_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_list_price* cs_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_list_price* cs_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_list_price* cs_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid * cs_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid * cs_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid * cs_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid * cs_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid * cs_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid * cs_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid * cs_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid * cs_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid * cs_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid * cs_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid * cs_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid * cs_quantity else 0 end) as dec_net + from + catalog_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 42970 AND 42970+28800 + and sm_carrier in ('ORIENTAL','BOXBUNDLES') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100""" + qt_ds_shape_66 ''' + explain shape plan + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('ORIENTAL ', ','), ' BOXBUNDLES') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_ext_sales_price* ws_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then ws_ext_sales_price* ws_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then ws_ext_sales_price* ws_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then ws_ext_sales_price* ws_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then ws_ext_sales_price* ws_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then ws_ext_sales_price* ws_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then ws_ext_sales_price* ws_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then ws_ext_sales_price* ws_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then ws_ext_sales_price* ws_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then ws_ext_sales_price* ws_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then ws_ext_sales_price* ws_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then ws_ext_sales_price* ws_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_ship * ws_quantity else 0 end) as dec_net + from + web_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 42970 and 42970+28800 + and sm_carrier in ('ORIENTAL','BOXBUNDLES') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('ORIENTAL ', ','), ' BOXBUNDLES') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_list_price* cs_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_list_price* cs_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_list_price* cs_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_list_price* cs_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_list_price* cs_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_list_price* cs_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_list_price* cs_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_list_price* cs_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_list_price* cs_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_list_price* cs_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_list_price* cs_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_list_price* cs_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid * cs_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid * cs_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid * cs_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid * cs_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid * cs_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid * cs_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid * cs_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid * cs_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid * cs_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid * cs_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid * cs_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid * cs_quantity else 0 end) as dec_net + from + catalog_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 42970 AND 42970+28800 + and sm_carrier in ('ORIENTAL','BOXBUNDLES') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query67.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query67.groovy new file mode 100644 index 00000000000000..dd7d2c1bfec035 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query67.groovy @@ -0,0 +1,124 @@ +/* + * 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("query67") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * +from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rank() over (partition by i_category order by sumsales desc) rk + from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sum(coalesce(ss_sales_price*ss_quantity,0)) sumsales + from store_sales + ,date_dim + ,store + ,item + where ss_sold_date_sk=d_date_sk + and ss_item_sk=i_item_sk + and ss_store_sk = s_store_sk + and d_month_seq between 1217 and 1217+11 + group by rollup(i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy,s_store_id))dw1) dw2 +where rk <= 100 +order by i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rk +limit 100""" + qt_ds_shape_67 ''' + explain shape plan + select * +from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rank() over (partition by i_category order by sumsales desc) rk + from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sum(coalesce(ss_sales_price*ss_quantity,0)) sumsales + from store_sales + ,date_dim + ,store + ,item + where ss_sold_date_sk=d_date_sk + and ss_item_sk=i_item_sk + and ss_store_sk = s_store_sk + and d_month_seq between 1217 and 1217+11 + group by rollup(i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy,s_store_id))dw1) dw2 +where rk <= 100 +order by i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rk +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query68.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query68.groovy new file mode 100644 index 00000000000000..6e721e5eabf45d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query68.groovy @@ -0,0 +1,120 @@ +/* + * 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("query68") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,extended_price + ,extended_tax + ,list_price + from (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_ext_sales_price) extended_price + ,sum(ss_ext_list_price) list_price + ,sum(ss_ext_tax) extended_tax + from store_sales + ,date_dim + ,store + ,household_demographics + ,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_dep_count = 3 or + household_demographics.hd_vehicle_count= 4) + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_city in ('Fairview','Midway') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,customer + ,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,ss_ticket_number + limit 100""" + qt_ds_shape_68 ''' + explain shape plan + select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,extended_price + ,extended_tax + ,list_price + from (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_ext_sales_price) extended_price + ,sum(ss_ext_list_price) list_price + ,sum(ss_ext_tax) extended_tax + from store_sales + ,date_dim + ,store + ,household_demographics + ,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_dep_count = 3 or + household_demographics.hd_vehicle_count= 4) + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_city in ('Fairview','Midway') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,customer + ,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,ss_ticket_number + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query69.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query69.groovy new file mode 100644 index 00000000000000..dafcb98e9265aa --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query69.groovy @@ -0,0 +1,130 @@ +/* + * 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("query69") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('IL','TX','ME') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2) and + (not exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2) and + not exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + limit 100""" + qt_ds_shape_69 ''' + explain shape plan + select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('IL','TX','ME') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2) and + (not exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2) and + not exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 1 and 1+2)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query7.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query7.groovy new file mode 100644 index 00000000000000..af7f9913c68037 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query7.groovy @@ -0,0 +1,78 @@ +/* + * 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("query7") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, item, promotion + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_cdemo_sk = cd_demo_sk and + ss_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'College' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2001 + group by i_item_id + order by i_item_id + limit 100""" + qt_ds_shape_7 ''' + explain shape plan + select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, item, promotion + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_cdemo_sk = cd_demo_sk and + ss_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'College' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2001 + group by i_item_id + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query70.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query70.groovy new file mode 100644 index 00000000000000..beab5d0277e690 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query70.groovy @@ -0,0 +1,112 @@ +/* + * 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("query70") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + sum(ss_net_profit) as total_sum + ,s_state + ,s_county + ,grouping(s_state)+grouping(s_county) as lochierarchy + ,rank() over ( + partition by grouping(s_state)+grouping(s_county), + case when grouping(s_county) = 0 then s_state end + order by sum(ss_net_profit) desc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,store + where + d1.d_month_seq between 1220 and 1220+11 + and d1.d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + and s_state in + ( select s_state + from (select s_state as s_state, + rank() over ( partition by s_state order by sum(ss_net_profit) desc) as ranking + from store_sales, store, date_dim + where d_month_seq between 1220 and 1220+11 + and d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + group by s_state + ) tmp1 + where ranking <= 5 + ) + group by rollup(s_state,s_county) + order by + lochierarchy desc + ,case when lochierarchy = 0 then s_state end + ,rank_within_parent + limit 100""" + qt_ds_shape_70 ''' + explain shape plan + select + sum(ss_net_profit) as total_sum + ,s_state + ,s_county + ,grouping(s_state)+grouping(s_county) as lochierarchy + ,rank() over ( + partition by grouping(s_state)+grouping(s_county), + case when grouping(s_county) = 0 then s_state end + order by sum(ss_net_profit) desc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,store + where + d1.d_month_seq between 1220 and 1220+11 + and d1.d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + and s_state in + ( select s_state + from (select s_state as s_state, + rank() over ( partition by s_state order by sum(ss_net_profit) desc) as ranking + from store_sales, store, date_dim + where d_month_seq between 1220 and 1220+11 + and d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + group by s_state + ) tmp1 + where ranking <= 5 + ) + group by rollup(s_state,s_county) + order by + lochierarchy desc + ,case when lochierarchy = 0 then s_state end + ,rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query71.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query71.groovy new file mode 100644 index 00000000000000..d52f597c6b258d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query71.groovy @@ -0,0 +1,116 @@ +/* + * 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("query71") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from item, (select ws_ext_sales_price as ext_price, + ws_sold_date_sk as sold_date_sk, + ws_item_sk as sold_item_sk, + ws_sold_time_sk as time_sk + from web_sales,date_dim + where d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=2002 + union all + select cs_ext_sales_price as ext_price, + cs_sold_date_sk as sold_date_sk, + cs_item_sk as sold_item_sk, + cs_sold_time_sk as time_sk + from catalog_sales,date_dim + where d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=2002 + union all + select ss_ext_sales_price as ext_price, + ss_sold_date_sk as sold_date_sk, + ss_item_sk as sold_item_sk, + ss_sold_time_sk as time_sk + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=2002 + ) tmp,time_dim + where + sold_item_sk = i_item_sk + and i_manager_id=1 + and time_sk = t_time_sk + and (t_meal_time = 'breakfast' or t_meal_time = 'dinner') + group by i_brand, i_brand_id,t_hour,t_minute + order by ext_price desc, i_brand_id + """ + qt_ds_shape_71 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from item, (select ws_ext_sales_price as ext_price, + ws_sold_date_sk as sold_date_sk, + ws_item_sk as sold_item_sk, + ws_sold_time_sk as time_sk + from web_sales,date_dim + where d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=2002 + union all + select cs_ext_sales_price as ext_price, + cs_sold_date_sk as sold_date_sk, + cs_item_sk as sold_item_sk, + cs_sold_time_sk as time_sk + from catalog_sales,date_dim + where d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=2002 + union all + select ss_ext_sales_price as ext_price, + ss_sold_date_sk as sold_date_sk, + ss_item_sk as sold_item_sk, + ss_sold_time_sk as time_sk + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=2002 + ) tmp,time_dim + where + sold_item_sk = i_item_sk + and i_manager_id=1 + and time_sk = t_time_sk + and (t_meal_time = 'breakfast' or t_meal_time = 'dinner') + group by i_brand, i_brand_id,t_hour,t_minute + order by ext_price desc, i_brand_id + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query72.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query72.groovy new file mode 100644 index 00000000000000..aa2d674cc33f16 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query72.groovy @@ -0,0 +1,94 @@ +/* + * 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("query72") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt +from catalog_sales +join inventory on (cs_item_sk = inv_item_sk) +join warehouse on (w_warehouse_sk=inv_warehouse_sk) +join item on (i_item_sk = cs_item_sk) +join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join date_dim d2 on (inv_date_sk = d2.d_date_sk) +join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join promotion on (cs_promo_sk=p_promo_sk) +left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) +where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and (d3.d_date > (d1.d_date + INTERVAL '5' DAY)) + and hd_buy_potential = '1001-5000' + and d1.d_year = 1998 + and cd_marital_status = 'S' +group by i_item_desc,w_warehouse_name,d1.d_week_seq +order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq +limit 100""" + qt_ds_shape_72 ''' + explain shape plan + select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt +from catalog_sales +join inventory on (cs_item_sk = inv_item_sk) +join warehouse on (w_warehouse_sk=inv_warehouse_sk) +join item on (i_item_sk = cs_item_sk) +join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join date_dim d2 on (inv_date_sk = d2.d_date_sk) +join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join promotion on (cs_promo_sk=p_promo_sk) +left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) +where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and (d3.d_date > (d1.d_date + INTERVAL '5' DAY)) + and hd_buy_potential = '1001-5000' + and d1.d_year = 1998 + and cd_marital_status = 'S' +group by i_item_desc,w_warehouse_name,d1.d_week_seq +order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query73.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query73.groovy new file mode 100644 index 00000000000000..bac050095a8835 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query73.groovy @@ -0,0 +1,92 @@ +/* + * 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("query73") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_buy_potential = '1001-5000' or + household_demographics.hd_buy_potential = '5001-10000') + and household_demographics.hd_vehicle_count > 0 + and case when household_demographics.hd_vehicle_count > 0 then + household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dj,customer + where ss_customer_sk = c_customer_sk + and cnt between 1 and 5 + order by cnt desc, c_last_name asc""" + qt_ds_shape_73 ''' + explain shape plan + select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_buy_potential = '1001-5000' or + household_demographics.hd_buy_potential = '5001-10000') + and household_demographics.hd_vehicle_count > 0 + and case when household_demographics.hd_vehicle_count > 0 then + household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dj,customer + where ss_customer_sk = c_customer_sk + and cnt between 1 and 5 + order by cnt desc, c_last_name asc + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query74.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query74.groovy new file mode 100644 index 00000000000000..a0ef28422cd655 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query74.groovy @@ -0,0 +1,158 @@ +/* + * 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("query74") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ss_net_paid) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ws_net_paid) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 1999 + and t_s_secyear.year = 1999+1 + and t_w_firstyear.year = 1999 + and t_w_secyear.year = 1999+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + order by 1,3,2 +limit 100""" + qt_ds_shape_74 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ss_net_paid) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ws_net_paid) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 1999 + and t_s_secyear.year = 1999+1 + and t_w_firstyear.year = 1999 + and t_w_secyear.year = 1999+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + order by 1,3,2 +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query75.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query75.groovy new file mode 100644 index 00000000000000..5109f9a2acbbe3 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query75.groovy @@ -0,0 +1,176 @@ +/* + * 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("query75") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt + FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk + JOIN date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt + FROM store_sales JOIN item ON i_item_sk=ss_item_sk + JOIN date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt + FROM web_sales JOIN item ON i_item_sk=ws_item_sk + JOIN date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Sports') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=2002 + AND prev_yr.d_year=2002-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 + ORDER BY sales_cnt_diff,sales_amt_diff + limit 100""" + qt_ds_shape_75 ''' + explain shape plan + WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt + FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk + JOIN date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt + FROM store_sales JOIN item ON i_item_sk=ss_item_sk + JOIN date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt + FROM web_sales JOIN item ON i_item_sk=ws_item_sk + JOIN date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Sports') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=2002 + AND prev_yr.d_year=2002-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 + ORDER BY sales_cnt_diff,sales_amt_diff + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query76.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query76.groovy new file mode 100644 index 00000000000000..e4ab83d22d61ef --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query76.groovy @@ -0,0 +1,84 @@ +/* + * 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("query76") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( + SELECT 'store' as channel, 'ss_customer_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM store_sales, item, date_dim + WHERE ss_customer_sk IS NULL + AND ss_sold_date_sk=d_date_sk + AND ss_item_sk=i_item_sk + UNION ALL + SELECT 'web' as channel, 'ws_promo_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM web_sales, item, date_dim + WHERE ws_promo_sk IS NULL + AND ws_sold_date_sk=d_date_sk + AND ws_item_sk=i_item_sk + UNION ALL + SELECT 'catalog' as channel, 'cs_bill_customer_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price + FROM catalog_sales, item, date_dim + WHERE cs_bill_customer_sk IS NULL + AND cs_sold_date_sk=d_date_sk + AND cs_item_sk=i_item_sk) foo +GROUP BY channel, col_name, d_year, d_qoy, i_category +ORDER BY channel, col_name, d_year, d_qoy, i_category +limit 100""" + qt_ds_shape_76 ''' + explain shape plan + select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( + SELECT 'store' as channel, 'ss_customer_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM store_sales, item, date_dim + WHERE ss_customer_sk IS NULL + AND ss_sold_date_sk=d_date_sk + AND ss_item_sk=i_item_sk + UNION ALL + SELECT 'web' as channel, 'ws_promo_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM web_sales, item, date_dim + WHERE ws_promo_sk IS NULL + AND ws_sold_date_sk=d_date_sk + AND ws_item_sk=i_item_sk + UNION ALL + SELECT 'catalog' as channel, 'cs_bill_customer_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price + FROM catalog_sales, item, date_dim + WHERE cs_bill_customer_sk IS NULL + AND cs_sold_date_sk=d_date_sk + AND cs_item_sk=i_item_sk) foo +GROUP BY channel, col_name, d_year, d_qoy, i_category +ORDER BY channel, col_name, d_year, d_qoy, i_category +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query77.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query77.groovy new file mode 100644 index 00000000000000..3e5fada6bb4aef --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query77.groovy @@ -0,0 +1,252 @@ +/* + * 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("query77") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from store_sales, + date_dim, + store + where ss_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as returns, + sum(sr_net_loss) as profit_loss + from store_returns, + date_dim, + store + where sr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from catalog_sales, + date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + group by cs_call_center_sk + ), + cr as + (select cr_call_center_sk, + sum(cr_return_amount) as returns, + sum(cr_net_loss) as profit_loss + from catalog_returns, + date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + group by cr_call_center_sk + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from web_sales, + date_dim, + web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as returns, + sum(wr_net_loss) as profit_loss + from web_returns, + date_dim, + web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(returns, 0) as returns + , (profit - coalesce(profit_loss,0)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , returns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(returns, 0) returns + , (profit - coalesce(profit_loss,0)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100""" + qt_ds_shape_77 ''' + explain shape plan + with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from store_sales, + date_dim, + store + where ss_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as returns, + sum(sr_net_loss) as profit_loss + from store_returns, + date_dim, + store + where sr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from catalog_sales, + date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + group by cs_call_center_sk + ), + cr as + (select cr_call_center_sk, + sum(cr_return_amount) as returns, + sum(cr_net_loss) as profit_loss + from catalog_returns, + date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + group by cr_call_center_sk + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from web_sales, + date_dim, + web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as returns, + sum(wr_net_loss) as profit_loss + from web_returns, + date_dim, + web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-10' as date) + and (cast('2000-08-10' as date) + interval 30 day) + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(returns, 0) as returns + , (profit - coalesce(profit_loss,0)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , returns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(returns, 0) returns + , (profit - coalesce(profit_loss,0)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query78.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query78.groovy new file mode 100644 index 00000000000000..f8186f83278da2 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query78.groovy @@ -0,0 +1,152 @@ +/* + * 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("query78") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ws as + (select d_year AS ws_sold_year, ws_item_sk, + ws_bill_customer_sk ws_customer_sk, + sum(ws_quantity) ws_qty, + sum(ws_wholesale_cost) ws_wc, + sum(ws_sales_price) ws_sp + from web_sales + left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join date_dim on ws_sold_date_sk = d_date_sk + where wr_order_number is null and d_year=1998 + group by d_year, ws_item_sk, ws_bill_customer_sk + ), +cs as + (select d_year AS cs_sold_year, cs_item_sk, + cs_bill_customer_sk cs_customer_sk, + sum(cs_quantity) cs_qty, + sum(cs_wholesale_cost) cs_wc, + sum(cs_sales_price) cs_sp + from catalog_sales + left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join date_dim on cs_sold_date_sk = d_date_sk + where cr_order_number is null and d_year=1998 + group by d_year, cs_item_sk, cs_bill_customer_sk + ), +ss as + (select d_year AS ss_sold_year, ss_item_sk, + ss_customer_sk, + sum(ss_quantity) ss_qty, + sum(ss_wholesale_cost) ss_wc, + sum(ss_sales_price) ss_sp + from store_sales + left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join date_dim on ss_sold_date_sk = d_date_sk + where sr_ticket_number is null and d_year=1998 + group by d_year, ss_item_sk, ss_customer_sk + ) +select +ss_customer_sk, +round(ss_qty/(coalesce(ws_qty,0)+coalesce(cs_qty,0)),2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty, +coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost, +coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price +from ss +left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk) +left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=ss_item_sk and cs_customer_sk=ss_customer_sk) +where (coalesce(ws_qty,0)>0 or coalesce(cs_qty, 0)>0) and ss_sold_year=1998 +order by + ss_customer_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + ratio +limit 100""" + qt_ds_shape_78 ''' + explain shape plan + with ws as + (select d_year AS ws_sold_year, ws_item_sk, + ws_bill_customer_sk ws_customer_sk, + sum(ws_quantity) ws_qty, + sum(ws_wholesale_cost) ws_wc, + sum(ws_sales_price) ws_sp + from web_sales + left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join date_dim on ws_sold_date_sk = d_date_sk + where wr_order_number is null and d_year=1998 + group by d_year, ws_item_sk, ws_bill_customer_sk + ), +cs as + (select d_year AS cs_sold_year, cs_item_sk, + cs_bill_customer_sk cs_customer_sk, + sum(cs_quantity) cs_qty, + sum(cs_wholesale_cost) cs_wc, + sum(cs_sales_price) cs_sp + from catalog_sales + left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join date_dim on cs_sold_date_sk = d_date_sk + where cr_order_number is null and d_year=1998 + group by d_year, cs_item_sk, cs_bill_customer_sk + ), +ss as + (select d_year AS ss_sold_year, ss_item_sk, + ss_customer_sk, + sum(ss_quantity) ss_qty, + sum(ss_wholesale_cost) ss_wc, + sum(ss_sales_price) ss_sp + from store_sales + left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join date_dim on ss_sold_date_sk = d_date_sk + where sr_ticket_number is null and d_year=1998 + group by d_year, ss_item_sk, ss_customer_sk + ) +select +ss_customer_sk, +round(ss_qty/(coalesce(ws_qty,0)+coalesce(cs_qty,0)),2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty, +coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost, +coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price +from ss +left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk) +left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=ss_item_sk and cs_customer_sk=ss_customer_sk) +where (coalesce(ws_qty,0)>0 or coalesce(cs_qty, 0)>0) and ss_sold_year=1998 +order by + ss_customer_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + ratio +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query79.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query79.groovy new file mode 100644 index 00000000000000..2d43c4cda6db31 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query79.groovy @@ -0,0 +1,82 @@ +/* + * 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("query79") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,store.s_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (household_demographics.hd_dep_count = 7 or household_demographics.hd_vehicle_count > -1) + and date_dim.d_dow = 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_number_employees between 200 and 295 + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100""" + qt_ds_shape_79 ''' + explain shape plan + select + c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,store.s_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (household_demographics.hd_dep_count = 7 or household_demographics.hd_vehicle_count > -1) + and date_dim.d_dow = 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_number_employees between 200 and 295 + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query8.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query8.groovy new file mode 100644 index 00000000000000..cbb6206e241d56 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query8.groovy @@ -0,0 +1,253 @@ +/* + * 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("query8") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + sql "set experimental_enable_virtual_slot_for_cse=true" + + def ds = """select s_store_name + ,sum(ss_net_profit) + from store_sales + ,date_dim + ,store, + (select ca_zip + from ( + SELECT substr(ca_zip,1,5) ca_zip + FROM customer_address + WHERE substr(ca_zip,1,5) IN ( + '47602','16704','35863','28577','83910','36201', + '58412','48162','28055','41419','80332', + '38607','77817','24891','16226','18410', + '21231','59345','13918','51089','20317', + '17167','54585','67881','78366','47770', + '18360','51717','73108','14440','21800', + '89338','45859','65501','34948','25973', + '73219','25333','17291','10374','18829', + '60736','82620','41351','52094','19326', + '25214','54207','40936','21814','79077', + '25178','75742','77454','30621','89193', + '27369','41232','48567','83041','71948', + '37119','68341','14073','16891','62878', + '49130','19833','24286','27700','40979', + '50412','81504','94835','84844','71954', + '39503','57649','18434','24987','12350', + '86379','27413','44529','98569','16515', + '27287','24255','21094','16005','56436', + '91110','68293','56455','54558','10298', + '83647','32754','27052','51766','19444', + '13869','45645','94791','57631','20712', + '37788','41807','46507','21727','71836', + '81070','50632','88086','63991','20244', + '31655','51782','29818','63792','68605', + '94898','36430','57025','20601','82080', + '33869','22728','35834','29086','92645', + '98584','98072','11652','78093','57553', + '43830','71144','53565','18700','90209', + '71256','38353','54364','28571','96560', + '57839','56355','50679','45266','84680', + '34306','34972','48530','30106','15371', + '92380','84247','92292','68852','13338', + '34594','82602','70073','98069','85066', + '47289','11686','98862','26217','47529', + '63294','51793','35926','24227','14196', + '24594','32489','99060','49472','43432', + '49211','14312','88137','47369','56877', + '20534','81755','15794','12318','21060', + '73134','41255','63073','81003','73873', + '66057','51184','51195','45676','92696', + '70450','90669','98338','25264','38919', + '59226','58581','60298','17895','19489', + '52301','80846','95464','68770','51634', + '19988','18367','18421','11618','67975', + '25494','41352','95430','15734','62585', + '97173','33773','10425','75675','53535', + '17879','41967','12197','67998','79658', + '59130','72592','14851','43933','68101', + '50636','25717','71286','24660','58058', + '72991','95042','15543','33122','69280', + '11912','59386','27642','65177','17672', + '33467','64592','36335','54010','18767', + '63193','42361','49254','33113','33159', + '36479','59080','11855','81963','31016', + '49140','29392','41836','32958','53163', + '13844','73146','23952','65148','93498', + '14530','46131','58454','13376','13378', + '83986','12320','17193','59852','46081', + '98533','52389','13086','68843','31013', + '13261','60560','13443','45533','83583', + '11489','58218','19753','22911','25115', + '86709','27156','32669','13123','51933', + '39214','41331','66943','14155','69998', + '49101','70070','35076','14242','73021', + '59494','15782','29752','37914','74686', + '83086','34473','15751','81084','49230', + '91894','60624','17819','28810','63180', + '56224','39459','55233','75752','43639', + '55349','86057','62361','50788','31830', + '58062','18218','85761','60083','45484', + '21204','90229','70041','41162','35390', + '16364','39500','68908','26689','52868', + '81335','40146','11340','61527','61794', + '71997','30415','59004','29450','58117', + '69952','33562','83833','27385','61860', + '96435','48333','23065','32961','84919', + '61997','99132','22815','56600','68730', + '48017','95694','32919','88217','27116', + '28239','58032','18884','16791','21343', + '97462','18569','75660','15475') + intersect + select ca_zip + from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt + FROM customer_address, customer + WHERE ca_address_sk = c_current_addr_sk and + c_preferred_cust_flag='Y' + group by ca_zip + having count(*) > 10)A1)A2) V1 + where ss_store_sk = s_store_sk + and ss_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 1998 + and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2)) + group by s_store_name + order by s_store_name + limit 100""" + qt_ds_shape_8 ''' + explain shape plan + select s_store_name + ,sum(ss_net_profit) + from store_sales + ,date_dim + ,store, + (select ca_zip + from ( + SELECT substr(ca_zip,1,5) ca_zip + FROM customer_address + WHERE substr(ca_zip,1,5) IN ( + '47602','16704','35863','28577','83910','36201', + '58412','48162','28055','41419','80332', + '38607','77817','24891','16226','18410', + '21231','59345','13918','51089','20317', + '17167','54585','67881','78366','47770', + '18360','51717','73108','14440','21800', + '89338','45859','65501','34948','25973', + '73219','25333','17291','10374','18829', + '60736','82620','41351','52094','19326', + '25214','54207','40936','21814','79077', + '25178','75742','77454','30621','89193', + '27369','41232','48567','83041','71948', + '37119','68341','14073','16891','62878', + '49130','19833','24286','27700','40979', + '50412','81504','94835','84844','71954', + '39503','57649','18434','24987','12350', + '86379','27413','44529','98569','16515', + '27287','24255','21094','16005','56436', + '91110','68293','56455','54558','10298', + '83647','32754','27052','51766','19444', + '13869','45645','94791','57631','20712', + '37788','41807','46507','21727','71836', + '81070','50632','88086','63991','20244', + '31655','51782','29818','63792','68605', + '94898','36430','57025','20601','82080', + '33869','22728','35834','29086','92645', + '98584','98072','11652','78093','57553', + '43830','71144','53565','18700','90209', + '71256','38353','54364','28571','96560', + '57839','56355','50679','45266','84680', + '34306','34972','48530','30106','15371', + '92380','84247','92292','68852','13338', + '34594','82602','70073','98069','85066', + '47289','11686','98862','26217','47529', + '63294','51793','35926','24227','14196', + '24594','32489','99060','49472','43432', + '49211','14312','88137','47369','56877', + '20534','81755','15794','12318','21060', + '73134','41255','63073','81003','73873', + '66057','51184','51195','45676','92696', + '70450','90669','98338','25264','38919', + '59226','58581','60298','17895','19489', + '52301','80846','95464','68770','51634', + '19988','18367','18421','11618','67975', + '25494','41352','95430','15734','62585', + '97173','33773','10425','75675','53535', + '17879','41967','12197','67998','79658', + '59130','72592','14851','43933','68101', + '50636','25717','71286','24660','58058', + '72991','95042','15543','33122','69280', + '11912','59386','27642','65177','17672', + '33467','64592','36335','54010','18767', + '63193','42361','49254','33113','33159', + '36479','59080','11855','81963','31016', + '49140','29392','41836','32958','53163', + '13844','73146','23952','65148','93498', + '14530','46131','58454','13376','13378', + '83986','12320','17193','59852','46081', + '98533','52389','13086','68843','31013', + '13261','60560','13443','45533','83583', + '11489','58218','19753','22911','25115', + '86709','27156','32669','13123','51933', + '39214','41331','66943','14155','69998', + '49101','70070','35076','14242','73021', + '59494','15782','29752','37914','74686', + '83086','34473','15751','81084','49230', + '91894','60624','17819','28810','63180', + '56224','39459','55233','75752','43639', + '55349','86057','62361','50788','31830', + '58062','18218','85761','60083','45484', + '21204','90229','70041','41162','35390', + '16364','39500','68908','26689','52868', + '81335','40146','11340','61527','61794', + '71997','30415','59004','29450','58117', + '69952','33562','83833','27385','61860', + '96435','48333','23065','32961','84919', + '61997','99132','22815','56600','68730', + '48017','95694','32919','88217','27116', + '28239','58032','18884','16791','21343', + '97462','18569','75660','15475') + intersect + select ca_zip + from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt + FROM customer_address, customer + WHERE ca_address_sk = c_current_addr_sk and + c_preferred_cust_flag='Y' + group by ca_zip + having count(*) > 10)A1)A2) V1 + where ss_store_sk = s_store_sk + and ss_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 1998 + and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2)) + group by s_store_name + order by s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query80.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query80.groovy new file mode 100644 index 00000000000000..84cd9a1c132196 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query80.groovy @@ -0,0 +1,228 @@ +/* + * 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("query80") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ssr as + (select s_store_id as store_id, + sum(ss_ext_sales_price) as sales, + sum(coalesce(sr_return_amt, 0)) as returns, + sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit + from store_sales left outer join store_returns on + (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number), + date_dim, + store, + item, + promotion + where ss_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and ss_store_sk = s_store_sk + and ss_item_sk = i_item_sk + and i_current_price > 50 + and ss_promo_sk = p_promo_sk + and p_channel_tv = 'N' + group by s_store_id) + , + csr as + (select cp_catalog_page_id as catalog_page_id, + sum(cs_ext_sales_price) as sales, + sum(coalesce(cr_return_amount, 0)) as returns, + sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit + from catalog_sales left outer join catalog_returns on + (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number), + date_dim, + catalog_page, + item, + promotion + where cs_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and cs_catalog_page_sk = cp_catalog_page_sk + and cs_item_sk = i_item_sk + and i_current_price > 50 + and cs_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(ws_ext_sales_price) as sales, + sum(coalesce(wr_return_amt, 0)) as returns, + sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit + from web_sales left outer join web_returns on + (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number), + date_dim, + web_site, + item, + promotion + where ws_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and ws_web_site_sk = web_site_sk + and ws_item_sk = i_item_sk + and i_current_price > 50 + and ws_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', store_id) as id + , sales + , returns + , profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', catalog_page_id) as id + , sales + , returns + , profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) as id + , sales + , returns + , profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100""" + qt_ds_shape_80 ''' + explain shape plan + with ssr as + (select s_store_id as store_id, + sum(ss_ext_sales_price) as sales, + sum(coalesce(sr_return_amt, 0)) as returns, + sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit + from store_sales left outer join store_returns on + (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number), + date_dim, + store, + item, + promotion + where ss_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and ss_store_sk = s_store_sk + and ss_item_sk = i_item_sk + and i_current_price > 50 + and ss_promo_sk = p_promo_sk + and p_channel_tv = 'N' + group by s_store_id) + , + csr as + (select cp_catalog_page_id as catalog_page_id, + sum(cs_ext_sales_price) as sales, + sum(coalesce(cr_return_amount, 0)) as returns, + sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit + from catalog_sales left outer join catalog_returns on + (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number), + date_dim, + catalog_page, + item, + promotion + where cs_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and cs_catalog_page_sk = cp_catalog_page_sk + and cs_item_sk = i_item_sk + and i_current_price > 50 + and cs_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(ws_ext_sales_price) as sales, + sum(coalesce(wr_return_amt, 0)) as returns, + sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit + from web_sales left outer join web_returns on + (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number), + date_dim, + web_site, + item, + promotion + where ws_sold_date_sk = d_date_sk + and d_date between cast('2002-08-14' as date) + and (cast('2002-08-14' as date) + interval 30 day) + and ws_web_site_sk = web_site_sk + and ws_item_sk = i_item_sk + and i_current_price > 50 + and ws_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', store_id) as id + , sales + , returns + , profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', catalog_page_id) as id + , sales + , returns + , profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) as id + , sales + , returns + , profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query81.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query81.groovy new file mode 100644 index 00000000000000..3e2dea3e09bdbe --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query81.groovy @@ -0,0 +1,98 @@ +/* + * 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("query81") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with customer_total_return as + (select cr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(cr_return_amt_inc_tax) as ctr_total_return + from catalog_returns + ,date_dim + ,customer_address + where cr_returned_date_sk = d_date_sk + and d_year =2001 + and cr_returning_addr_sk = ca_address_sk + group by cr_returning_customer_sk + ,ca_state ) + select c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'TN' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + limit 100""" + qt_ds_shape_81 ''' + explain shape plan + with customer_total_return as + (select cr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(cr_return_amt_inc_tax) as ctr_total_return + from catalog_returns + ,date_dim + ,customer_address + where cr_returned_date_sk = d_date_sk + and d_year =2001 + and cr_returning_addr_sk = ca_address_sk + group by cr_returning_customer_sk + ,ca_state ) + select c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'TN' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query82.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query82.groovy new file mode 100644 index 00000000000000..65e93ce43d1912 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query82.groovy @@ -0,0 +1,70 @@ +/* + * 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("query82") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, store_sales + where i_current_price between 58 and 58+30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2001-01-13' as date) and (cast('2001-01-13' as date) + interval 60 day) + and i_manufact_id in (259,559,580,485) + and inv_quantity_on_hand between 100 and 500 + and ss_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100""" + qt_ds_shape_82 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, store_sales + where i_current_price between 58 and 58+30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2001-01-13' as date) and (cast('2001-01-13' as date) + interval 60 day) + and i_manufact_id in (259,559,580,485) + and inv_quantity_on_hand between 100 and 500 + and ss_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query83.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query83.groovy new file mode 100644 index 00000000000000..70fbc4ce0acd7e --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query83.groovy @@ -0,0 +1,170 @@ +/* + * 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("query83") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with sr_items as + (select i_item_id item_id, + sum(sr_return_quantity) sr_item_qty + from store_returns, + item, + date_dim + where sr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and sr_returned_date_sk = d_date_sk + group by i_item_id), + cr_items as + (select i_item_id item_id, + sum(cr_return_quantity) cr_item_qty + from catalog_returns, + item, + date_dim + where cr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and cr_returned_date_sk = d_date_sk + group by i_item_id), + wr_items as + (select i_item_id item_id, + sum(wr_return_quantity) wr_item_qty + from web_returns, + item, + date_dim + where wr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and wr_returned_date_sk = d_date_sk + group by i_item_id) + select sr_items.item_id + ,sr_item_qty + ,sr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 sr_dev + ,cr_item_qty + ,cr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 cr_dev + ,wr_item_qty + ,wr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 wr_dev + ,(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 average + from sr_items + ,cr_items + ,wr_items + where sr_items.item_id=cr_items.item_id + and sr_items.item_id=wr_items.item_id + order by sr_items.item_id + ,sr_item_qty + limit 100""" + qt_ds_shape_83 ''' + explain shape plan + with sr_items as + (select i_item_id item_id, + sum(sr_return_quantity) sr_item_qty + from store_returns, + item, + date_dim + where sr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and sr_returned_date_sk = d_date_sk + group by i_item_id), + cr_items as + (select i_item_id item_id, + sum(cr_return_quantity) cr_item_qty + from catalog_returns, + item, + date_dim + where cr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and cr_returned_date_sk = d_date_sk + group by i_item_id), + wr_items as + (select i_item_id item_id, + sum(wr_return_quantity) wr_item_qty + from web_returns, + item, + date_dim + where wr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-07-13','2001-09-10','2001-11-16'))) + and wr_returned_date_sk = d_date_sk + group by i_item_id) + select sr_items.item_id + ,sr_item_qty + ,sr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 sr_dev + ,cr_item_qty + ,cr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 cr_dev + ,wr_item_qty + ,wr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 wr_dev + ,(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 average + from sr_items + ,cr_items + ,wr_items + where sr_items.item_id=cr_items.item_id + and sr_items.item_id=wr_items.item_id + order by sr_items.item_id + ,sr_item_qty + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query84.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query84.groovy new file mode 100644 index 00000000000000..399e82338c13ed --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query84.groovy @@ -0,0 +1,78 @@ +/* + * 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("query84") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select c_customer_id as customer_id + , concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername + from customer + ,customer_address + ,customer_demographics + ,household_demographics + ,income_band + ,store_returns + where ca_city = 'Woodland' + and c_current_addr_sk = ca_address_sk + and ib_lower_bound >= 60306 + and ib_upper_bound <= 60306 + 50000 + and ib_income_band_sk = hd_income_band_sk + and cd_demo_sk = c_current_cdemo_sk + and hd_demo_sk = c_current_hdemo_sk + and sr_cdemo_sk = cd_demo_sk + order by c_customer_id + limit 100""" + qt_ds_shape_84 ''' + explain shape plan + select c_customer_id as customer_id + , concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername + from customer + ,customer_address + ,customer_demographics + ,household_demographics + ,income_band + ,store_returns + where ca_city = 'Woodland' + and c_current_addr_sk = ca_address_sk + and ib_lower_bound >= 60306 + and ib_upper_bound <= 60306 + 50000 + and ib_income_band_sk = hd_income_band_sk + and cd_demo_sk = c_current_cdemo_sk + and hd_demo_sk = c_current_hdemo_sk + and sr_cdemo_sk = cd_demo_sk + order by c_customer_id + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query85.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query85.groovy new file mode 100644 index 00000000000000..6352b8d9bfb05d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query85.groovy @@ -0,0 +1,204 @@ +/* + * 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("query85") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) + from web_sales, web_returns, web_page, customer_demographics cd1, + customer_demographics cd2, customer_address, date_dim, reason + where ws_web_page_sk = wp_web_page_sk + and ws_item_sk = wr_item_sk + and ws_order_number = wr_order_number + and ws_sold_date_sk = d_date_sk and d_year = 1998 + and cd1.cd_demo_sk = wr_refunded_cdemo_sk + and cd2.cd_demo_sk = wr_returning_cdemo_sk + and ca_address_sk = wr_refunded_addr_sk + and r_reason_sk = wr_reason_sk + and + ( + ( + cd1.cd_marital_status = 'D' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Primary' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 100.00 and 150.00 + ) + or + ( + cd1.cd_marital_status = 'S' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'College' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 50.00 and 100.00 + ) + or + ( + cd1.cd_marital_status = 'U' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Advanced Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ca_country = 'United States' + and + ca_state in ('NC', 'TX', 'IA') + and ws_net_profit between 100 and 200 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('WI', 'WV', 'GA') + and ws_net_profit between 150 and 300 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('OK', 'VA', 'KY') + and ws_net_profit between 50 and 250 + ) + ) +group by r_reason_desc +order by substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) +limit 100""" + qt_ds_shape_85 ''' + explain shape plan + select substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) + from web_sales, web_returns, web_page, customer_demographics cd1, + customer_demographics cd2, customer_address, date_dim, reason + where ws_web_page_sk = wp_web_page_sk + and ws_item_sk = wr_item_sk + and ws_order_number = wr_order_number + and ws_sold_date_sk = d_date_sk and d_year = 1998 + and cd1.cd_demo_sk = wr_refunded_cdemo_sk + and cd2.cd_demo_sk = wr_returning_cdemo_sk + and ca_address_sk = wr_refunded_addr_sk + and r_reason_sk = wr_reason_sk + and + ( + ( + cd1.cd_marital_status = 'D' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Primary' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 100.00 and 150.00 + ) + or + ( + cd1.cd_marital_status = 'S' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'College' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 50.00 and 100.00 + ) + or + ( + cd1.cd_marital_status = 'U' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Advanced Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ca_country = 'United States' + and + ca_state in ('NC', 'TX', 'IA') + and ws_net_profit between 100 and 200 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('WI', 'WV', 'GA') + and ws_net_profit between 150 and 300 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('OK', 'VA', 'KY') + and ws_net_profit between 50 and 250 + ) + ) +group by r_reason_desc +order by substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query86.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query86.groovy new file mode 100644 index 00000000000000..2200b2d71b836a --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query86.groovy @@ -0,0 +1,88 @@ +/* + * 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("query86") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + sum(ws_net_paid) as total_sum + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ws_net_paid) desc) as rank_within_parent + from + web_sales + ,date_dim d1 + ,item + where + d1.d_month_seq between 1186 and 1186+11 + and d1.d_date_sk = ws_sold_date_sk + and i_item_sk = ws_item_sk + group by rollup(i_category,i_class) + order by + lochierarchy desc, + case when lochierarchy = 0 then i_category end, + rank_within_parent + limit 100""" + qt_ds_shape_86 ''' + explain shape plan + select + sum(ws_net_paid) as total_sum + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ws_net_paid) desc) as rank_within_parent + from + web_sales + ,date_dim d1 + ,item + where + d1.d_month_seq between 1186 and 1186+11 + and d1.d_date_sk = ws_sold_date_sk + and i_item_sk = ws_item_sk + group by rollup(i_category,i_class) + order by + lochierarchy desc, + case when lochierarchy = 0 then i_category end, + rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query87.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query87.groovy new file mode 100644 index 00000000000000..f7a38a963c5c75 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query87.groovy @@ -0,0 +1,82 @@ +/* + * 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("query87") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select count(*) +from ((select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) + except + (select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) + except + (select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) +) cool_cust +""" + qt_ds_shape_87 ''' + explain shape plan + select count(*) +from ((select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) + except + (select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) + except + (select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1202 and 1202+11) +) cool_cust + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query88.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query88.groovy new file mode 100644 index 00000000000000..e0a2c83153fb68 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query88.groovy @@ -0,0 +1,224 @@ +/* + * 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("query88") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * +from + (select count(*) h8_30_to_9 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s1, + (select count(*) h9_to_9_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s2, + (select count(*) h9_30_to_10 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s3, + (select count(*) h10_to_10_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s4, + (select count(*) h10_30_to_11 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s5, + (select count(*) h11_to_11_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s6, + (select count(*) h11_30_to_12 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s7, + (select count(*) h12_to_12_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 12 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s8 +""" + qt_ds_shape_88 ''' + explain shape plan + select * +from + (select count(*) h8_30_to_9 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s1, + (select count(*) h9_to_9_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s2, + (select count(*) h9_30_to_10 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s3, + (select count(*) h10_to_10_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s4, + (select count(*) h10_30_to_11 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s5, + (select count(*) h11_to_11_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s6, + (select count(*) h11_30_to_12 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s7, + (select count(*) h12_to_12_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 12 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s8 + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query89.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query89.groovy new file mode 100644 index 00000000000000..c0ecd01ae44cb5 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query89.groovy @@ -0,0 +1,92 @@ +/* + * 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("query89") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select * +from( +select i_category, i_class, i_brand, + s_store_name, s_company_name, + d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, s_store_name, s_company_name) + avg_monthly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + d_year in (2001) and + ((i_category in ('Books','Children','Electronics') and + i_class in ('history','school-uniforms','audio') + ) + or (i_category in ('Men','Sports','Shoes') and + i_class in ('pants','tennis','womens') + )) +group by i_category, i_class, i_brand, + s_store_name, s_company_name, d_moy) tmp1 +where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1 +order by sum_sales - avg_monthly_sales, s_store_name +limit 100""" + qt_ds_shape_89 ''' + explain shape plan + select * +from( +select i_category, i_class, i_brand, + s_store_name, s_company_name, + d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, s_store_name, s_company_name) + avg_monthly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + d_year in (2001) and + ((i_category in ('Books','Children','Electronics') and + i_class in ('history','school-uniforms','audio') + ) + or (i_category in ('Men','Sports','Shoes') and + i_class in ('pants','tennis','womens') + )) +group by i_category, i_class, i_brand, + s_store_name, s_company_name, d_moy) tmp1 +where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1 +order by sum_sales - avg_monthly_sales, s_store_name +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query9.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query9.groovy new file mode 100644 index 00000000000000..fbd7549e41034c --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query9.groovy @@ -0,0 +1,139 @@ +/* + * 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("query9") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + sql "set enable_parallel_result_sink=false;" + + def ds = """select case when (select count(*) + from store_sales + where ss_quantity between 1 and 20) > 1071 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 1 and 20) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 1 and 20) end bucket1 , + case when (select count(*) + from store_sales + where ss_quantity between 21 and 40) > 39161 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 21 and 40) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 21 and 40) end bucket2, + case when (select count(*) + from store_sales + where ss_quantity between 41 and 60) > 29434 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 41 and 60) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 41 and 60) end bucket3, + case when (select count(*) + from store_sales + where ss_quantity between 61 and 80) > 6568 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 61 and 80) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 61 and 80) end bucket4, + case when (select count(*) + from store_sales + where ss_quantity between 81 and 100) > 21216 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 81 and 100) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 81 and 100) end bucket5 +from reason +where r_reason_sk = 1 +""" + qt_ds_shape_9 ''' + explain shape plan + select case when (select count(*) + from store_sales + where ss_quantity between 1 and 20) > 1071 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 1 and 20) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 1 and 20) end bucket1 , + case when (select count(*) + from store_sales + where ss_quantity between 21 and 40) > 39161 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 21 and 40) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 21 and 40) end bucket2, + case when (select count(*) + from store_sales + where ss_quantity between 41 and 60) > 29434 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 41 and 60) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 41 and 60) end bucket3, + case when (select count(*) + from store_sales + where ss_quantity between 61 and 80) > 6568 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 61 and 80) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 61 and 80) end bucket4, + case when (select count(*) + from store_sales + where ss_quantity between 81 and 100) > 21216 + then (select avg(ss_ext_tax) + from store_sales + where ss_quantity between 81 and 100) + else (select avg(ss_net_paid_inc_tax) + from store_sales + where ss_quantity between 81 and 100) end bucket5 +from reason +where r_reason_sk = 1 + + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query90.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query90.groovy new file mode 100644 index 00000000000000..26645b7924a9b2 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query90.groovy @@ -0,0 +1,80 @@ +/* + * 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("query90") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio + from ( select count(*) amc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 12 and 12+1 + and household_demographics.hd_dep_count = 6 + and web_page.wp_char_count between 5000 and 5200) at, + ( select count(*) pmc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 14 and 14+1 + and household_demographics.hd_dep_count = 6 + and web_page.wp_char_count between 5000 and 5200) pt + order by am_pm_ratio + limit 100""" + qt_ds_shape_90 ''' + explain shape plan + select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio + from ( select count(*) amc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 12 and 12+1 + and household_demographics.hd_dep_count = 6 + and web_page.wp_char_count between 5000 and 5200) at, + ( select count(*) pmc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 14 and 14+1 + and household_demographics.hd_dep_count = 6 + and web_page.wp_char_count between 5000 and 5200) pt + order by am_pm_ratio + limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query91.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query91.groovy new file mode 100644 index 00000000000000..3f72b439c1627d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query91.groovy @@ -0,0 +1,98 @@ +/* + * 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("query91") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + cc_call_center_id Call_Center, + cc_name Call_Center_Name, + cc_manager Manager, + sum(cr_net_loss) Returns_Loss +from + call_center, + catalog_returns, + date_dim, + customer, + customer_address, + customer_demographics, + household_demographics +where + cr_call_center_sk = cc_call_center_sk +and cr_returned_date_sk = d_date_sk +and cr_returning_customer_sk= c_customer_sk +and cd_demo_sk = c_current_cdemo_sk +and hd_demo_sk = c_current_hdemo_sk +and ca_address_sk = c_current_addr_sk +and d_year = 2000 +and d_moy = 12 +and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown') + or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree')) +and hd_buy_potential like 'Unknown%' +and ca_gmt_offset = -7 +group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status +order by sum(cr_net_loss) desc""" + qt_ds_shape_91 ''' + explain shape plan + select + cc_call_center_id Call_Center, + cc_name Call_Center_Name, + cc_manager Manager, + sum(cr_net_loss) Returns_Loss +from + call_center, + catalog_returns, + date_dim, + customer, + customer_address, + customer_demographics, + household_demographics +where + cr_call_center_sk = cc_call_center_sk +and cr_returned_date_sk = d_date_sk +and cr_returning_customer_sk= c_customer_sk +and cd_demo_sk = c_current_cdemo_sk +and hd_demo_sk = c_current_hdemo_sk +and ca_address_sk = c_current_addr_sk +and d_year = 2000 +and d_moy = 12 +and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown') + or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree')) +and hd_buy_potential like 'Unknown%' +and ca_gmt_offset = -7 +group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status +order by sum(cr_net_loss) desc + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query92.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query92.groovy new file mode 100644 index 00000000000000..77553e938c10b8 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query92.groovy @@ -0,0 +1,96 @@ +/* + * 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("query92") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + sum(ws_ext_discount_amt) as "Excess Discount Amount" +from + web_sales + ,item + ,date_dim +where +i_manufact_id = 714 +and i_item_sk = ws_item_sk +and d_date between '2000-02-01' and + (cast('2000-02-01' as date) + interval 90 day) +and d_date_sk = ws_sold_date_sk +and ws_ext_discount_amt + > ( + SELECT + 1.3 * avg(ws_ext_discount_amt) + FROM + web_sales + ,date_dim + WHERE + ws_item_sk = i_item_sk + and d_date between '2000-02-01' and + (cast('2000-02-01' as date) + interval 90 day) + and d_date_sk = ws_sold_date_sk + ) +order by sum(ws_ext_discount_amt) +limit 100""" + qt_ds_shape_92 ''' + explain shape plan + select + sum(ws_ext_discount_amt) as "Excess Discount Amount" +from + web_sales + ,item + ,date_dim +where +i_manufact_id = 714 +and i_item_sk = ws_item_sk +and d_date between '2000-02-01' and + (cast('2000-02-01' as date) + interval 90 day) +and d_date_sk = ws_sold_date_sk +and ws_ext_discount_amt + > ( + SELECT + 1.3 * avg(ws_ext_discount_amt) + FROM + web_sales + ,date_dim + WHERE + ws_item_sk = i_item_sk + and d_date between '2000-02-01' and + (cast('2000-02-01' as date) + interval 90 day) + and d_date_sk = ws_sold_date_sk + ) +order by sum(ws_ext_discount_amt) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query93.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query93.groovy new file mode 100644 index 00000000000000..bb5f53a01c895b --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query93.groovy @@ -0,0 +1,72 @@ +/* + * 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("query93") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select ss_customer_sk + ,sum(act_sales) sumsales + from (select ss_item_sk + ,ss_ticket_number + ,ss_customer_sk + ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price + else (ss_quantity*ss_sales_price) end act_sales + from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk + and sr_ticket_number = ss_ticket_number) + ,reason + where sr_reason_sk = r_reason_sk + and r_reason_desc = 'reason 58') t + group by ss_customer_sk + order by sumsales, ss_customer_sk +limit 100""" + qt_ds_shape_93 ''' + explain shape plan + select ss_customer_sk + ,sum(act_sales) sumsales + from (select ss_item_sk + ,ss_ticket_number + ,ss_customer_sk + ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price + else (ss_quantity*ss_sales_price) end act_sales + from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk + and sr_ticket_number = ss_ticket_number) + ,reason + where sr_reason_sk = r_reason_sk + and r_reason_desc = 'reason 58') t + group by ss_customer_sk + order by sumsales, ss_customer_sk +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query94.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query94.groovy new file mode 100644 index 00000000000000..a3bfc5466a61c4 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query94.groovy @@ -0,0 +1,94 @@ +/* + * 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("query94") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2002-5-01' and + (cast('2002-5-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'OK' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and exists (select * + from web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) +and not exists(select * + from web_returns wr1 + where ws1.ws_order_number = wr1.wr_order_number) +order by count(distinct ws_order_number) +limit 100""" + qt_ds_shape_94 ''' + explain shape plan + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2002-5-01' and + (cast('2002-5-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'OK' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and exists (select * + from web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) +and not exists(select * + from web_returns wr1 + where ws1.ws_order_number = wr1.wr_order_number) +order by count(distinct ws_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query95.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query95.groovy new file mode 100644 index 00000000000000..dbb8d1424f52a7 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query95.groovy @@ -0,0 +1,100 @@ +/* + * 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("query95") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """with ws_wh as +(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 + from web_sales ws1,web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2001-4-01' and + (cast('2001-4-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'VA' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and ws1.ws_order_number in (select ws_order_number + from ws_wh) +and ws1.ws_order_number in (select wr_order_number + from web_returns,ws_wh + where wr_order_number = ws_wh.ws_order_number) +order by count(distinct ws_order_number) +limit 100""" + qt_ds_shape_95 ''' + explain shape plan + with ws_wh as +(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 + from web_sales ws1,web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2001-4-01' and + (cast('2001-4-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'VA' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and ws1.ws_order_number in (select ws_order_number + from ws_wh) +and ws1.ws_order_number in (select wr_order_number + from web_returns,ws_wh + where wr_order_number = ws_wh.ws_order_number) +order by count(distinct ws_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query96.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query96.groovy new file mode 100644 index 00000000000000..925d7866adc8d5 --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query96.groovy @@ -0,0 +1,68 @@ +/* + * 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("query96") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select count(*) +from store_sales + ,household_demographics + ,time_dim, store +where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and household_demographics.hd_dep_count = 0 + and store.s_store_name = 'ese' +order by count(*) +limit 100""" + qt_ds_shape_96 ''' + explain shape plan + select count(*) +from store_sales + ,household_demographics + ,time_dim, store +where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and household_demographics.hd_dep_count = 0 + and store.s_store_name = 'ese' +order by count(*) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query97.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query97.groovy new file mode 100644 index 00000000000000..c799759663577b --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query97.groovy @@ -0,0 +1,89 @@ +/* + * 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("query97") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + multi_sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set enable_runtime_filter_prune=false; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=false; + set enable_stats=true; + set runtime_filter_type=8; + set broadcast_row_count_limit = 30000000; + set enable_nereids_timeout = false; + set enable_pipeline_engine = true; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set push_topn_to_agg = true; + set topn_opt_limit_threshold=1024; + """ + + def ds = """with ssci as ( +select ss_customer_sk customer_sk + ,ss_item_sk item_sk +from store_sales,date_dim +where ss_sold_date_sk = d_date_sk + and d_month_seq between 1199 and 1199 + 11 and ss_sold_date_sk IS NOT NULL +group by ss_customer_sk + ,ss_item_sk), +csci as( + select cs_bill_customer_sk customer_sk + ,cs_item_sk item_sk +from catalog_sales,date_dim +where cs_sold_date_sk = d_date_sk + and d_month_seq between 1199 and 1199 + 11 and cs_sold_date_sk IS NOT NULL +group by cs_bill_customer_sk + ,cs_item_sk) + select sum(case when ssci.customer_sk is not null and csci.customer_sk is null then 1 else 0 end) store_only + ,sum(case when ssci.customer_sk is null and csci.customer_sk is not null then 1 else 0 end) catalog_only + ,sum(case when ssci.customer_sk is not null and csci.customer_sk is not null then 1 else 0 end) store_and_catalog +from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk + and ssci.item_sk = csci.item_sk) +limit 100""" + qt_ds_shape_97 ''' + explain shape plan + with ssci as ( +select ss_customer_sk customer_sk + ,ss_item_sk item_sk +from store_sales,date_dim +where ss_sold_date_sk = d_date_sk + and d_month_seq between 1199 and 1199 + 11 and ss_sold_date_sk IS NOT NULL +group by ss_customer_sk + ,ss_item_sk), +csci as( + select cs_bill_customer_sk customer_sk + ,cs_item_sk item_sk +from catalog_sales,date_dim +where cs_sold_date_sk = d_date_sk + and d_month_seq between 1199 and 1199 + 11 and cs_sold_date_sk IS NOT NULL +group by cs_bill_customer_sk + ,cs_item_sk) + select sum(case when ssci.customer_sk is not null and csci.customer_sk is null then 1 else 0 end) store_only + ,sum(case when ssci.customer_sk is null and csci.customer_sk is not null then 1 else 0 end) catalog_only + ,sum(case when ssci.customer_sk is not null and csci.customer_sk is not null then 1 else 0 end) store_and_catalog +from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk + and ssci.item_sk = csci.item_sk) +limit 100 + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query98.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query98.groovy new file mode 100644 index 00000000000000..36b2d5cb45bc1d --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query98.groovy @@ -0,0 +1,102 @@ +/* + * 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("query98") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ss_ext_sales_price) as itemrevenue + ,sum(ss_ext_sales_price)*100/sum(sum(ss_ext_sales_price)) over + (partition by i_class) as revenueratio +from + store_sales + ,item + ,date_dim +where + ss_item_sk = i_item_sk + and i_category in ('Men', 'Sports', 'Jewelry') + and ss_sold_date_sk = d_date_sk + and d_date between cast('1999-02-05' as date) + and (cast('1999-02-05' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio""" + qt_ds_shape_98 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ss_ext_sales_price) as itemrevenue + ,sum(ss_ext_sales_price)*100/sum(sum(ss_ext_sales_price)) over + (partition by i_class) as revenueratio +from + store_sales + ,item + ,date_dim +where + ss_item_sk = i_item_sk + and i_category in ('Men', 'Sports', 'Jewelry') + and ss_sold_date_sk = d_date_sk + and d_date between cast('1999-02-05' as date) + and (cast('1999-02-05' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio + ''' +} diff --git a/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query99.groovy b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query99.groovy new file mode 100644 index 00000000000000..5377c23acb8ccd --- /dev/null +++ b/regression-test/suites/shape_check/tpcds_sf1000_nopkfk/shape/query99.groovy @@ -0,0 +1,106 @@ +/* + * 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("query99") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_nereids_distribute_planner=false' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set enable_nereids_timeout = false' + sql 'set enable_runtime_filter_prune=false' + sql 'set runtime_filter_type=8' + sql 'set dump_nereids_memo=false' + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + def ds = """select + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and + (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and + (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and + (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + catalog_sales + ,warehouse + ,ship_mode + ,call_center + ,date_dim +where + d_month_seq between 1194 and 1194 + 11 +and cs_ship_date_sk = d_date_sk +and cs_warehouse_sk = w_warehouse_sk +and cs_ship_mode_sk = sm_ship_mode_sk +and cs_call_center_sk = cc_call_center_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +limit 100""" + qt_ds_shape_99 ''' + explain shape plan + select + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and + (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and + (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and + (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + catalog_sales + ,warehouse + ,ship_mode + ,call_center + ,date_dim +where + d_month_seq between 1194 and 1194 + 11 +and cs_ship_date_sk = d_date_sk +and cs_warehouse_sk = w_warehouse_sk +and cs_ship_mode_sk = sm_ship_mode_sk +and cs_call_center_sk = cc_call_center_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +limit 100 + ''' +} From 0c69cedbf1d2dd6e6b07d38b8fefee5ee050d783 Mon Sep 17 00:00:00 2001 From: englefly Date: Wed, 11 Feb 2026 09:58:08 +0800 Subject: [PATCH 03/10] DORIS-24491 count->nvl(sum(x)) --- .../eageraggregation/PushDownAggregation.java | 9 +++++-- .../EagerAggRewriterTest.java | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index 07d94752437048..8337517942d125 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -49,6 +49,8 @@ import org.apache.doris.nereids.trees.expressions.functions.agg.RollUpTrait; import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; import org.apache.doris.nereids.trees.expressions.functions.scalar.If; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Nvl; +import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; @@ -237,9 +239,12 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte Slot pushedDownSlot = pushDownContext.getAliasMap().get(func).toSlot(); if (func instanceof Count) { // For count(A), after pushdown we have count(A) as x, - // and the top agg should use sum(x) instead of count(x) + // and the top agg should use sum(x) instead of count(x). + // Wrap with ifnull(..., 0) because COUNT never returns NULL, + // but after pushdown across an outer join, the intermediate count + // slot can be NULL (null-extended), making sum(NULL) = NULL. Function rollUpFunc = ((RollUpTrait) func).constructRollUp(pushedDownSlot); - replaceMap.put(func, rollUpFunc); + replaceMap.put(func, new Nvl(rollUpFunc, new BigIntLiteral(0))); } else if (func.arity() > 0) { // For sum/max/min, replace the child expression with the pushed down slot replaceMap.put(func.child(0), pushedDownSlot); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java index bf46829c4e097a..f01d5e67be3d21 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java @@ -110,4 +110,31 @@ void testPushDownCount() { connectContext.getSessionVariable().setEagerAggregationMode(0); } } + + @Test + void testPushDownCountThroughLeftJoinWrapsWithIfnull() { + // When count(right.col) is pushed down to the right side of a LEFT JOIN, + // the top aggregate rolls up count to sum. But when the LEFT JOIN has no + // matching right row, the intermediate count slot becomes NULL (null-extended), + // and sum(NULL) = NULL. The correct result should be 0 (COUNT never returns NULL). + // Fix: wrap the rolled-up sum with ifnull(sum(x), 0). + connectContext.getSessionVariable().setEagerAggregationMode(1); + connectContext.getSessionVariable().setDisableJoinReorder(true); + try { + String sql = "select count(t2.id2), t1.id1 from t1 left join t2" + + " on t1.name = t2.name group by t1.id1"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .matches(logicalProject(logicalAggregate(logicalProject(logicalJoin(any(), + logicalAggregate())))) + .when(project -> project.getProjects().stream().anyMatch( + expr -> expr.toString().contains("ifnull") + ))) + .printlnTree(); + } finally { + connectContext.getSessionVariable().setEagerAggregationMode(0); + connectContext.getSessionVariable().setDisableJoinReorder(false); + } + } } From a03d6cde81537009bc1d65a6b37cf4f813f2fa2d Mon Sep 17 00:00:00 2001 From: englefly Date: Wed, 11 Feb 2026 14:33:38 +0800 Subject: [PATCH 04/10] =?UTF-8?q?doris-24488=20count(if(...))=20if?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=95=B4=E4=BD=93=E4=B8=8B=E6=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eageraggregation/PushDownAggregation.java | 8 ++++++- .../EagerAggRewriterTest.java | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index 8337517942d125..bfd2b9bddec762 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -154,7 +154,13 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte AggregateFunction aggFunction = (AggregateFunction) obj; if (pushDownAggFunctionSet.contains(aggFunction.getClass()) && !aggFunction.isDistinct()) { - if (aggFunction.arity() > 0 && aggFunction.child(0) instanceof If) { + if (aggFunction.arity() > 0 && aggFunction.child(0) instanceof If + && !(aggFunction instanceof Count)) { + // Decompose Sum/Max/Min(If(cond, a, b)) into separate agg functions. + // Count(If(...)) is NOT decomposed here because the top-level + // replacement (Count->Sum rollup) cannot match the decomposed + // Count(a)/Count(b) as sub-expressions of the original Count(If(cond,a,b)). + // Count(If(...)) is pushed down as-is and rolled up normally. If body = (If) (aggFunction).child(0); Set valueSlots = Sets.newHashSet(body.getTrueValue().getInputSlots()); valueSlots.addAll(body.getFalseValue().getInputSlots()); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java index f01d5e67be3d21..e22d957360eabb 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java @@ -137,4 +137,28 @@ void testPushDownCountThroughLeftJoinWrapsWithIfnull() { connectContext.getSessionVariable().setDisableJoinReorder(false); } } + + @Test + void testPushDownCountWithIfChildShouldNotDecompose() { + // Count(If(cond, a, b)) should NOT be decomposed into Count(a) and Count(b) + // in the SumIf path, because the replacement logic cannot match decomposed + // Count(a)/Count(b) as sub-expressions of the original Count(If(cond, a, b)). + // This would cause "Input slot(s) not in child's output" error. + // Instead, Count(If(...)) should be pushed down as-is and rolled up via + // ifnull(sum(count_if_result), 0). + connectContext.getSessionVariable().setEagerAggregationMode(1); + connectContext.getSessionVariable().setDisableJoinReorder(true); + try { + String sql = "select count(case when t1.id1 > 3 then t1.name else 'x' end), t2.id2" + + " from t1 left join t2 on t1.name = t2.name group by t2.id2"; + // Should not throw "Input slot(s) not in child's output" + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .printlnTree(); + } finally { + connectContext.getSessionVariable().setEagerAggregationMode(0); + connectContext.getSessionVariable().setDisableJoinReorder(false); + } + } } From f5ce700bee3be56ed45b4d21c309867485a77f63 Mon Sep 17 00:00:00 2001 From: englefly Date: Wed, 11 Feb 2026 15:20:38 +0800 Subject: [PATCH 05/10] rename hasSumIf --- .../rewrite/eageraggregation/EagerAggRewriter.java | 8 ++++---- .../rewrite/eageraggregation/PushDownAggContext.java | 10 +++++----- .../rewrite/eageraggregation/PushDownAggregation.java | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java index 4484ecf20237f9..bb2ba0f1f0fdc8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -114,7 +114,7 @@ public Plan visitLogicalJoin(LogicalJoin join, P // this transform is incorrect, because right join condition is false, then x is null, // and the output is max(null)=null. // but the output of plan1 should be 1 - if (context.aggregateOnCaseWhen) { + if (context.hasDecomposedAggIf) { JoinType joinType = join.getJoinType(); if (joinType.isFullOuterJoin()) { return join; @@ -234,7 +234,7 @@ private PushDownAggContext createContextFromProject( aggFunctions.add(newAggFunc); } return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, - context.getCascadesContext(), context.isPassThroughBigJoin(), context.aggregateOnCaseWhen); + context.getCascadesContext(), context.isPassThroughBigJoin(), context.hasDecomposedAggIf); } private boolean canPushThroughProject(LogicalProject project, PushDownAggContext context) { @@ -337,7 +337,7 @@ but if agg can not pushdown through child2, the output of child2 is (a2, b2). .collect(Collectors.toList()); PushDownAggContext contextForChild = new PushDownAggContext(aggFunctionsForChild, groupKeysForChild, aliasMapForChild, context.getCascadesContext(), - context.isPassThroughBigJoin(), context.aggregateOnCaseWhen); + context.isPassThroughBigJoin(), context.hasDecomposedAggIf); childrenContext.add(contextForChild); if (contextForChild.isValid()) { Plan newChild = child.accept(this, contextForChild); @@ -496,7 +496,7 @@ private boolean checkStats(Plan plan, PushDownAggContext context) { return context.isPassThroughBigJoin(); } - if (!context.isPassThroughBigJoin() && !context.aggregateOnCaseWhen) { + if (!context.isPassThroughBigJoin() && !context.hasDecomposedAggIf) { return false; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java index 6ef312fb0de42d..379e9b41d4b75e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java @@ -37,7 +37,7 @@ */ public class PushDownAggContext { public static final int BIG_JOIN_BUILD_SIZE = 400_000; - public final boolean aggregateOnCaseWhen; + public final boolean hasDecomposedAggIf; private final List aggFunctions; private final List groupKeys; private final HashMap aliasMap; @@ -53,7 +53,7 @@ public class PushDownAggContext { */ public PushDownAggContext(List aggFunctions, List groupKeys, Map aliasMap, CascadesContext cascadesContext, - boolean passThroughBigJoin, boolean hasSumIf) { + boolean passThroughBigJoin, boolean hasDecomposedAggIf) { this.groupKeys = groupKeys.stream().distinct().collect(Collectors.toList()); this.aggFunctions = ImmutableList.copyOf(aggFunctions); this.cascadesContext = cascadesContext; @@ -79,7 +79,7 @@ public PushDownAggContext(List aggFunctions, .filter(Slot.class::isInstance) .collect(ImmutableSet.toImmutableSet()); this.passThroughBigJoin = passThroughBigJoin; - this.aggregateOnCaseWhen = hasSumIf; + this.hasDecomposedAggIf = hasDecomposedAggIf; } /** @@ -93,7 +93,7 @@ public boolean isValid() { public PushDownAggContext passThroughBigJoin() { return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, - true, aggregateOnCaseWhen); + true, hasDecomposedAggIf); } public HashMap getAliasMap() { @@ -110,7 +110,7 @@ public List getGroupKeys() { public PushDownAggContext withGroupKeys(List groupKeys) { return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, - cascadesContext, passThroughBigJoin, aggregateOnCaseWhen); + cascadesContext, passThroughBigJoin, hasDecomposedAggIf); } public Set getAggFunctionsInputSlots() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index bfd2b9bddec762..c120be0b93b006 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -145,7 +145,7 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte } Set aggFunctions = Sets.newHashSet(); - boolean hasSumIf = false; + boolean hasDecomposedAggIf = false; Map> aggFunctionsForOutputExpressions = Maps.newHashMap(); for (NamedExpression aggOutput : agg.getOutputExpressions()) { List funcs = Lists.newArrayList(); @@ -179,7 +179,7 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte } groupKeys.addAll(body.getCondition().getInputSlots() .stream().map(slot -> (SlotReference) slot).collect(Collectors.toList())); - hasSumIf = true; + hasDecomposedAggIf = true; } else { aggFunctions.add(aggFunction); funcs.add(aggFunction); @@ -197,7 +197,7 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte } PushDownAggContext pushDownContext = new PushDownAggContext(new ArrayList<>(aggFunctions), - groupKeys, null, context.getCascadesContext(), false, hasSumIf); + groupKeys, null, context.getCascadesContext(), false, hasDecomposedAggIf); if (!pushDownContext.isValid()) { return agg; } From 4900200db6d7f2a260147361258bd9e0255ce246 Mon Sep 17 00:00:00 2001 From: englefly Date: Wed, 11 Feb 2026 23:16:43 +0800 Subject: [PATCH 06/10] =?UTF-8?q?doris-24489=20join=20=E7=9A=84=E5=B7=A6?= =?UTF-8?q?=E5=8F=B3=E9=83=BD=E6=9C=89=E5=8F=AF=E4=BB=A5=E4=B8=8B=E6=8E=A8?= =?UTF-8?q?=E7=9A=84agg=E5=87=BD=E6=95=B0,=E5=8E=9F=E6=9D=A5=E6=98=AF?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=8E=A8=E5=88=B0join=E4=B8=8A,=E4=BD=86?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=AF=B9outer=20join=20=E5=81=9A=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4,=E4=B8=8D=E5=81=9A=E8=A1=A5null=E4=BE=A7=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E6=8E=A8,=E8=BF=99=E5=AF=BC=E8=87=B4agg=20=E6=8E=A8?= =?UTF-8?q?=E5=88=B0=E4=BA=86=E9=9D=9E=E8=A1=A5null=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eageraggregation/EagerAggRewriter.java | 15 +++++++-------- .../eageraggregation/PushDownAggregation.java | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java index bb2ba0f1f0fdc8..2c1a54694f3508 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -99,6 +99,13 @@ public Plan visitLogicalJoin(LogicalJoin join, P } } + if (pushHere || (toLeft && toRight)) { + if (SessionVariable.isEagerAggregationOnJoin()) { + return genAggregate(join, context); + } else { + return join; + } + } // Do not push aggregation to the nullable side of outer joins when agg function contains case-when. // plan1: // agg(max(case when t1.a is null then 1 else null end)) @@ -130,14 +137,6 @@ public Plan visitLogicalJoin(LogicalJoin join, P } } - if (pushHere || (toLeft && toRight)) { - if (SessionVariable.isEagerAggregationOnJoin()) { - return genAggregate(join, context); - } else { - return join; - } - } - List joinConditionSlots; List childGroupByKeys = new ArrayList<>(); if (toLeft) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index c120be0b93b006..364d2207f5bdce 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -152,8 +152,10 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte aggFunctionsForOutputExpressions.put(aggOutput, funcs); for (Object obj : aggOutput.collect(AggregateFunction.class::isInstance)) { AggregateFunction aggFunction = (AggregateFunction) obj; - if (pushDownAggFunctionSet.contains(aggFunction.getClass()) - && !aggFunction.isDistinct()) { + if (aggFunction.isDistinct()) { + return agg; + } + if (pushDownAggFunctionSet.contains(aggFunction.getClass())) { if (aggFunction.arity() > 0 && aggFunction.child(0) instanceof If && !(aggFunction instanceof Count)) { // Decompose Sum/Max/Min(If(cond, a, b)) into separate agg functions. From 7407bfee0c0c9ae2b69e3fce04cd4e83e024d919 Mon Sep 17 00:00:00 2001 From: englefly Date: Thu, 12 Feb 2026 09:52:29 +0800 Subject: [PATCH 07/10] =?UTF-8?q?ut=20PlanCheker=20=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=9B=B4=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nereids/pattern/DescribedPredicate.java | 52 ++++++++++++++ .../apache/doris/nereids/pattern/Pattern.java | 70 +++++++++++++++++++ .../nereids/pattern/PatternDescriptor.java | 5 ++ ...ushDownExpressionsInHashConditionTest.java | 8 +-- .../doris/nereids/util/MatchingUtils.java | 54 ++++++++++++++ .../doris/nereids/util/PlanChecker.java | 24 +++++-- 6 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/DescribedPredicate.java diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/DescribedPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/DescribedPredicate.java new file mode 100644 index 00000000000000..e94305355c1ef0 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/DescribedPredicate.java @@ -0,0 +1,52 @@ +// 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. + +package org.apache.doris.nereids.pattern; + +import java.util.function.Predicate; + +/** + * A predicate wrapper with a human-readable description. + * Used in pattern matching to provide better diagnostic messages when a predicate fails. + */ +public class DescribedPredicate implements Predicate { + private final String description; + private final Predicate delegate; + + public DescribedPredicate(String description, Predicate delegate) { + this.description = description; + this.delegate = delegate; + } + + public static DescribedPredicate of(String description, Predicate delegate) { + return new DescribedPredicate<>(description, delegate); + } + + @Override + public boolean test(T t) { + return delegate.test(t); + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return description; + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/Pattern.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/Pattern.java index 4b28a93fa93b10..6f0da7b866fd66 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/Pattern.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/Pattern.java @@ -203,6 +203,76 @@ public boolean matchPredicates(TYPE root) { return true; } + /** + * Diagnostic version of matchPlanTree. Returns null if match succeeds, + * or a human-readable failure reason string if match fails. + * + * @param plan the plan to match against + * @param path the current path in the tree (e.g. "root/child[0]/child[1]") + * @return null if matched, or a diagnostic message describing where and why the match failed + */ + public String matchPlanTreeDiagnostic(Plan plan, String path) { + if (!matchRoot(plan)) { + return path + ": expected node type " + planType + " but got " + plan.getType(); + } + int childPatternNum = arity(); + if (childPatternNum != plan.arity() && childPatternNum > 0 && child(childPatternNum - 1) != MULTI) { + return path + ": expected " + childPatternNum + " children but got " + plan.arity() + + " on node " + plan.getType(); + } + switch (patternType) { + case ANY: + case MULTI: + return matchPredicatesDiagnostic((TYPE) plan, path); + default: + } + if (this instanceof SubTreePattern) { + return matchPredicatesDiagnostic((TYPE) plan, path); + } + return matchChildrenAndSelfPredicatesDiagnostic(plan, childPatternNum, path); + } + + private String matchChildrenAndSelfPredicatesDiagnostic(Plan plan, int childPatternNum, String path) { + List childrenPlan = plan.children(); + for (int i = 0; i < childrenPlan.size(); i++) { + Plan child = childrenPlan.get(i); + Pattern childPattern = child(Math.min(i, childPatternNum - 1)); + String childPath = path + "/" + plan.getType() + ".child[" + i + "]"; + String childResult = childPattern.matchPlanTreeDiagnostic(child, childPath); + if (childResult != null) { + return childResult; + } + } + return matchPredicatesDiagnostic((TYPE) plan, path); + } + + /** + * Diagnostic version of matchPredicates. Returns null if all predicates pass, + * or a message describing which predicate failed. + */ + public String matchPredicatesDiagnostic(TYPE root, String path) { + for (int i = 0; i < predicates.size(); i++) { + Predicate predicate = predicates.get(i); + try { + if (!predicate.test(root)) { + String predicateDesc = (predicate instanceof DescribedPredicate) + ? ((DescribedPredicate) predicate).getDescription() + : "predicate #" + (i + 1); + return path + " (" + root.getType() + "): " + predicateDesc + + " failed. [predicate " + (i + 1) + "/" + predicates.size() + "]"; + } + } catch (Throwable t) { + String predicateDesc = (predicate instanceof DescribedPredicate) + ? ((DescribedPredicate) predicate).getDescription() + : "predicate #" + (i + 1); + return path + " (" + root.getType() + "): " + predicateDesc + + " threw " + t.getClass().getSimpleName() + ": " + t.getMessage() + + " [predicate " + (i + 1) + "/" + predicates.size() + "]"; + } + } + return null; + } + @Override public Pattern withChildren( List> children) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/PatternDescriptor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/PatternDescriptor.java index a3a2baee282821..b1dacb8f0c7ad5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/PatternDescriptor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/PatternDescriptor.java @@ -51,6 +51,11 @@ public PatternDescriptor when(Predicate predicate) { return new PatternDescriptor<>(pattern.withPredicates(predicates), defaultPromise); } + /** when with description, the description will be shown in diagnostic message when predicate fails */ + public PatternDescriptor when(String description, Predicate predicate) { + return when(DescribedPredicate.of(description, predicate)); + } + public PatternDescriptor whenNot(Predicate predicate) { return when(predicate.negate()); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownExpressionsInHashConditionTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownExpressionsInHashConditionTest.java index 7f860062b0e54a..0eaccde391fe6f 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownExpressionsInHashConditionTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownExpressionsInHashConditionTest.java @@ -235,7 +235,7 @@ public void testPushDownMarkConjuncts() { PlanChecker.from(connectContext, plan).applyTopDown(new PushDownExpressionsInHashCondition()) .matches(logicalJoin(logicalProject(logicalOneRowRelation()) - .when(p -> p.getProjects().size() == 4 + .when("left project", p -> p.getProjects().size() == 4 && p.getProjects().stream().filter(Alias.class::isInstance) .map(Alias.class::cast).map(UnaryNode::child) .filter(sameLeft::equals).count() == 1 @@ -246,7 +246,7 @@ public void testPushDownMarkConjuncts() { .map(Alias.class::cast).map(UnaryNode::child) .filter(hashLeft::equals).count() == 1), logicalProject(logicalOneRowRelation()) - .when(p -> p.getProjects().size() == 4 + .when("right project", p -> p.getProjects().size() == 4 && p.getProjects().stream().filter(Alias.class::isInstance) .map(Alias.class::cast).map(UnaryNode::child) .filter(sameRight::equals).count() == 1 @@ -256,12 +256,12 @@ public void testPushDownMarkConjuncts() { && p.getProjects().stream().filter(Alias.class::isInstance) .map(Alias.class::cast).map(UnaryNode::child) .filter(hashRight::equals).count() == 1) - ).when(j -> j.getMarkJoinConjuncts().size() == 3 + ).when("join mark condition", j -> j.getMarkJoinConjuncts().size() == 3 && j.getMarkJoinConjuncts().stream().filter(EqualTo.class::isInstance) .allMatch(e -> ((EqualTo) e).left() instanceof SlotReference && ((EqualTo) e).right() instanceof SlotReference) && j.getMarkJoinConjuncts().stream().filter(EqualTo.class::isInstance).count() == 2) - .when(j -> j.getHashJoinConjuncts().size() == 2 + .when("join hash condition", j -> j.getHashJoinConjuncts().size() == 2 && j.getHashJoinConjuncts().stream().filter(EqualTo.class::isInstance) .allMatch(e -> ((EqualTo) e).left() instanceof SlotReference && ((EqualTo) e).right() instanceof SlotReference) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/MatchingUtils.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/MatchingUtils.java index b1beb5a52f6af4..c6f3c338ea9375 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/MatchingUtils.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/MatchingUtils.java @@ -31,6 +31,9 @@ import com.google.common.base.Supplier; import org.junit.jupiter.api.Assertions; +import java.util.ArrayList; +import java.util.List; + public class MatchingUtils { public static void assertMatches(Plan plan, PatternDescriptor patternDesc) { @@ -90,4 +93,55 @@ public static boolean topDownFindMatch(GroupExpression groupExpression, Pattern< } return false; } + + /** + * Diagnostic version: find the best partial match in the memo and return + * a description of where/why the match failed. Returns null if match succeeds. + */ + public static String topDownFindMatchingDiagnostic(Group group, Pattern pattern) { + // First try to match from root - this is the most common case in tests. + // We run the diagnostic on the copied-out plan from each root group expression. + String bestDiagnostic = null; + + for (GroupExpression logicalExpr : group.getLogicalExpressions()) { + Plan copiedPlan = copyOutFromGroupExpression(logicalExpr); + String diagnostic = ((Pattern) pattern).matchPlanTreeDiagnostic(copiedPlan, "root"); + if (diagnostic == null) { + return null; // match found + } + if (bestDiagnostic == null) { + bestDiagnostic = diagnostic; + } + } + + for (GroupExpression physicalExpr : group.getPhysicalExpressions()) { + Plan copiedPlan = copyOutFromGroupExpression(physicalExpr); + String diagnostic = ((Pattern) pattern).matchPlanTreeDiagnostic(copiedPlan, "root"); + if (diagnostic == null) { + return null; + } + if (bestDiagnostic == null) { + bestDiagnostic = diagnostic; + } + } + + return bestDiagnostic != null ? bestDiagnostic : "no group expressions found in root group"; + } + + private static Plan copyOutFromGroupExpression(GroupExpression groupExpression) { + Plan plan = groupExpression.getPlan(); + List children = new ArrayList<>(); + for (Group childGroup : groupExpression.children()) { + // pick first logical expression, fallback to first physical + if (!childGroup.getLogicalExpressions().isEmpty()) { + children.add(copyOutFromGroupExpression(childGroup.getLogicalExpressions().get(0))); + } else if (!childGroup.getPhysicalExpressions().isEmpty()) { + children.add(copyOutFromGroupExpression(childGroup.getPhysicalExpressions().get(0))); + } + } + if (!children.isEmpty()) { + return plan.withChildren(children); + } + return plan; + } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java index be5a92ef08be5c..433ad2f0177482 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java @@ -43,6 +43,7 @@ import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.pattern.GroupExpressionMatching; import org.apache.doris.nereids.pattern.MatchingContext; +import org.apache.doris.nereids.pattern.Pattern; import org.apache.doris.nereids.pattern.PatternDescriptor; import org.apache.doris.nereids.pattern.PatternMatcher; import org.apache.doris.nereids.processor.post.Validator; @@ -616,8 +617,9 @@ public PlanChecker deriveStats() { public PlanChecker matchesFromRoot(PatternDescriptor patternDesc) { Memo memo = cascadesContext.getMemo(); - assertMatches(memo, () -> new GroupExpressionMatching(patternDesc.pattern, - memo.getRoot().getLogicalExpression()).iterator().hasNext()); + assertMatchesWithDiagnostic(memo, patternDesc.pattern, + () -> new GroupExpressionMatching(patternDesc.pattern, + memo.getRoot().getLogicalExpression()).iterator().hasNext()); return this; } @@ -631,7 +633,8 @@ public PlanChecker notMatchesFromRoot(PatternDescriptor patternD public PlanChecker matches(PatternDescriptor patternDesc) { Memo memo = cascadesContext.getMemo(); checkSlotFromChildren(memo); - assertMatches(memo, () -> MatchingUtils.topDownFindMatching(memo.getRoot(), patternDesc.pattern)); + assertMatchesWithDiagnostic(memo, patternDesc.pattern, + () -> MatchingUtils.topDownFindMatching(memo.getRoot(), patternDesc.pattern)); return this; } @@ -641,7 +644,7 @@ public PlanChecker anyMatches(PatternDescriptor patternDesc) { Memo memo = cascadesContext.getMemo(); checkSlotFromChildren(memo); matchResult.add(MatchingUtils.topDownFindMatching(memo.getRoot(), patternDesc.pattern)); - assertMatches(memo, () -> matchResult.contains(true)); + assertMatchesWithDiagnostic(memo, patternDesc.pattern, () -> matchResult.contains(true)); return this; } @@ -655,7 +658,8 @@ public PlanChecker nonMatch(PatternDescriptor patternDesc) { // TODO: remove it. public PlanChecker matchesNotCheck(PatternDescriptor patternDesc) { Memo memo = cascadesContext.getMemo(); - assertMatches(memo, () -> MatchingUtils.topDownFindMatching(memo.getRoot(), patternDesc.pattern)); + assertMatchesWithDiagnostic(memo, patternDesc.pattern, + () -> MatchingUtils.topDownFindMatching(memo.getRoot(), patternDesc.pattern)); return this; } @@ -685,6 +689,16 @@ private PlanChecker assertMatches(Memo memo, Supplier asserter) { return this; } + private PlanChecker assertMatchesWithDiagnostic(Memo memo, + Pattern pattern, Supplier asserter) { + if (!asserter.get()) { + String diagnostic = MatchingUtils.topDownFindMatchingDiagnostic(memo.getRoot(), pattern); + Assertions.fail("pattern not match.\nDiagnosis: " + diagnostic + + "\nActual plan:\n" + memo.copyOut().treeString() + "\n"); + } + return this; + } + public PlanChecker checkGroupNum(int expectGroupNum) { Assertions.assertEquals(expectGroupNum, cascadesContext.getMemo().getGroups().size()); return this; From 89a0cda2d44e3d66514605f81551b47c54756562 Mon Sep 17 00:00:00 2001 From: englefly Date: Fri, 13 Feb 2026 10:58:08 +0800 Subject: [PATCH 08/10] rebase update and update shape --- .../doris/nereids/jobs/executor/Rewriter.java | 64 +++++++-------- .../tpcds_sf100/rf_prune/query14.out | 78 +++++++++++-------- .../shape_check/tpcds_sf100/shape/query14.out | 78 +++++++++++-------- .../shape_check/tpcds_sf1000/hint/query14.out | 78 +++++++++++-------- .../tpcds_sf1000_nopkfk/shape/query72.out | 30 +++---- .../data/shape_check/tpch_sf1000/hint/q13.out | 11 ++- .../shape_check/tpch_sf1000/rf_prune/q13.out | 11 ++- 7 files changed, 197 insertions(+), 153 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java index 57192e8ab8d5c9..00be607fc94fa0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java @@ -920,41 +920,43 @@ private static List getWholeTreeRewriteJobs( custom(RuleType.DISTINCT_AGG_STRATEGY_SELECTOR, () -> DistinctAggStrategySelector.INSTANCE)))); - // Rewrite search function before VariantSubPathPruning - // so that ElementAt expressions from search can be processed - rewriteJobs.addAll(jobs( - bottomUp(new RewriteSearchToSlots()) - )); + // Rewrite search function before VariantSubPathPruning + // so that ElementAt expressions from search can be processed + rewriteJobs.addAll(jobs( + bottomUp(new RewriteSearchToSlots()) + )); - if (needSubPathPushDown) { + if (needSubPathPushDown) { + rewriteJobs.addAll(jobs( + topic("variant element_at push down", + custom(RuleType.VARIANT_SUB_PATH_PRUNING, VariantSubPathPruning::new) + ) + )); + } + rewriteJobs.add( + topic("nested column prune", + custom(RuleType.NESTED_COLUMN_PRUNING, NestedColumnPruning::new) + ) + ); rewriteJobs.addAll(jobs( - topic("variant element_at push down", - custom(RuleType.VARIANT_SUB_PATH_PRUNING, VariantSubPathPruning::new) + topic("rewrite cte sub-tree after sub path push down", + custom(RuleType.CLEAR_CONTEXT_STATUS, ClearContextStatus::new), + custom(RuleType.REWRITE_CTE_CHILDREN, + () -> new RewriteCteChildren(afterPushDownJobs, runCboRules) + ) + ), + topic("whole plan check", + custom(RuleType.ADJUST_NULLABLE, () -> new AdjustNullable(false)) + ), + // NullableDependentExpressionRewrite need to be done after nullable fixed + topic("condition function", bottomUp(ImmutableList.of( + new NullableDependentExpressionRewrite()))) ) - )); + ); + return rewriteJobs; } - rewriteJobs.add( - topic("nested column prune", - custom(RuleType.NESTED_COLUMN_PRUNING, NestedColumnPruning::new) - ) - ); - rewriteJobs.addAll(jobs( - topic("rewrite cte sub-tree after sub path push down", - custom(RuleType.CLEAR_CONTEXT_STATUS, ClearContextStatus::new), - custom(RuleType.REWRITE_CTE_CHILDREN, - () -> new RewriteCteChildren(afterPushDownJobs, runCboRules) - ) - ), - topic("whole plan check", - custom(RuleType.ADJUST_NULLABLE, () -> new AdjustNullable(false)) - ), - // NullableDependentExpressionRewrite need to be done after nullable fixed - topic("condition function", bottomUp(ImmutableList.of( - new NullableDependentExpressionRewrite()))) - )); - return rewriteJobs; - } - ); + )); + return builder.build(); } @Override diff --git a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query14.out b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query14.out index 9c4d0b19325a8a..c773f1778706a8 100644 --- a/regression-test/data/shape_check/tpcds_sf100/rf_prune/query14.out +++ b/regression-test/data/shape_check/tpcds_sf100/rf_prune/query14.out @@ -82,18 +82,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[ss_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF11 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -104,18 +108,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[cs_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -126,18 +134,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() ---------------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] 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 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF17 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) diff --git a/regression-test/data/shape_check/tpcds_sf100/shape/query14.out b/regression-test/data/shape_check/tpcds_sf100/shape/query14.out index cbcaf12a80eefc..7e98074dd3d1a9 100644 --- a/regression-test/data/shape_check/tpcds_sf100/shape/query14.out +++ b/regression-test/data/shape_check/tpcds_sf100/shape/query14.out @@ -82,18 +82,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF11 ss_item_sk->[ss_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[ss_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[i_item_sk,ss_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF12 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -104,18 +108,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[cs_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[cs_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk,i_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[cs_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF15 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -126,18 +134,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF18 i_item_sk->[ss_item_sk,ws_item_sk] ---------------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 ss_item_sk->[ws_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] 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 RF18 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF18 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ss_item_sk->[i_item_sk,ws_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[ws_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 RF18 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF18 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) diff --git a/regression-test/data/shape_check/tpcds_sf1000/hint/query14.out b/regression-test/data/shape_check/tpcds_sf1000/hint/query14.out index 81cae62c393eba..19bdbc88c3ae9c 100644 --- a/regression-test/data/shape_check/tpcds_sf1000/hint/query14.out +++ b/regression-test/data/shape_check/tpcds_sf1000/hint/query14.out @@ -82,18 +82,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF11 ss_item_sk->[ss_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[ss_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[i_item_sk,ss_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 RF12 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF12 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -104,18 +108,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] 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 broadcast] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[cs_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[cs_sold_date_sk] ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk,i_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[cs_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF13 RF14 RF15 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF15 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) @@ -126,18 +134,22 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalDistribute[DistributionSpecHash] --------------------------hashAgg[LOCAL] ----------------------------PhysicalProject -------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF18 i_item_sk->[ss_item_sk,ws_item_sk] ---------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 ss_item_sk->[ws_item_sk] -----------------------------------PhysicalProject -------------------------------------hashJoin[INNER_JOIN broadcast] 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 RF18 ---------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF18 +------------------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ss_item_sk->[i_item_sk,ws_item_sk] --------------------------------PhysicalProject -----------------------------------PhysicalOlapScan[item] +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[ws_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[ws_item_sk] +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17 RF18 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] apply RFs: RF18 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------PhysicalAssertNumRows ----------------------PhysicalDistribute[DistributionSpecGather] ------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) diff --git a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out index e3b47aad8ef6de..686fb1c095d0ba 100644 --- a/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out +++ b/regression-test/data/shape_check/tpcds_sf1000_nopkfk/shape/query72.out @@ -8,18 +8,18 @@ PhysicalResultSink ----------PhysicalDistribute[DistributionSpecHash] ------------hashAgg[LOCAL] --------------PhysicalProject -----------------hashJoin[LEFT_OUTER_JOIN bucketShuffle] hashCondition=((catalog_returns.cr_item_sk = catalog_sales.cs_item_sk) and (catalog_returns.cr_order_number = catalog_sales.cs_order_number)) otherCondition=() +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((warehouse.w_warehouse_sk = inventory.inv_warehouse_sk)) otherCondition=() build RFs:RF10 w_warehouse_sk->[inv_warehouse_sk] ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN broadcast] hashCondition=((warehouse.w_warehouse_sk = inventory.inv_warehouse_sk)) otherCondition=() build RFs:RF8 w_warehouse_sk->[inv_warehouse_sk] +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk) and (inventory.inv_date_sk = d2.d_date_sk)) otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity)) build RFs:RF8 d_date_sk->[inv_date_sk];RF9 cs_item_sk->[inv_item_sk] +----------------------PhysicalOlapScan[inventory] apply RFs: RF8 RF9 RF10 ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk) and (inventory.inv_date_sk = d2.d_date_sk)) otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity)) build RFs:RF6 d_date_sk->[inv_date_sk];RF7 cs_item_sk->[inv_item_sk] ---------------------------PhysicalOlapScan[inventory] apply RFs: RF6 RF7 RF8 +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF7 i_item_sk->[cs_item_sk] --------------------------PhysicalProject -----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_week_seq = d2.d_week_seq)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq] +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_week_seq = d2.d_week_seq)) otherCondition=() build RFs:RF6 d_week_seq->[d_week_seq] ------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[date_dim(d2)] apply RFs: RF5 -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +--------------------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((catalog_returns.cr_item_sk = catalog_sales.cs_item_sk) and (catalog_returns.cr_order_number = catalog_sales.cs_order_number)) otherCondition=() build RFs:RF4 cs_item_sk->[cr_item_sk];RF5 cs_order_number->[cr_order_number] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF4 RF5 ----------------------------------PhysicalProject ------------------------------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() --------------------------------------PhysicalProject @@ -29,14 +29,14 @@ PhysicalResultSink ----------------------------------------------PhysicalProject ------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_date_sk = d3.d_date_sk) and (catalog_sales.cs_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_ship_date_sk];RF1 d_date_sk->[cs_sold_date_sk] --------------------------------------------------PhysicalProject -----------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +----------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 RF7 --------------------------------------------------PhysicalProject ----------------------------------------------------NestedLoopJoin[INNER_JOIN](d3.d_date > days_add(d_date, 5)) ------------------------------------------------------PhysicalProject --------------------------------------------------------PhysicalOlapScan[date_dim(d3)] ------------------------------------------------------PhysicalProject --------------------------------------------------------filter((d1.d_year = 1998)) -----------------------------------------------------------PhysicalOlapScan[date_dim(d1)] +----------------------------------------------------------PhysicalOlapScan[date_dim(d1)] apply RFs: RF6 ----------------------------------------------PhysicalProject ------------------------------------------------filter((household_demographics.hd_buy_potential = '1001-5000')) --------------------------------------------------PhysicalOlapScan[household_demographics] @@ -45,12 +45,12 @@ PhysicalResultSink ----------------------------------------------PhysicalOlapScan[customer_demographics] --------------------------------------PhysicalProject ----------------------------------------PhysicalOlapScan[promotion] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[item] -----------------------PhysicalProject -------------------------PhysicalOlapScan[warehouse] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[date_dim(d2)] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] ------------------PhysicalProject ---------------------PhysicalOlapScan[catalog_returns] +--------------------PhysicalOlapScan[warehouse] diff --git a/regression-test/data/shape_check/tpch_sf1000/hint/q13.out b/regression-test/data/shape_check/tpch_sf1000/hint/q13.out index a04a56b1345f43..f838d963e0e0ae 100644 --- a/regression-test/data/shape_check/tpch_sf1000/hint/q13.out +++ b/regression-test/data/shape_check/tpch_sf1000/hint/q13.out @@ -10,10 +10,13 @@ PhysicalResultSink --------------PhysicalProject ----------------hashAgg[GLOBAL] ------------------PhysicalProject ---------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() -----------------------PhysicalProject -------------------------filter(( not (o_comment like '%special%requests%'))) ---------------------------PhysicalOlapScan[orders] +--------------------hashJoin[RIGHT_OUTER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(( not (o_comment like '%special%requests%'))) +--------------------------------PhysicalOlapScan[orders] ----------------------PhysicalProject ------------------------PhysicalOlapScan[customer] diff --git a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q13.out b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q13.out index 6165574e0ee265..a9c26e203f3c44 100644 --- a/regression-test/data/shape_check/tpch_sf1000/rf_prune/q13.out +++ b/regression-test/data/shape_check/tpch_sf1000/rf_prune/q13.out @@ -10,10 +10,13 @@ PhysicalResultSink --------------PhysicalProject ----------------hashAgg[GLOBAL] ------------------PhysicalProject ---------------------hashJoin[RIGHT_OUTER_JOIN shuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() -----------------------PhysicalProject -------------------------filter(( not (o_comment like '%special%requests%'))) ---------------------------PhysicalOlapScan[orders] +--------------------hashJoin[LEFT_OUTER_JOIN bucketShuffle] hashCondition=((customer.c_custkey = orders.o_custkey)) otherCondition=() ----------------------PhysicalProject ------------------------PhysicalOlapScan[customer] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(( not (o_comment like '%special%requests%'))) +--------------------------------PhysicalOlapScan[orders] From 1ec21e6f8e72b193084c3c2efb8f155cd422abeb Mon Sep 17 00:00:00 2001 From: englefly Date: Sat, 14 Feb 2026 00:35:14 +0800 Subject: [PATCH 09/10] =?UTF-8?q?doris-24538=20count(1)=20=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E4=B8=8B=E6=8E=A8=E5=88=B0outer=20join=E7=9A=84?= =?UTF-8?q?=E8=A1=A5null=20=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eageraggregation/EagerAggRewriter.java | 38 +++++++++++++++++++ .../EagerAggRewriterTest.java | 24 ++++++++++++ 2 files changed, 62 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java index 2c1a54694f3508..3cb850de89cb69 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -27,6 +27,7 @@ import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; +import org.apache.doris.nereids.trees.expressions.functions.agg.Count; import org.apache.doris.nereids.trees.plans.JoinType; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; @@ -49,6 +50,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; /** @@ -137,6 +139,42 @@ public Plan visitLogicalJoin(LogicalJoin join, P } } + // Do not push count(*)/count(literal)/count(preserved_side_col) to the nullable side of outer joins. + // count(*) counts all physical rows, including null-extended rows from the outer join. + // After pushdown to the nullable side, unmatched rows produce NULL for the pre-aggregated count, + // and ifnull(sum(NULL), 0) = 0, which loses the count of unmatched rows. + // However, count(nullable_side_col) is safe to push down because for unmatched rows, + // nullable_side_col IS NULL, so the original count is 0, matching ifnull(sum(NULL), 0) = 0. + if (!join.getJoinType().isInnerJoin() && !join.getJoinType().isCrossJoin()) { + JoinType joinType = join.getJoinType(); + for (AggregateFunction aggFunc : context.getAggFunctions()) { + if (aggFunc instanceof Count) { + Set countInputSlots = aggFunc.getInputSlots(); + // Determine which side is nullable + boolean leftIsNullable = joinType.isRightOuterJoin() || joinType.isFullOuterJoin(); + boolean rightIsNullable = joinType.isLeftOuterJoin() || joinType.isFullOuterJoin(); + // Check if we're pushing to a nullable side without referencing its columns + if (toLeft && leftIsNullable) { + boolean hasLeftInput = countInputSlots.stream() + .anyMatch(slot -> join.left().getOutputSet().contains(slot)); + if (!hasLeftInput) { + toLeft = false; + } + } + if (toRight && rightIsNullable) { + boolean hasRightInput = countInputSlots.stream() + .anyMatch(slot -> join.right().getOutputSet().contains(slot)); + if (!hasRightInput) { + toRight = false; + } + } + } + } + if (!toLeft && !toRight && !pushHere) { + return join; + } + } + List joinConditionSlots; List childGroupByKeys = new ArrayList<>(); if (toLeft) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java index e22d957360eabb..902c88f6588b9f 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriterTest.java @@ -138,6 +138,30 @@ void testPushDownCountThroughLeftJoinWrapsWithIfnull() { } } + @Test + void testNotPushCountStarToNullableSideOfOuterJoin() { + // count(*)/count(1) counts all physical rows including null-extended rows. + // Pushing it to the nullable side loses the count of unmatched rows: + // original: count(*) on unmatched row = 1 + // pushed: ifnull(sum(NULL), 0) = 0 (wrong!) + // So count(*)/count(1) must NOT be pushed to the nullable side. + connectContext.getSessionVariable().setEagerAggregationMode(1); + connectContext.getSessionVariable().setDisableJoinReorder(true); + try { + // LEFT JOIN: right side (t1) is nullable, count(*) should NOT push to right + String sql = "select count(1), t2.id2 from t2 left join t1" + + " on t2.name = t1.name group by t2.id2"; + PlanChecker.from(connectContext) + .analyze(sql) + .rewrite() + .nonMatch(logicalJoin(any(), logicalAggregate())) + .printlnTree(); + } finally { + connectContext.getSessionVariable().setEagerAggregationMode(0); + connectContext.getSessionVariable().setDisableJoinReorder(false); + } + } + @Test void testPushDownCountWithIfChildShouldNotDecompose() { // Count(If(cond, a, b)) should NOT be decomposed into Count(a) and Count(b) From f90def55f7e6340e69de14ccf648f940ba0378c3 Mon Sep 17 00:00:00 2001 From: englefly Date: Sat, 14 Feb 2026 10:34:40 +0800 Subject: [PATCH 10/10] =?UTF-8?q?doris-24539:=20case-when=20=E4=B8=8D?= =?UTF-8?q?=E4=B8=8B=E6=8E=A8outer=20join=20=E8=A1=A5null=20=E4=B8=80?= =?UTF-8?q?=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eageraggregation/EagerAggRewriter.java | 23 +++++-------------- .../eageraggregation/PushDownAggContext.java | 13 ++++++++--- .../eageraggregation/PushDownAggregation.java | 7 +++++- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java index 3cb850de89cb69..8dc85ba3a444b5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java @@ -109,21 +109,9 @@ public Plan visitLogicalJoin(LogicalJoin join, P } } // Do not push aggregation to the nullable side of outer joins when agg function contains case-when. - // plan1: - // agg(max(case when t1.a is null then 1 else null end)) - // --> right join on false - // --> t1 - // --> t2 - // => - // plan2: - // agg(max(x)) - // --> right join on false - // --> agg((case when t1.a is null when 1 else null end) as x) - // --> t2 - // this transform is incorrect, because right join condition is false, then x is null, - // and the output is max(null)=null. - // but the output of plan1 should be 1 - if (context.hasDecomposedAggIf) { + // CaseWhen expressions may produce non-null values from null-padded rows (e.g., WHEN col IS NULL THEN -54), + // so pre-aggregation before the join loses those contributions. + if (context.hasDecomposedAggIf || context.hasCaseWhen) { JoinType joinType = join.getJoinType(); if (joinType.isFullOuterJoin()) { return join; @@ -271,7 +259,8 @@ private PushDownAggContext createContextFromProject( aggFunctions.add(newAggFunc); } return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, - context.getCascadesContext(), context.isPassThroughBigJoin(), context.hasDecomposedAggIf); + context.getCascadesContext(), context.isPassThroughBigJoin(), + context.hasDecomposedAggIf, context.hasCaseWhen); } private boolean canPushThroughProject(LogicalProject project, PushDownAggContext context) { @@ -374,7 +363,7 @@ but if agg can not pushdown through child2, the output of child2 is (a2, b2). .collect(Collectors.toList()); PushDownAggContext contextForChild = new PushDownAggContext(aggFunctionsForChild, groupKeysForChild, aliasMapForChild, context.getCascadesContext(), - context.isPassThroughBigJoin(), context.hasDecomposedAggIf); + context.isPassThroughBigJoin(), context.hasDecomposedAggIf, context.hasCaseWhen); childrenContext.add(contextForChild); if (contextForChild.isValid()) { Plan newChild = child.accept(this, contextForChild); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java index 379e9b41d4b75e..17686d006a7cb4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggContext.java @@ -37,7 +37,13 @@ */ public class PushDownAggContext { public static final int BIG_JOIN_BUILD_SIZE = 400_000; + // count(if(...)): if(...) push down as a whole + // sum/min/max(if(truePart, elsePart)): if(...) can be split to sum(truePart) and sum(elsePart) public final boolean hasDecomposedAggIf; + // When aggFunc(if(...)) is present, pushing down the null-supplemented side of the outer join is avoided. + // This is because null values are highly error-prone, + // so the push-down operation is not performed during hashCaseWhen. + public final boolean hasCaseWhen; private final List aggFunctions; private final List groupKeys; private final HashMap aliasMap; @@ -53,7 +59,7 @@ public class PushDownAggContext { */ public PushDownAggContext(List aggFunctions, List groupKeys, Map aliasMap, CascadesContext cascadesContext, - boolean passThroughBigJoin, boolean hasDecomposedAggIf) { + boolean passThroughBigJoin, boolean hasDecomposedAggIf, boolean hasCaseWhen) { this.groupKeys = groupKeys.stream().distinct().collect(Collectors.toList()); this.aggFunctions = ImmutableList.copyOf(aggFunctions); this.cascadesContext = cascadesContext; @@ -80,6 +86,7 @@ public PushDownAggContext(List aggFunctions, .collect(ImmutableSet.toImmutableSet()); this.passThroughBigJoin = passThroughBigJoin; this.hasDecomposedAggIf = hasDecomposedAggIf; + this.hasCaseWhen = hasCaseWhen; } /** @@ -93,7 +100,7 @@ public boolean isValid() { public PushDownAggContext passThroughBigJoin() { return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, cascadesContext, - true, hasDecomposedAggIf); + true, hasDecomposedAggIf, hasCaseWhen); } public HashMap getAliasMap() { @@ -110,7 +117,7 @@ public List getGroupKeys() { public PushDownAggContext withGroupKeys(List groupKeys) { return new PushDownAggContext(aggFunctions, groupKeys, aliasMap, - cascadesContext, passThroughBigJoin, hasDecomposedAggIf); + cascadesContext, passThroughBigJoin, hasDecomposedAggIf, hasCaseWhen); } public Set getAggFunctionsInputSlots() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java index 364d2207f5bdce..f15149eb22993a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/PushDownAggregation.java @@ -37,6 +37,7 @@ import org.apache.doris.nereids.jobs.JobContext; import org.apache.doris.nereids.rules.analysis.NormalizeAggregate; import org.apache.doris.nereids.rules.rewrite.AdjustNullable; +import org.apache.doris.nereids.trees.expressions.CaseWhen; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; @@ -146,6 +147,7 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte Set aggFunctions = Sets.newHashSet(); boolean hasDecomposedAggIf = false; + boolean hasCaseWhen = false; Map> aggFunctionsForOutputExpressions = Maps.newHashMap(); for (NamedExpression aggOutput : agg.getOutputExpressions()) { List funcs = Lists.newArrayList(); @@ -156,6 +158,9 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte return agg; } if (pushDownAggFunctionSet.contains(aggFunction.getClass())) { + if (!hasCaseWhen && aggFunction.anyMatch(e -> e instanceof CaseWhen)) { + hasCaseWhen = true; + } if (aggFunction.arity() > 0 && aggFunction.child(0) instanceof If && !(aggFunction instanceof Count)) { // Decompose Sum/Max/Min(If(cond, a, b)) into separate agg functions. @@ -199,7 +204,7 @@ public Plan visitLogicalAggregate(LogicalAggregate agg, JobConte } PushDownAggContext pushDownContext = new PushDownAggContext(new ArrayList<>(aggFunctions), - groupKeys, null, context.getCascadesContext(), false, hasDecomposedAggIf); + groupKeys, null, context.getCascadesContext(), false, hasDecomposedAggIf, hasCaseWhen); if (!pushDownContext.isValid()) { return agg; }