tustvold commented on code in PR #7096:
URL: https://github.com/apache/arrow-rs/pull/7096#discussion_r1951712655
##########
arrow-ipc/src/reader.rs:
##########
@@ -1744,27 +1745,73 @@ mod tests {
});
}
- fn roundtrip_ipc(rb: &RecordBatch) -> RecordBatch {
+ /// Write the record batch to an in-memory buffer in IPC File format
+ fn write_ipc(rb: &RecordBatch) -> Vec<u8> {
let mut buf = Vec::new();
let mut writer = crate::writer::FileWriter::try_new(&mut buf,
rb.schema_ref()).unwrap();
writer.write(rb).unwrap();
writer.finish().unwrap();
- drop(writer);
+ buf
+ }
- let mut reader = FileReader::try_new(std::io::Cursor::new(buf),
None).unwrap();
- reader.next().unwrap().unwrap()
+ /// Return the first record batch read from the IPC File buffer
+ fn read_ipc(buf: &[u8]) -> Result<RecordBatch, ArrowError> {
+ let mut reader = FileReader::try_new(std::io::Cursor::new(buf), None)?;
+ reader.next().unwrap()
}
- fn roundtrip_ipc_stream(rb: &RecordBatch) -> RecordBatch {
+ fn roundtrip_ipc(rb: &RecordBatch) -> RecordBatch {
+ let buf = write_ipc(rb);
+ read_ipc(&buf).unwrap()
+ }
+
+ /// Return the first record batch read from the IPC File buffer
+ /// using the FileDecoder API
+ fn read_ipc_with_decoder(buf: Vec<u8>) -> Result<RecordBatch, ArrowError> {
Review Comment:
https://github.com/apache/arrow-rs/pull/7091#discussion_r1949112257
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]