-
Notifications
You must be signed in to change notification settings - Fork 815
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
Remove DictionaryArray::keys_array method #419
Remove DictionaryArray::keys_array method #419
Conversation
@@ -1450,7 +1451,8 @@ where | |||
cast_with_options(&dict_array.values(), to_type, cast_options)?; | |||
|
|||
// Note take requires first casting the indices to u32 | |||
let keys_array: ArrayRef = Arc::new(dict_array.keys_array()); | |||
let keys_array: ArrayRef = |
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.
If primitive arrays were cloneable this would just be Arc::new(dict_array.keys().clone())
.
Codecov Report
@@ Coverage Diff @@
## master #419 +/- ##
==========================================
- Coverage 82.62% 82.62% -0.01%
==========================================
Files 162 162
Lines 44479 44469 -10
==========================================
- Hits 36750 36741 -9
+ Misses 7729 7728 -1
Continue to review full report at Codecov.
|
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 personally think this looks like an improvement: makes it harder to mis-use the Arrow API 👍
@andygrove @Dandandan @jorgecarleitao @paddyhoran @tustvold @nevi-me any thoughts on this proposal? |
I'll wait a few more days before merging this in to see if there is any more feedback. As this is not compatible, I won't backport to the 4.x line |
Which issue does this PR close?
Closes #391.
Rationale for this change
The
keys_array
can be a performance problem if used in inner loops and most usages can be directly replaced by thekeys
method which returns a reference without any cloning or allocations.What changes are included in this PR?
Removed the method and replaced it's usages with the
keys
method.Are there any user-facing changes?
Yes, this is a breaking change.
This is currently a draft because there were actually two usages in the
cast
kernels that could not be directly replaced. We do not seem to have an obvious way to get from&PrimitiveArray<T>
toArrayRef
. This transformation would be much easier if thePrimitiveArray
itself was cloneable.