Skip to content

Commit

Permalink
fix(rust, python): fix bug in batched parquet reader that dropped dfs… (
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Nov 14, 2022
1 parent a7a7e0f commit 319aaaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions polars/polars-io/src/parquet/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl BatchedParquetReader {

pub fn next_batches(&mut self, n: usize) -> PolarsResult<Option<Vec<DataFrame>>> {
// fill up fifo stack
if self.row_group_offset < self.n_row_groups && self.chunks_fifo.len() < n {
if self.row_group_offset <= self.n_row_groups && self.chunks_fifo.len() < n {
let dfs = match self.parallel {
ParallelStrategy::Columns => {
let dfs = rg_to_dfs(
Expand Down Expand Up @@ -416,12 +416,11 @@ impl BatchedParquetReader {
let mut chunks = Vec::with_capacity(n);
let mut i = 0;
while let Some(df) = self.chunks_fifo.pop_front() {
chunks.push(df);
i += 1;
if i == n {
break;
}

chunks.push(df);
i += 1;
}

Ok(Some(chunks))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl Sink for GenericGroupbySink {
)
};

// extend the keys buffer with the new keys from othger
// extend the keys buffer with the new keys from other
keys_buffer_self.extend_from_slice(keys_other);

// insert the keys and values_offset
Expand Down

0 comments on commit 319aaaa

Please sign in to comment.