-
Notifications
You must be signed in to change notification settings - Fork 924
Expose a path for converting bytes::Bytes
into arrow_buffer::Buffer
without copy
#5104
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
Comments
As you've identified this should be a relatively straightforward addition. I will, however, temper your expectations that this will only be possible when the buffer is sufficiently aligned for the array - you will need to be careful here to avoid panics |
Yeah, I noticed that the in memory object store implementation doesn't guarantee 8-byte aligned buffers, which is sufficient for most types. I was debating if I should open an issue and make object store return aligned buffers. Since there is no mmap in the object store I think this is doable? |
The challenge is that hyper, etc... use Bytes to avoid copying data when they slice up HTTP data frames. I'm therefore not sure this is tractable without introducing potential performance regressions. It also seems like something object_store should not be concerned with |
I think there might be a way to get aligned buffers more optimally within the existing APIs: Right now, the body is read as a stream of arrow-rs/object_store/src/lib.rs Line 1021 in 6d4b8bb
The concatenation does a mem copy already, so we could mem copy them into an buffer of our preferred alignment. The arrow-rs/object_store/src/lib.rs Lines 969 to 976 in 6d4b8bb
|
Not always, if there is only a single |
Closed by #4260 |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It would be nice if we can call
let buffer: Buffer = bytes.into()
without incurring a copy, sinceobject_store
returnsbytes::Bytes
.Describe the solution you'd like
I see that
arrow_buffer::bytes::Bytes
already implementsFrom<bytes::Bytes>
hereI guess we just need to add a implementation of
From<bytes::Bytes> for Buffer
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: