Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent "index out of range for slice" error in parquet reader #15021

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all 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
4 changes: 3 additions & 1 deletion crates/polars-io/src/parquet/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@ impl BatchedParquetReader {
return if self.chunks_fifo.is_empty() {
Ok(None)
} else {
Ok(Some(self.chunks_fifo.drain(..n).collect()))
// the range end point must not be greater than the length of the deque
let n_drainable = std::cmp::min(n, self.chunks_fifo.len());
Ok(Some(self.chunks_fifo.drain(..n_drainable).collect()))
};
}

Expand Down
Loading