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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/eageraggregation/EagerAggRewriter.java:
##########
@@ -156,10 +156,15 @@ public Plan visitLogicalJoin(LogicalJoin<? extends Plan, 
? extends Plan> join, P
 
         Plan newLeft = join.left();
         Plan newRight = join.right();
-        if (leftChildContext.isPresent()) {
+        // Scalar (GROUP BY empty) child aggregate: returns 1 NULL row even on 
0 input rows (SQL standard).
+        // If pushed below a join, that 1 row would cross-join with the other 
side, producing phantom rows.
+        // Forbid pushdown when the child aggregate has no GROUP BY keys.
+        // Note: parent scalar aggregates are already filtered at 
PushDownAggregation before reaching here.
+        // See regression test: scalar_agg_pushdown.groovy
+        if (leftChildContext.isPresent() && 
!leftChildContext.get().getGroupKeys().isEmpty()) {

Review Comment:
   done



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