englefly commented on code in PR #66531:
URL: https://github.com/apache/doris/pull/66531#discussion_r3739515063


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java:
##########
@@ -419,14 +422,37 @@ private PushDownAggContext createContextFromProject(
                             .stream().map(slot -> (SlotReference) 
slot).collect(Collectors.toList()));
         }
 
-        List<AggregateFunction> aggFunctions = new ArrayList<>();
-        Map<AggregateFunction, Alias> aliasMap = new IdentityHashMap<>();
+        Set<AggregateFunction> aggFunctions = new LinkedHashSet<>();
+        Map<AggregateFunction, AggregateFunction> aggFunctionsMap = new 
LinkedHashMap<>();
+        Map<AggregateFunction, Alias> aliasMap = new HashMap<>();
+
         for (AggregateFunction aggFunc : context.getAggFunctions()) {
             AggregateFunction newAggFunc = (AggregateFunction) 
project.pushDownExpressionPastProject(aggFunc);
-            Alias alias = context.getAliasMap().get(aggFunc);
-            aliasMap.put(newAggFunc, (Alias) alias.withChildren(newAggFunc));
             aggFunctions.add(newAggFunc);
+            aggFunctionsMap.put(aggFunc, newAggFunc);
         }
+        boolean needDifferentExprId = aggFunctions.size() != 
context.getAliasMap().size();

Review Comment:
   这一轮遍历可以省略, 判断去重可以在 L429 这个 for 循环里一次完成



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