[ 
https://issues.apache.org/jira/browse/ARROW-11696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17297929#comment-17297929
 ] 

Dominik Moritz commented on ARROW-11696:
----------------------------------------

But {{&[u8]}} does not seem to implement Seek so FileReader does not work.

The error is:

{{the trait bound `&[u8]: Seek` is not satisfied}}
{{ required by `FileReader::<R>::try_new`}}

If I switch to the StreamReader, I get an IO error at runtime:

{{Io error: failed to fill whole buffer}}

So what I implemented was

{{let cursor = std::io::Cursor::new(contents);}}
{{  let reader = match arrow::ipc::reader::FileReader::try_new(cursor) {}}
{{  Ok(reader) => reader,}}
{{  Err(error) => return Err(format!("{}", error).into()),}}
{{ };}}

> [Rust] Create record batches from in memory IPC without memory copies
> ---------------------------------------------------------------------
>
>                 Key: ARROW-11696
>                 URL: https://issues.apache.org/jira/browse/ARROW-11696
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Rust
>            Reporter: Dominik Moritz
>            Priority: Major
>
> I have the IPC format of Arrow record batches in memory (e.g. as {{&[u8]}}) 
> and would like to create a vector of batches while avoiding as many memory 
> copies as possible. It would be great if there was a way to create the vector 
> without having to go through the file abstraction. 
> I might be misunderstanding the way the file reader works and maybe it does 
> not incur memory copies. I think it does, though, since creating arrow record 
> batches from a larger arrow buffer takes much longer. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to