This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new 44d15b68f9 [fix](planner)fix bug of push conjuncts through second phase agg (#22418) 44d15b68f9 is described below commit 44d15b68f922f48273e642a3b2bf16bb4f5dd83b Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Mon Aug 7 10:27:15 2023 +0800 [fix](planner)fix bug of push conjuncts through second phase agg (#22418) --- .../java/org/apache/doris/planner/SingleNodePlanner.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java index 3849a16f25..738b7fd823 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java @@ -2649,7 +2649,12 @@ public class SingleNodePlanner { if (aggregateInfo == null || aggregateInfo.getGroupingExprs().isEmpty()) { return; } - final List<Expr> predicates = getBoundPredicates(analyzer, aggregateInfo.getOutputTupleDesc()); + // The output of the 1st phase agg is the 1st phase intermediate. + // see createSecondPhaseAggInfo method + final List<Expr> predicates = getBoundPredicates(analyzer, + aggregateInfo.getSecondPhaseDistinctAggInfo() != null + ? aggregateInfo.getIntermediateTupleDesc() + : aggregateInfo.getOutputTupleDesc()); if (predicates.isEmpty()) { return; } @@ -2675,7 +2680,11 @@ public class SingleNodePlanner { } final AggregateInfo secondPhaseAggInfo = firstPhaseAggInfo.getSecondPhaseDistinctAggInfo(); - final List<TupleId> firstPhaseTupleIds = Lists.newArrayList(firstPhaseAggInfo.getOutputTupleId()); + // The output of the 1st phase agg is the 1st phase intermediate. + // see createSecondPhaseAggInfo method + final List<TupleId> firstPhaseTupleIds = Lists.newArrayList( + secondPhaseAggInfo != null ? firstPhaseAggInfo.getIntermediateTupleId() + : firstPhaseAggInfo.getOutputTupleId()); pushDownPredicatesPastAggregationOnePhase(secondPhaseAggInfo, analyzer, stmt, firstPhaseTupleIds); pushDownPredicatesPastAggregationOnePhase(firstPhaseAggInfo, analyzer, stmt, stmt.getTableRefIds()); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org