neilconway opened a new issue, #22067:
URL: https://github.com/apache/datafusion/issues/22067

   ### Describe the bug
   
   ```
   > SELECT g, COUNT(a) FILTER (WHERE b < 1) AS count_a
   FROM (VALUES (0, 1, CAST(NULL AS INT)), (0, 2, 2)) AS t(g, a, b)
   GROUP BY g;
   +---+---------+
   | g | count_a |
   +---+---------+
   | 0 | 1       |
   +---+---------+
   1 row(s) fetched.
   Elapsed 0.016 seconds.
   ```
   
   This is incorrect; Postgres returns `0, 0` because no rows pass the filter. 
DF looks at the two-valued boolean result of the filter (true/false) and 
doesn't check the NULL bitmap.
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


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