fix: evaluate window aggregate arguments after FILTER - #24508
Open
lyne7-sc wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24508 +/- ##
==========================================
+ Coverage 81.23% 81.27% +0.03%
==========================================
Files 1112 1116 +4
Lines 390635 395026 +4391
Branches 390635 395026 +4391
==========================================
+ Hits 317350 321063 +3713
- Misses 54650 55166 +516
- Partials 18635 18797 +162 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
neilconway
reviewed
Aug 20, 2026
neilconway
left a comment
Contributor
There was a problem hiding this comment.
This approach makes sense and is simple and clean, but I'd be curious to understand how it influences performance, especially for simple and infallible expressions (e.g., bare column references).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Window aggregates evaluate their arguments before applying
FILTER, which can cause errors on rows that should not participate in the aggregate.This is analogous to #24444 for grouped aggregates, window aggregates use a separate evaluation path.
What changes are included in this PR?
Evaluate the window aggregate filter before evaluating its arguments.
Use the resulting filter mask as a selection when evaluating argument expressions. Selected results are scattered back to the original batch length so that window frame row indices remain aligned.
This applies to both ever-expanding and sliding aggregate window frames.
Are these changes tested?
Yes.
Are there any user-facing changes?
Window aggregate arguments are no longer evaluated for rows rejected by
FILTER, no public API changes.