-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Optimize planning / stop cloning Strings / Fields so much #18415
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
base: main
Are you sure you want to change the base?
Conversation
| metadata, | ||
| .. | ||
| }) => { | ||
| let field = expr.to_field(schema).map(|(_, f)| f.as_ref().clone())?; |
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.
these as_ref().clone() type methods are doing a deep clone on the Fields each time...
|
🤖 |
| /// Returns an immutable reference of a specific `Field` instance selected using an | ||
| /// offset within the internal `fields` vector | ||
| pub fn field(&self, i: usize) -> &Field { | ||
| pub fn field(&self, i: usize) -> &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.
the changes in this file are the public API changes -- they return a reference to the Arc rather than what is in the Arc meaning the callsite can clone the arcs when needed
|
🤖: Benchmark completed Details
|
|
🤖 |
|
🤖: Benchmark completed Details
|
Which issue does this PR close?
Rationale for this change
Avoid a bunch of clones / String copies during planning
What changes are included in this PR?
TBD
Are these changes tested?
yes by CI
I will also run benchmarks
Are there any user-facing changes?
Yes, there are several API changes in DFSchema that now return
FieldRefrather thanFieldwhich allows usingArc::clonerather thanclone