mohammadnaqvi04 commented on code in PR #25391:
URL: https://github.com/apache/datafusion/pull/25391#discussion_r4328649767


##########
datafusion/optimizer/src/decorrelate.rs:
##########
@@ -383,6 +454,7 @@ impl TreeNodeRewriter for PullUpCorrelatedExpr {
                     // Correlated exist subquery, remove the limit(so that 
correlated expressions can pull up)
                     (true, false) => Transformed::yes(match 
limit.get_fetch_type()? {
                         FetchType::Literal(Some(0)) => {
+                            self.forces_empty_result = true;

Review Comment:
   Removed the flag and its `lit(false)` branch. IIRC, it was needed when 
`f_up` was the only place handling `LIMIT 0`, but `f_down` intercepts that case 
now, so it was only ever read in the case where it gave the wrong answer. I 
re-verified both existing `LIMIT 0` tests still pass, and the repro now returns 
`11, 22, 33, 44`.



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