2010YOUY01 opened a new issue, #11748:
URL: https://github.com/apache/datafusion/issues/11748

   ### Describe the bug
   
   The below query should return an empty set, since `having` is evaluated 
after aggregation, when it's predicate is false, the final result should always 
be empty.
   I have also checked in DuckDB and PostgreSQL, and they all return an empty 
set.
   
   Reproducer in datafusion-cli
   ```
   DataFusion CLI v40.0.0
   > create table t1(v1 int);
   0 row(s) fetched.
   Elapsed 0.085 seconds.
   
   > SELECT AVG(v1) FROM t1 GROUP BY false having false;
   +------------+
   | avg(t1.v1) |
   +------------+
   |            |
   +------------+
   1 row(s) fetched.
   Elapsed 0.095 seconds.
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   Found by SQLancer https://github.com/apache/datafusion/issues/11030


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