morrySnow commented on code in PR #35813: URL: https://github.com/apache/doris/pull/35813#discussion_r1625304807
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeRepeat.java: ########## @@ -116,6 +116,11 @@ private void checkGroupingSetsSize(LogicalRepeat<Plan> repeat) { } private LogicalAggregate<Plan> normalizeRepeat(LogicalRepeat<Plan> repeat) { + if (repeat.getGroupingSets().size() == 1 && ExpressionUtils + .collect(repeat.getOutputExpressions(), GroupingScalarFunction.class::isInstance).isEmpty()) { + return new LogicalAggregate<>(repeat.getGroupByExpressions(), Review Comment: we move this code block out of normalizeRepeat. do it at the begin of this rule, aka at the very begin in `then` ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeRepeat.java: ########## @@ -116,6 +116,11 @@ private void checkGroupingSetsSize(LogicalRepeat<Plan> repeat) { } private LogicalAggregate<Plan> normalizeRepeat(LogicalRepeat<Plan> repeat) { + if (repeat.getGroupingSets().size() == 1 && ExpressionUtils + .collect(repeat.getOutputExpressions(), GroupingScalarFunction.class::isInstance).isEmpty()) { + return new LogicalAggregate<>(repeat.getGroupByExpressions(), + repeat.getOutputExpressions(), Optional.empty(), repeat.child()); Review Comment: we have three args ctor ```suggestion return new LogicalAggregate<>(repeat.getGroupByExpressions(), repeat.getOutputExpressions(), repeat.child()); ``` ########## regression-test/suites/nereids_rules_p0/grouping_sets/grouping_normalize_test.groovy: ########## @@ -39,4 +39,19 @@ suite("grouping_normalize_test"){ SELECT ROUND( SUM(pk + 1) - 3) col_alias1, MAX( DISTINCT col_int_undef_signed - 5) AS col_alias2, pk + 1 AS col_alias3 FROM grouping_normalize_test GROUP BY GROUPING SETS ((col_int_undef_signed,col_int_undef_signed2,pk),()) order by 1,2,3; """ + + explain { Review Comment: also add a plan check test in [NormalizeRepeatTest.java](https://github.com/apache/doris/pull/35813/files#diff-96ad3ba35e43204328613a2967f79313c2caaf1e76d8bacd1a322768c542c578) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org