Fix row index miscalculation in ParquetLoader#810
Open
vini-fda wants to merge 2 commits into
Open
Conversation
index miscalculated
Borda
approved these changes
Apr 24, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
===================================
Coverage 81% 81%
===================================
Files 54 54
Lines 7617 7630 +13
===================================
+ Hits 6143 6157 +14
+ Misses 1474 1473 -1 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting
What does this PR do?
Fixes #809.
This replaces the uniform-size arithmetic with a per-chunk prefix-sum of row-group sizes, computed once when the ParquetFile is first opened, then use
bisect.bisect_right(offsets, row_index) - 1to locate the group androw_index - offsets[group]for the offset inside it.The same
num_rows_per_row_groupvalue is also used in the cache-eviction check atlitData/src/litdata/streaming/item_loader.py
Line 749 in 1fdfad7
But that check needs the actual size of the current group
(offsets[g+1] - offsets[g]), otherwise with uneven groups memory either leaks (never hits threshold) or is freed too early (forcing re-reads).