From d2b56259e00f349348d6f4b93a47ba71a7066e73 Mon Sep 17 00:00:00 2001 From: lanhuajian <924060929@qq.com> Date: Fri, 16 Dec 2022 20:00:26 +0800 Subject: [PATCH] fix by comment --- .../main/java/org/apache/doris/analysis/AggregateInfo.java | 4 ---- .../java/org/apache/doris/analysis/AggregateInfoBase.java | 4 ++++ .../doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java | 3 +++ .../apache/doris/nereids/jobs/cascades/DeriveStatsJob.java | 2 ++ .../nereids/properties/ChildOutputPropertyDeriver.java | 1 + .../nereids/rules/rewrite/logical/NormalizeToSlot.java | 6 ++++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java index 8b407159e86ce98..904cb0848a9f412 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java @@ -394,10 +394,6 @@ public ArrayList getMaterializedAggregateExprs() { return result; } - public List getMaterializedAggregateExprLabels() { - return Lists.newArrayList(materializedSlotLabels); - } - public AggregateInfo getMergeAggInfo() { return mergeAggInfo; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java index b269d2a0021d006..2501b308f24c2ad 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java @@ -236,6 +236,10 @@ public TupleId getOutputTupleId() { return outputTupleDesc.getId(); } + public List getMaterializedAggregateExprLabels() { + return Lists.newArrayList(materializedSlotLabels); + } + public boolean requiresIntermediateTuple() { Preconditions.checkNotNull(intermediateTupleDesc); Preconditions.checkNotNull(outputTupleDesc); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java index c132e371a231d24..56491cced9d032b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java @@ -83,6 +83,9 @@ public NereidsRewriteJobExecutor(CascadesContext cascadesContext) { .add(topDownBatch(ImmutableList.of(new ColumnPruning()))) .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) .add(visitorJob(RuleType.INFER_PREDICATES, new InferPredicates())) + .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) + .add(visitorJob(RuleType.INFER_PREDICATES, new InferPredicates())) + .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) .add(topDownBatch(ImmutableList.of(PushFilterInsideJoin.INSTANCE))) .add(topDownBatch(ImmutableList.of(new FindHashConditionForJoin()))) .add(topDownBatch(ImmutableList.of(new LimitPushDown()))) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/DeriveStatsJob.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/DeriveStatsJob.java index 47886dadc40e198..66638c5023a0b67 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/DeriveStatsJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/DeriveStatsJob.java @@ -66,6 +66,8 @@ public void execute() { pushJob(new DeriveStatsJob(groupExpression, true, context)); List children = groupExpression.children(); + // rule maybe return new logical plans to wrap some new physical plans, + // so we should check derive stats for it if no stats for (int i = children.size() - 1; i >= 0; i--) { Group childGroup = children.get(i); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java index 99c379de3a1ded1..9683da9b0521c49 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java @@ -222,6 +222,7 @@ public PhysicalProperties visitPhysicalNestedLoopJoin( @Override public PhysicalProperties visitPhysicalOlapScan(PhysicalOlapScan olapScan, PlanContext context) { + // TODO: find a better way to handle both tablet num == 1 and colocate table together in future if (!olapScan.getTable().isColocateTable() && olapScan.getScanTabletNum() == 1) { return PhysicalProperties.GATHER; } else if (olapScan.getDistributionSpec() instanceof DistributionSpecHash) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java index 8202f745f2571c1..34686534e395481 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java @@ -103,8 +103,14 @@ public Set pushDownToNamedExpression(Collection