Skip to content
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

StreamReader is not zero-copy #5584

Closed
Luv-Ray opened this issue Apr 3, 2024 · 2 comments
Closed

StreamReader is not zero-copy #5584

Luv-Ray opened this issue Apr 3, 2024 · 2 comments
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@Luv-Ray
Copy link

Luv-Ray commented Apr 3, 2024

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

There is a Vec<u8> in IPC Streaming Format, and I want to convert it to record batches.

For now my code is like this:

use bytes::Buf;

fn deserialize_stream_buf(buf: Vec<u8>) -> Vec<RecordBatch> {
    let buf = buf.reader();
    let reader = StreamReader::try_new(buf, None).unwrap();
    reader.map(|b| b.unwrap()).collect()
}

But it's not zero-copy, each time next() is called, StreamReader will copy the data.

Describe the solution you'd like

read a memory region in IPC Streaming Format with zero-copy.

Describe alternatives you've considered

Is there could be an API like FileReader? Take ownership of the memery region rather than borrowing it.

@Luv-Ray Luv-Ray added the enhancement Any new improvement worthy of a entry in the changelog label Apr 3, 2024
@tustvold
Copy link
Contributor

tustvold commented Apr 3, 2024

I believe #5531 is what you're after (not yet released)

@Luv-Ray
Copy link
Author

Luv-Ray commented Apr 3, 2024

Thanks, I will wait for the release :)

@Luv-Ray Luv-Ray closed this as completed Apr 3, 2024
@tustvold tustvold added the arrow Changes to the arrow crate label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

No branches or pull requests

2 participants