Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/analyzer: pushdown_filters: Avoid pushing down filters below Window nodes. #597

Merged
merged 2 commits into from
Oct 25, 2021

Conversation

reltuk
Copy link
Contributor

@reltuk reltuk commented Oct 25, 2021

If a Filter is above a Window node, the Window node will be aggregating and
computing projections based on the rows that it sees. It is not safe to push
the filter below the Window node.

The parser and analyzer currently work in concert (and must work in concert for
Window results to be correct) to keep Filter nodes which do apply to the Window
below the Window.

…ow nodes.

If a Filter is above a Window node, the Window node will be aggregating and
computing projections based on the rows that it sees. It is not safe to push
the filter below the Window node.

The parser and analyzer currently work in concert (and must work in concert for
Window results to be correct) to keep Filter nodes which do apply to the Window
below the Window.
@reltuk reltuk requested a review from zachmu October 25, 2021 20:24
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

case *plan.Window:
// Windows operate across the rows they see and cannot have
// filters pushed below them. Instead, the step will be run
// again by the Transform function, starting at this ndoe.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ndoe!

@reltuk reltuk merged commit be5218f into main Oct 25, 2021
@Hydrocharged Hydrocharged deleted the aaron/analyzer-avoid-filter-pushdown-over-window branch December 8, 2021 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants