morrySnow commented on code in PR #64820:
URL: https://github.com/apache/doris/pull/64820#discussion_r3489115571


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java:
##########
@@ -382,21 +383,23 @@ private PushDownAggContext createContextFromProject(
             aggFunctions.add(newAggFunc);
         }
         // After pushing expressions past the project, the agg functions may 
now
-        // contain If/CaseWhen that were hidden behind slot references before.
-        // e.g. count(#slot) where #slot = if(cond, a, b) in the project.
-        // We must re-check and update hasCaseWhen accordingly.
-        boolean newHasCaseWhen = context.hasCaseWhen;
-        if (!newHasCaseWhen) {
+        // contain NullToNonNull expressions that were hidden behind slot 
references before.
+        // e.g. count(#slot) where #slot = coalesce(a, 0) in the project.
+        // We must re-check and update containsNullToNonNull accordingly.
+        boolean newContainsNullToNonNull = context.containsNullToNonNull;
+        if (!newContainsNullToNonNull) {
             for (AggregateFunction aggFunc : aggFunctions) {
-                if (aggFunc.anyMatch(e -> e instanceof CaseWhen || e 
instanceof If)) {
-                    newHasCaseWhen = true;
+                if (aggFunc.anyMatch(e -> e instanceof NullToNonNullFunction
+                        || (e instanceof AlwaysNotNullable
+                                && !((Expression) 
e).getInputSlots().isEmpty()))) {
+                    newContainsNullToNonNull = true;

Review Comment:
   same code in two places



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