This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 5e0dc0c9341 [fix](nereids)aggregate function cannot contain aggregate parameters (#30928) 5e0dc0c9341 is described below commit 5e0dc0c9341bfe6b409acfad1931496eee1f8f82 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Wed Feb 7 22:24:13 2024 +0800 [fix](nereids)aggregate function cannot contain aggregate parameters (#30928) --- .../apache/doris/nereids/rules/analysis/NormalizeAggregate.java | 6 ++++++ regression-test/suites/nereids_p0/aggregate/aggregate.groovy | 7 +++++++ 2 files changed, 13 insertions(+) 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 0e7dc51babd..f7604e30054 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 @@ -17,6 +17,7 @@ package org.apache.doris.nereids.rules.analysis; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.rules.Rule; import org.apache.doris.nereids.rules.RuleType; import org.apache.doris.nereids.rules.rewrite.NormalizeToSlot; @@ -220,6 +221,11 @@ public class NormalizeAggregate implements RewriteRuleFactory, NormalizeToSlot { // normalize trival-aggs by bottomProjects List<AggregateFunction> normalizedAggFuncs = bottomSlotContext.normalizeToUseSlotRef(aggFuncs); + if (normalizedAggFuncs.stream().anyMatch(agg -> !agg.children().isEmpty() + && agg.child(0).containsType(AggregateFunction.class))) { + throw new AnalysisException( + "aggregate function cannot contain aggregate parameters"); + } // build normalized agg output NormalizeToSlotContext normalizedAggFuncsToSlotContext = diff --git a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy index 6f63b146cb5..e9cb3b31b8d 100644 --- a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy +++ b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy @@ -336,4 +336,11 @@ suite("aggregate") { """ exception "java.sql.SQLException: errCode = 2, detailMessage = k2 not in agg's output" } + + test { + sql """ + SELECT sum(avg(k1)) FROM tempbaseall; + """ + exception "aggregate function cannot contain aggregate parameters" + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org