-
Notifications
You must be signed in to change notification settings - Fork 824
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
Minor: Remove cloning ArrayData in with_precision_and_scale #3050
Minor: Remove cloning ArrayData in with_precision_and_scale #3050
Conversation
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.
Would it need self if we changed it to not clone ArrayData?
If not clone ArrayData, then yes, |
The main pain point of current API is that the reference of primitive array returned from |
@tustvold Do you have more thoughts on this? |
I think a
i.e. explicitly clone the array data, and this is actually less verbose than downcasting it. So I'm not sure about this... |
Oops, I'm wrong about this. Not sure how I messed it up previously.
|
This works, though it's not straightforward to use the API. But as the cloning seems not able to be removed, maybe it is better to make the API more easy to use with a reference? |
The cloning is not necessary in the very common case of building a new array
Try |
Ah, you're right. Not realized that we can directly use |
Benchmark runs are scheduled for baseline = c027c70 and contender = 5fb3033. 5fb3033 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #.
Rationale for this change
with_precision_and_scale
doesn't needself
actually but only a reference.And more, usually we get a reference of decimal array with APIs like
as_primitive_array
. Currently it makes harder to callwith_precision_and_scale
with that.What changes are included in this PR?
Are there any user-facing changes?