Repository navigation
Support for order sensitive NTH_VALUE aggregation, make reverse ARRAY_AGG more efficient - #8841
Merged
Merged
Conversation
This was referenced Jan 12, 2024
ozankabak
reviewed
Jan 15, 2024
ozankabak
left a comment
Contributor
There was a problem hiding this comment.
I reviewed this PR and it looks good except one issue about clones during merge_batch operations. There seems to be an inefficiency there which is not introduced by this PR, but I discovered it during review. I will consult with @mustafasrepo tomorrow to discuss possible fixes.
NTH_VALUE aggregation, make reverse ARRAY_AGG more efficient
ozankabak
approved these changes
Jan 16, 2024
ozankabak
left a comment
Contributor
There was a problem hiding this comment.
I reviewed this PR thoroughly again and the inefficiency I found in my first review is resolved -- we both have faster ARRAY_AGGs now, and also have an efficient NTH_VALUE.
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
Currently, we have
FIRST_VALUE,LAST_VALUE,ARRAY_AGGorder sensitive aggregations functions. Similar to the window counter part one may need to index entries other than first and last. WithNTH_VALUEaggregation function one can choose arbitrary indices. With this PR one can write following query, to get second row in the group.As a workaround following query can be used to produce desired output of the query above.
However, with dedicated aggregator, first query will use less memory.
What changes are included in this PR?
This PR adds
NTH_VALUEaggregator support.Are these changes tested?
Yes,
Are there any user-facing changes?