siddubakka commented on PR #26723:
URL: https://github.com/apache/datafusion/pull/26723#issuecomment-6542850201

   @jayzhan211 Updated this PR rather than a new one. The compensation CASE is 
gone: `build_join` now checks the recorded conditions (that part of 
`decorrelate.rs` stayed, they are the detector now) and fails the query when 
the output column needs count-bug compensation, which is exactly where the fix 
used to kick in.
   
   ```text
   Unsupported correlated scalar subquery: a HAVING or filter above a 
count-like aggregate reads outer columns, and this rewrite cannot evaluate it 
against both the group and the empty input without risking wrong results. Move 
the condition outside the subquery
   ```
   
   Outputs whose own default is NULL keep filtering in the ON, per your caveat. 
Local HAVINGs still go through the `having` arm too, so the two `HAVING 
count(*) >= 0` and `> 0` cases in `subquery.slt` still assert values. The other 
six cases now assert the error: the two issue queries, the stacked filter from 
your first comment, the three HAVING repros from the review discussion. For the 
stacked filter one main is not safe either, the `0 9` row gets the empty-input 
0 before the `s.n < x.n` filter ever gets a say, where Postgres says NULL.
   
   Title and description updated. Diff reads +118/-0 on the same three files, 
gates green, CI is running.
   


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