-
Notifications
You must be signed in to change notification settings - Fork 839
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
Impl ArrowNativeType
and ArrowNativeTypeOp
for u128
, usize
and isize
#5176
Conversation
What is the motivation for this? Perhaps you could expand on your intended use-case? |
I'm working on an In addition, what do you think about: impl<const N: usize, T: ArrowNativeType> ArrowNativeType for [T; N] { ... } |
Perhaps you could use the Buffer APIs directly instead of using ScalarBuffer? This feels a bit out of scope for these abstractions? |
I prefer avoiding the unsafe buffer methods and instead use the strongly typed methods, however they are all generic over Unless I'm mistaken this is following the Arrow spec, so I think it would be a good addition regardles of my use-case. |
I'm not aware of a part of the arrow specification calling for a pointer width type, i.e.
I appreciate this, but these APIs are not intended as a general purpose aligned allocation API, rather the backing storage for the arrow-rs array abstractions. Keeping the scope narrow, especially in an area that makes extensive use of unsafe, is quite important. |
The physical fixed-size primitive memory layout supports: "values each having the same physical slot width typically measured in bytes". For example, consider a custom UUID extension type. It could be stored in a fixed-size list layout (as suggested in the docs), but it's also valid to store it in a fixed-size primitive layout (using |
https://github.com/apache/arrow/blob/92723f34f8df40b35e5840e61011c00766808014/format/Schema.fbs is the canonical list of types within the arrow data model.
It could also be stored as a If the intention is to use this for |
I'm interested in extension types.
No, I think we should only implement it for
I'm trying to use this for the physical fixed-size primitive layout, which in my mind is like a |
I appreciate the context, but I think if narrow wants such abstractions it should look to provide them itself. ArrowNativeType exists to serve the requirements of arrow-rs' array abstractions and not as a general purpose transmutation API. This is inherently a very unsafe part of the API and I would very much like to keep it focused to avoid unintentional soundness issues. |
I think making
I don't fully understand this -- given there is no Is there an approach where you could implement conversions for an array to |
As |
Thank you all for the thoughtful comments. I can see how it doesn't make sense to add this. I'll try to figure out another way to make it work with narrow. |
Which issue does this PR close?
None. Does it need one?
Rationale for this change
Arrow's
Schema.fbs
restricts logical integer type bit widths to a max of 64, however it should be fine to use wider ints for custom types in Arrow buffers.Note that there already is an implementation for
i128
(used for decimals).What changes are included in this PR?
Implements
ArrowNativeType
andArrowNativeTypeOp
foru128
,usize
andisize
.Are there any user-facing changes?
Users can now use
u128
,usize
andisize
inScalarBuffer
andBufferBuilder
.