-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Introduce expr_fields to AccumulatorArgs to hold input argument fields
#18100
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
189e231
Introduce `expr_fields` to `AccumulatorArgs` to hold input argument f…
Jefffrey 14016fe
Merge branch 'main' into acc_args_input_fields
Jefffrey c2fd4fc
Merge branch 'main' into acc_args_input_fields
Jefffrey 1c87652
Fix reconstruction of accargs for string_agg and approx percentile
Jefffrey 221e67f
Merge branch 'main' into acc_args_input_fields
Jefffrey 4c5a7b0
comment
Jefffrey dacb28d
Merge branch 'main' into acc_args_input_fields
Jefffrey 822c476
Merge branch 'main' into acc_args_input_fields
Jefffrey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,8 @@ pub struct AccumulatorArgs<'a> { | |
| /// The return field of the aggregate function. | ||
| pub return_field: FieldRef, | ||
|
|
||
| /// The schema of the input arguments | ||
| /// Input schema to the aggregate function. If you need to check data type, nullability | ||
| /// or metadata of input arguments then you should use `expr_fields` below instead. | ||
| pub schema: &'a Schema, | ||
|
|
||
| /// Whether to ignore nulls. | ||
|
|
@@ -67,6 +68,9 @@ pub struct AccumulatorArgs<'a> { | |
|
|
||
| /// The physical expression of arguments the aggregate function takes. | ||
| pub exprs: &'a [Arc<dyn PhysicalExpr>], | ||
|
|
||
| /// Fields corresponding to each expr (same order & length). | ||
| pub expr_fields: &'a [FieldRef], | ||
|
Comment on lines
+72
to
+73
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main change is here |
||
| } | ||
|
|
||
| impl AccumulatorArgs<'_> { | ||
|
|
||
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
will this be a breaking FFI change?
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 don't think so, since
FFI_AccumulatorArgsseems to be the one marked as being stable across FFI boundaries:datafusion/datafusion/ffi/src/udaf/accumulator_args.rs
Lines 44 to 56 in 9f23680
Though I am not familiar with the FFI related code.
Uh oh!
There was an error while loading. Please reload this page.
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.
FYI @timsaucer -- perhaps you can confirm this doesn't mess up the FFI API
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.
Sorry, I've been slammed and didn't get to this soon. Short answer: No, this is not breaking. Long answer: It probably should.
The way this is set up it will continue to work but that is because we now have a duplicate piece of code here and here.
The FFI code is set up to try to mirror the non-ffi versions as much as possible. As long as one of these code paths linked above doesn't change then we should have no problem. It would probably be more robust to have those fields passed just like the other fields between the FFI versions.
We do have a unit test that does cover round tripping these arguments, so we are probably okay with this as is.
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.
Having test coverage will certainly allow me to sleep better at night
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.
Thanks for checking this @timsaucer
Hopefully this existing test is sufficient for @alamb to have a nice sleep
datafusion/datafusion/ffi/src/udaf/accumulator_args.rs
Lines 180 to 207 in 607325a