Skip to content

Commit

Permalink
early stop
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 5, 2024
1 parent 4d54ae7 commit 215c807
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/polars-io/src/csv/read/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,15 @@ impl<'a> CoreReader<'a> {

results.lock().unwrap().push((b.as_ptr() as usize, result));
});

// Check just after we spawned a chunk. That mean we processed all data up until
// row count.
if total_line_count as usize > self.n_rows.unwrap_or(usize::MAX) {
break;
}
}
line_count = 0;
total_bytes_offset += b.len();
if total_line_count as usize >= self.n_rows.unwrap_or(usize::MAX) {
break;
}
}
});
let mut results = std::mem::take(&mut *results.lock().unwrap());
Expand Down

0 comments on commit 215c807

Please sign in to comment.