DKER2 commented on issue #26545:
URL: https://github.com/apache/datafusion/issues/26545#issuecomment-6540813770

   The same check also lets volatile filters through, even when they don't 
remove every row:
   
   ```sql
   CREATE TABLE t AS SELECT value AS a FROM generate_series(1, 1000);
   SELECT c FROM (SELECT count(*) AS c FROM t) WHERE random() < 0.5;
   ```
   
   The filter should run once on the subquery's single row, so the result 
should be `1000` or no rows, as in PostgreSQL 14 and SQLite. On `main` at 
22eb8ff10 it returns about 500, because the filter is pushed below the 
aggregate and runs per input row.
   
   The `Window` arm of `PushDownFilter` already keeps volatile predicates in 
place with `!expr.is_volatile()`. The `Aggregate` arm probably needs the same 
check.


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