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

Fixed using lower limit than size of first parquet row group #1046

Merged
merged 3 commits into from
Jun 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 3 additions & 2 deletions src/io/parquet/read/row_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ impl Iterator for RowGroupDeserializer {
})
.collect::<Result<Vec<_>>>()
.map(Chunk::new);
self.remaining_rows -= chunk
self.remaining_rows = self.remaining_rows.saturating_sub(chunk
.as_ref()
.map(|x| x.len())
.unwrap_or(self.remaining_rows);
.unwrap_or(self.remaining_rows)
);

Some(chunk)
}
Expand Down