[core][common]support row range read of a DataSplit - #9705
Conversation
|
Why not just use |
|
The critical RowRange use case is slicing the stream after a filter — e.g. "give me the 1000th–2000th matching rows for training." Even composed with a filter, IndexedSplit only ANDs two physical-position bitmaps; it never renumbers rows into a This is exactly what AbstractDataTableRead.outerWrap encodes:
The AI training-shard use case (why RowRange exists) In AI / ML data loading, a common pattern is sharding a dataset by effective sample position:
IndexedSplit cannot express this:
Conclusion IndexedSplit and RowRange are complementary, not interchangeable:
RowRange was introduced precisely to cover IndexedSplit's blind spots — append tables, post-filter effective-row slicing, and merge-output slicing — all validated by tests in this PR (testAppendOrcRowRange..., testRowRangeWithFilterWrapsOutsideFilter, |
JingsongLi
left a comment
There was a problem hiding this comment.
The post-filter/merge-output slicing use case is distinct from IndexedSplit's physical row IDs and has end-to-end value. Two fallback paths currently violate the requested range; both were reproduced using real table writes and reads, and both passed after focused conditional fixes. Details are inline.
The existing Parquet DE range test also passes. The new failures specifically cover ORC column-merge reads and a supported file-format change within an append table.
| fileIndexResult = | ||
| FileIndexEvaluator.evaluate( | ||
| fileIO, | ||
| formatReaderMapping.getDataSchema(), |
There was a problem hiding this comment.
[P1] Avoid applying the effective range twice for ORC column merges
For a DE table with multiple column files, createFieldBunchReader(DataBunch) reaches this overload with fileRowRange set and fileIndexResult null. This block creates a range bitmap even when the format cannot push it down. ApplyBitmapIndexRecordReader then applies that bitmap, and the ORC fallback at lines 785–786 skips the range start again. A real 100-row DE table stored as two ORC column files returns [] for RowRange.of(10, 19), while the ordinary reader returns 0..99 and the expected slice is 10..19.
Construct this bitmap only when that format can use the range path, or explicitly track that the range has already been applied before wrapping RangeSkipReader. Add a partial-column ORC read regression; the existing Parquet case does not cover this branch.
| rowRange != null && !hasFilter && topN == null && limit == null && !hasDv; | ||
| boolean canPushdown = | ||
| fullScanRange | ||
| && !files.isEmpty() |
There was a problem hiding this comment.
[P2] Check every file before disabling the split-level range fallback
canPushdown checks only the first file. After an append table changes from Parquet to ORC, one split can contain both formats. If Parquet comes first, the outer RangeSkipReader is disabled, while createFileReader for the ORC file neither pushes down nor applies its local range. I reproduced this with Parquet rows 0..4 followed by ORC rows 5..9 in one split: range [3,6] returns [3,4,5,6,7,8,9], instead of [3,4,5,6]. This leaks rows from the next training shard. Require all files to support pushdown, or enforce each unsupported file's local slice. The regression passes when this capability check covers every file.
Purpose
This is to solve issue.
Tests
tests for pk table,append table, DE table.