minor: revert parsing precedence between Aggr and UDAF#7682
Merged
alamb merged 2 commits intoapache:mainfrom Sep 29, 2023
Merged
minor: revert parsing precedence between Aggr and UDAF#7682alamb merged 2 commits intoapache:mainfrom
alamb merged 2 commits intoapache:mainfrom
Conversation
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
ozankabak
approved these changes
Sep 28, 2023
Contributor
ozankabak
left a comment
There was a problem hiding this comment.
Makes sense, thank you
Contributor
|
I agree it makes sense to allow UDAF to shadow built in aggregate functions (so that users can redefine the meaning of aggregates if they wanted) Is there any way we can add a test to document this behavior? Perhaps in https://github.com/apache/arrow-datafusion/blob/3f8c51222fa0aa5bb4ef7fa5cab55875bfde0a63/datafusion/core/tests/user_defined/user_defined_aggregates.rs 🤔 |
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Member
Author
|
Thanks for reviewing!
Good suggestion 👍 I've added one in that file, reusing the existing |
alamb
approved these changes
Sep 29, 2023
| ]; | ||
| assert_batches_eq!(expected, &execute(&ctx, sql).await.unwrap()); | ||
|
|
||
| // Register `TimeSum` with name `sum`. This will shadow the builtin one |
Ted-Jiang
pushed a commit
to Ted-Jiang/arrow-datafusion
that referenced
this pull request
Oct 7, 2023
* minor: revert parsing precedence between Aggr and UDAF Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add unit test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
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
Just came across these lines that UDF is parsed before scalar function:
https://github.com/apache/arrow-datafusion/blob/bcc2acd8d10204b32b64fa3b77372655eaee8f06/datafusion/sql/src/expr/function.rs#L49-L61
And then find this rule doesn't hold for Aggr/UDAF
What changes are included in this PR?
After this patch, UDAF can shadow builtin AggrFn if they have the same name.
Are these changes tested?
n/a
Are there any user-facing changes?
It is... I think