Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Simplified IPC code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Nov 16, 2021
1 parent 7f973ee commit 110d889
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/io/ipc/read/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub fn read_batch<R: Read + Seek>(
metadata: &FileMetadata,
projection: Option<(&[usize], Arc<Schema>)>,
block: usize,
) -> Result<Option<RecordBatch>> {
) -> Result<RecordBatch> {
let block = metadata.blocks[block];

// read length
Expand Down Expand Up @@ -220,9 +220,7 @@ pub fn read_batch<R: Read + Seek>(
reader,
block.offset() as u64 + block.metaDataLength() as u64,
)
.map(Some)
}
ipc::Message::MessageHeader::NONE => Ok(None),
t => Err(ArrowError::Ipc(format!(
"Reading types other than record batches not yet supported, unable to read {:?}",
t
Expand Down Expand Up @@ -282,15 +280,14 @@ impl<R: Read + Seek> Iterator for FileReader<R> {
if self.current_block < self.metadata.total_blocks {
let block = self.current_block;
self.current_block += 1;
read_batch(
Some(read_batch(
&mut self.reader,
&self.metadata,
self.projection
.as_ref()
.map(|x| (x.0.as_ref(), x.1.clone())),
block,
)
.transpose()
))
} else {
None
}
Expand Down

0 comments on commit 110d889

Please sign in to comment.