[feature](Nereids) support select distinct with aggregate (#35300)

(cherry picked from commit adcbc8cce57aaec507174f39536a028db803a2e5)
This commit is contained in:
924060929
2024-05-23 19:01:10 +08:00
committed by GitHub
parent 4075408b84
commit bf37e5c905
2 changed files with 9 additions and 4 deletions

View File

@ -2904,10 +2904,6 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
SelectColumnClauseContext selectColumnCtx = selectClause.selectColumnClause();
LogicalPlan aggregate = withAggregate(filter, selectColumnCtx, aggClause);
boolean isDistinct = (selectClause.DISTINCT() != null);
if (isDistinct && aggregate instanceof Aggregate) {
throw new ParseException("cannot combine SELECT DISTINCT with aggregate functions or GROUP BY",
selectClause);
}
if (!(aggregate instanceof Aggregate) && havingClause.isPresent()) {
// create a project node for pattern match of ProjectToGlobalAggregate rule
// then ProjectToGlobalAggregate rule can insert agg node as LogicalHaving node's child