comphead commented on code in PR #26544:
URL: https://github.com/apache/datafusion/pull/26544#discussion_r4338795176


##########
datafusion/optimizer/src/decorrelate.rs:
##########
@@ -505,6 +505,12 @@ impl TreeNodeRewriter for PullUpCorrelatedExpr {
                 if !is_distinct {
                     self.can_pull_up = self.can_pull_up && 
self.can_pull_over_aggregation;
                 }
+                // A pulled up scalar aggregate below gives no row for 
unmatched
+                // outer rows, so this aggregate would see an empty input.
+                // See https://github.com/apache/datafusion/issues/26508
+                if self.pulled_up_scalar_agg {

Review Comment:
   Added the `max` over `max` case as a pinned error, with a comment saying it 
returned the right rows before and why it is blocked too. The PR description 
now lists this trade-off under user-facing changes.



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