[Fix](planner) legacy planner repeat group by has grouping report error (#40281) (#40305)

cherry-pick #40281 to branch-2.1
This commit is contained in:
feiniaofeiafei
2024-09-04 08:50:21 +08:00
committed by GitHub
parent 3cf5d15b49
commit db06c678a3
2 changed files with 56 additions and 0 deletions

View File

@ -192,6 +192,11 @@ public class GroupByClause implements ParseNode {
"GROUP BY expression must not contain aggregate functions: "
+ groupingExpr.toSql());
}
if (groupingExpr.contains(GroupingFunctionCallExpr.class)) {
throw new AnalysisException(
"GROUP BY expression must not contain grouping scalar functions: "
+ groupingExpr.toSql());
}
if (groupingExpr.contains(AnalyticExpr.class)) {
// reference the original expr in the error msg
throw new AnalysisException(