You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "lyne7-sc (via GitHub)" <gi...@apache.org> on 2026/08/20 07:15:07 UTC

[I] Window aggregate FILTER evaluates arguments for rejected rows [datafusion]

lyne7-sc opened a new issue, #24507:
URL: https://github.com/apache/datafusion/issues/24507

   ### Describe the bug
   
   Window aggregates evaluate their argument expressions before applying the aggregate `FILTER`.
   
   This can cause a query to fail while evaluating rows that should not participate in the window aggregate.
   
   ### To Reproduce
   
   ```sql
   SELECT
     id,
     SUM(10 / x) FILTER (WHERE x <> 0) OVER (ORDER BY id) AS running_sum
   FROM (
     VALUES
       (1, 2),
       (2, 0),
       (3, 5)
   ) AS t(id, x)
   ORDER BY id;
   ```
   
   The query fails even though the row where x = 0 is rejected by the aggregate filter:
   
   ```
   Arrow error: Divide by zero error
   ```
   
   ### Expected behavior
   
   The aggregate filter should prevent argument evaluation for rejected rows, and the query should return:
   
   ```
   1 5
   2 5
   3 7
   ```
   
   ### Additional context
   
   This is the window-aggregate counterpart of #24443.
   
   #24444 addresses the same evaluation-order issue for grouped aggregates, but window aggregates use a separate physical evaluation path and remain affected.


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Window aggregate FILTER evaluates arguments for rejected rows [datafusion]

Posted by "lyne7-sc (via GitHub)" <gi...@apache.org>.
lyne7-sc commented on issue #24507:
URL: https://github.com/apache/datafusion/issues/24507#issuecomment-5352668211

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org