[fix](nereids)aggregate function cannot contain aggregate parameters (#30928)

This commit is contained in:
starocean999
2024-02-07 22:24:13 +08:00
committed by yiguolei
parent c72f634c10
commit a1bf00e5ea
2 changed files with 13 additions and 0 deletions

View File

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