Shift from Field to FieldRef for all user defined functions#16122
Shift from Field to FieldRef for all user defined functions#16122alamb merged 8 commits intoapache:mainfrom
Conversation
add60f1 to
3939a9e
Compare
8154e01 to
c361436
Compare
There was a problem hiding this comment.
Thank you @timsaucer -- I had hoped this would be a bigger improvement, but I think it at least sets us up for being more efficient / less String cloning going forward
FieldRef will also allow metadata to be copied through hopefully without requiring a deep copy
cc @andygrove as I think Comet already had to update to a pre-release version. This might be disruptive again
| } | ||
|
|
||
| fn state_fields(&self, _args: StateFieldsArgs) -> Result<Vec<Field>> { | ||
| fn state_fields(&self, _args: StateFieldsArgs) -> Result<Vec<FieldRef>> { |
There was a problem hiding this comment.
It is nice that this is now avoiding a deep copy of a bunch of Fields 👍
|
|
||
| fn return_field_from_args(&self, _args: ReturnFieldArgs) -> Result<Field> { | ||
| fn return_field_from_args(&self, _args: ReturnFieldArgs) -> Result<FieldRef> { | ||
| Ok(Field::new( |
There was a problem hiding this comment.
So in theory we could update this code to create the FieldRef once on creation, and then return an Arc::clone rather than re-creating the Field each time -- perhaps we can do that as some follow on PRs.
Can you expand on this a little? Was there a specific metric you were watching to see performance improvements or is it looking at the code that we roughly have the same number of allocation operations? Or something else? |
It was the latter -- mostly I was thinking we'd be able to reuse |
|
Thanks @timsaucer |
Which issue does this PR close?
Rationale for this change
With the switch from
DataTypetoFieldwe may have some plans that create a lot of copy operations. This PR switches fromFieldtoFieldReffor the user defined scalar, window, and aggregate functions.What changes are included in this PR?
Changes to the API for the user defined functions and similar supporting operations throughout the code base.
Are these changes tested?
Tested via existing unit tests.
Are there any user-facing changes?
None (the APIs that are changed are not yet released)
TODO: