haohuaijin commented on issue #7876:
URL: 
https://github.com/apache/arrow-datafusion/issues/7876#issuecomment-1772623375

   I found that even if we don't push down non-deterministic predicates, the 
results will also be wrong,
   Because when we convert the `Statement` into a `LogicalPlan`, we will 
"dereferences" any aliases in the HAVING clause  in the below section
   
https://github.com/apache/arrow-datafusion/blob/1dd887cdff518ede1d1de457f4b20c22a9c7228f/datafusion/sql/src/select.rs#L110-L122
   before
   ```sql
   select name, random() as r from test group by name having r > 0.2
   ```
   after
   ```sql
   select name, random() as r from test group by name having random() > 0.2
   ```


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

Reply via email to