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

Commit

Permalink
Fixed using lower limit than size of first parquet row group (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
arxra authored Jun 5, 2022
1 parent 287dae3 commit 745c199
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions src/io/parquet/read/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,15 @@ impl<R: Read + Seek> FileReader<R> {
fn next_row_group(&mut self) -> Result<Option<RowGroupDeserializer>> {
let result = self.row_groups.next().transpose()?;

self.remaining_rows = self.remaining_rows.saturating_sub(
result
.as_ref()
.map(|x| x.num_rows())
.unwrap_or(self.remaining_rows),
);
// If current_row_group is None, then there will be no elements to remove.
if self.current_row_group.is_some() {
self.remaining_rows = self.remaining_rows.saturating_sub(
result
.as_ref()
.map(|x| x.num_rows())
.unwrap_or(self.remaining_rows),
);
}
Ok(result)
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/io/parquet/read/row_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ impl Iterator for RowGroupDeserializer {
})
.collect::<Result<Vec<_>>>()
.map(Chunk::new);
self.remaining_rows -= chunk
.as_ref()
.map(|x| x.len())
.unwrap_or(self.remaining_rows);
self.remaining_rows = self.remaining_rows.saturating_sub(
chunk
.as_ref()
.map(|x| x.len())
.unwrap_or(self.remaining_rows),
);

Some(chunk)
}
Expand Down

0 comments on commit 745c199

Please sign in to comment.