924060929 commented on code in PR #36145:
URL: https://github.com/apache/doris/pull/36145#discussion_r1636157041


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergeAggregate.java:
##########
@@ -75,7 +74,10 @@ public List<Rule> buildRules() {
      */
     private Plan mergeTwoAggregate(LogicalAggregate<LogicalAggregate<Plan>> 
outerAgg) {
         LogicalAggregate<Plan> innerAgg = outerAgg.child();
-
+        Map<ExprId, AggregateFunction> innerAggExprIdToAggFunc = 
innerAgg.getOutputExpressions().stream()
+                .filter(expr -> (expr instanceof Alias) && (expr.child(0) 
instanceof AggregateFunction))
+                .collect(Collectors.toMap(NamedExpression::getExprId, value -> 
(AggregateFunction) value.child(0),
+                        (existValue, newValue) -> existValue));

Review Comment:
   Don't repeat yourself. This code repeat 3 times, add a private method to 
compute it?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to