[MINOR]: Update get range implementation for lead lag window functions#10614
Merged
ozankabak merged 1 commit intoapache:mainfrom May 22, 2024
Merged
[MINOR]: Update get range implementation for lead lag window functions#10614ozankabak merged 1 commit intoapache:mainfrom
ozankabak merged 1 commit intoapache:mainfrom
Conversation
mustafasrepo
commented
May 22, 2024
| idx.saturating_sub(offset) | ||
| } else if !self.ignore_nulls { | ||
| let offset = self.shift_offset as usize; | ||
| idx.saturating_sub(offset) |
Contributor
Author
There was a problem hiding this comment.
instead of 0, we now return idx-offset(can be larger than 0, which will trigger pruning) for LAG
mustafasrepo
commented
May 22, 2024
| min(idx + offset + 1, n_rows) | ||
| } else if !self.ignore_nulls { | ||
| let offset = (-self.shift_offset) as usize; | ||
| min(idx + offset, n_rows) |
Contributor
Author
There was a problem hiding this comment.
instead of n_rows, we now return idx+offset(can be smaller than n_rows, which will required less data for correct result) for LEAD
Contributor
|
Will go ahead and merge this quickly since it is trivial |
alamb
approved these changes
May 22, 2024
Contributor
alamb
left a comment
There was a problem hiding this comment.
Looks good to me -- thanks @mustafasrepo
findepi
pushed a commit
to findepi/datafusion
that referenced
this pull request
Jul 16, 2024
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?
Closes #.
Rationale for this change
While working on another PR, I have recognized that get_range implementation for
LEAD,LAGwindow functions generates unnecessarily wide ranges whenignore_nullsflag isfalse. This PR, fixes this problem. This enablesBoundedWindowAggExecto prune its input data better forLEAD, LAGwindow functions.What changes are included in this PR?
Are these changes tested?
Yes, unit test is added
Are there any user-facing changes?