-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix bug in LimitPushPastWindows #18029
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the code changes and test cases, they all look good to me. Thanks @avantgardnerio for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - a great amount of tests and elegant way to solve it.
} | ||
let mut latest_limit: Option<usize> = None; | ||
let mut latest_max = 0; | ||
let mut ctx = TraverseState::default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can / should move the code to LimitPushdown instead?
Might be possible to do it in a single pass and simplify the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also of two minds on this. I think it's easier to reason about, debug, and disable as a separate rule, but then interplay between lots of optimizer rules can be really difficult to debug as well.
@alamb what's the process for turning this into a patch-fix? |
If you mean releasing as part of the DataFusion 50.x line, it is to follow this process: #17299 (comment) Seems like @hareshkh may also be interested in helping so perhaps you can coordinate together |
@alamb @avantgardnerio: Creating a Datafusion release issue now, will cherry-pick changes after that. |
@hareshkh has created a ticket to track the 50.3.0 release: @avantgardnerio can you please create a backport PR to branch-50? |
* Add test * Use ROWS instead of RANGE * Fix a test * progress * window.slt like master * passing existing tests * Break out window limit tests * LimitEffect * fix a bug * repartitions * refactor * refactor * fmt * remove casual * two phased approach * refactor into context * refactor * refactor * refactor * remove comments * remove deps * Fix NthValue * aggregates * ranking functions * More tests * Max lead test * More tests, JIC * More tests, JIC * Notes * Notes-- (cherry picked from commit 4e69241)
Which issue does this PR close?
lead()
#18028.Rationale for this change
It's pretty important optimizer rules don't change results.
What changes are included in this PR?
LimitEffect
similar toCardinalityEffect
with which plan nodes and window functions can declare their effects on limit_pushdownLead()
to calculate and return its effectAre these changes tested?
In a new
window_limits.slt
to break things up.Are there any user-facing changes?
Yes, we should patch-fix and notify users. Credit to @Dandandan for finding this bug.