-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15021 +/- ##
==========================================
+ Coverage 80.97% 81.01% +0.03%
==========================================
Files 1333 1338 +5
Lines 173189 173602 +413
Branches 2460 2460
==========================================
+ Hits 140240 140641 +401
- Misses 32479 32493 +14
+ Partials 470 468 -2 ☔ View full report in Codecov by Sentry. |
@@ -608,6 +608,8 @@ impl BatchedParquetReader { | |||
if self.limit == 0 && self.has_returned { | |||
return if self.chunks_fifo.is_empty() { | |||
Ok(None) | |||
} else if self.chunks_fifo.len() < n { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the extra else if
and write self.chunk_fifo.drain(..std::cmp::min(n, self.chunk_fifo.len()))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for suggestion!
I moved min
into a separate line for slightly better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #15020