-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Shift from Field to FieldRef for all user defined functions #16122
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
Conversation
add60f1
to
3939a9e
Compare
8154e01
to
c361436
Compare
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is nice that this is now avoiding a deep copy of a bunch of Field
s 👍
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
DataType
toField
we may have some plans that create a lot of copy operations. This PR switches fromField
toFieldRef
for 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: