-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for order sensitive NTH_VALUE
aggregation, make reverse ARRAY_AGG
more efficient
#8841
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 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
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 reviewed this PR thoroughly again and the inefficiency I found in my first review is resolved -- we both have faster ARRAY_AGG
s now, and also have an efficient NTH_VALUE
.
Which issue does this PR close?
Closes #.
Rationale for this change
Currently, we have
FIRST_VALUE
,LAST_VALUE
,ARRAY_AGG
order sensitive aggregations functions. Similar to the window counter part one may need to index entries other than first and last. WithNTH_VALUE
aggregation 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_VALUE
aggregator support.Are these changes tested?
Yes,
Are there any user-facing changes?