Repository navigation
feat(scan): Support split and parallel scans - Part-2a: read Parquet files by task range - #1002
Merged
wgtmac merged 11 commits intoOct 21, 2026
Merged
Conversation
kamcheungting-db
force-pushed
the
feat/file-scan-task-range-reading
branch
3 times, most recently
from
October 14, 2026 22:25
e94e6b1 to
4396b2f
Compare
Contributor
|
lgtm |
kamcheungting-db
force-pushed
the
feat/file-scan-task-range-reading
branch
from
October 16, 2026 22:08
4396b2f to
72a99ef
Compare
shangxinli
reviewed
Oct 17, 2026
wgtmac
reviewed
Oct 19, 2026
FileScanTaskReader previously rejected tasks that read part of a file. It now passes Parquet task ranges to the reader while keeping the full file size available for reading the footer. Use the first column's starting page to assign each row group to a range. This works when optional row-group offsets are missing and ensures that adjacent ranges read every row exactly once. Keep row positions and inherited row IDs relative to the whole file so deletes still remove the correct rows, even when page offsets are out of order. Recheck task bounds when opening a file, skip empty row groups, and reject invalid page offsets and partial tasks for unsupported formats. Add tests for split boundaries, deletes, row lineage, changed file sizes, and files with missing row-group offsets. Validation: all 306 tests in parquet_test and data_test pass. Formatting and whitespace checks pass. pre-commit could not run because it is not installed and PyPI DNS resolution failed during installation.
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…alled InitReadContext advanced to the next row-group range before the output schema was built. If schema setup failed, a retried Next() skipped the first range. Opening a range no longer consumes it; ConsumeRowGroupRange() does that once the reader is in place. Co-authored-by: Isaac <no-reply@databricks.com>
Java Iceberg reads a split through parquet-java's withRange(), which keeps a row group when its midpoint (first-column start plus half the compressed size) falls in [start, start + length). Use the same rule so C++ and Java readers pick the same row groups for splits that cut through a row group. Co-authored-by: Isaac <no-reply@databricks.com>
Require shared metadata to remain unchanged for a task's lifetime, with tasks rebuilt after metadata changes. Remove the cached row estimate and derive it from DataFile. Limit the row-count sum guarantee to valid, non-overlapping splits covering a file with unchanged metadata. Keep defensive bounds checks for invalidated tasks and distinguish those checks from the supported metadata contract in the regression tests. Validation: 472 tests passed across scan_test, data_test, and parquet_test; 10 tests skipped. pre-commit passed.
wgtmac
force-pushed
the
feat/file-scan-task-range-reading
branch
from
October 21, 2026 02:44
9749fd6 to
e6787c0
Compare
wgtmac
approved these changes
Oct 21, 2026
wgtmac
left a comment
Member
There was a problem hiding this comment.
Thanks for working on this @kamcheungting-db! I've rebased to resolve conflicts and rewrite the test to avoid adding resources. Thanks @shangxinli for reviewing this!
wgtmac
pushed a commit
that referenced
this pull request
Nov 22, 2026
… group planning (#1113) ## What this PR does Adds task-group planning for parallel scans, on top of the byte ranges from #976 and the range-aware Parquet reads from #1002: - `DataTableScan::PlanTasksStream()` — lazy, fallible stream of `FileScanTaskGroup` - `DataTableScan::PlanTasks()` — the same, collected into a vector Eligible Parquet files are split into byte ranges, and the tasks are packed into groups of roughly `read.split.target-size` bytes. ## How it works ``` PlanFilesStream() | v Whole Parquet file larger than target? -- no --> keep task as is | yes v Valid manifest split_offsets? | yes | no v v merge intervals fixed-size byte ranges toward target (shorter final range if needed) | | +---------+----------+ v pack tasks into groups | v FileScanTaskGroup stream ``` **Packing** — follows Java Iceberg’s first-fit and eviction rules: - task weight = `max(range bytes + delete content bytes, (1 + delete files) * open-file-cost)`; a deletion vector counts its blob size, not its container file size - a task joins the first open group that still fits - at most `planning-lookback` groups stay open; when a new one opens, the largest open group is closed first - at most 1,024 tasks per group; a task heavier than the target becomes its own group **Files that stay whole:** files at or below the target size, non-Parquet files, and Parquet files whose valid manifest offsets yield only one range. ## Settings | Property | Default | Resolves from | |---|---|---| | `read.split.target-size` | 128 MB | scan option > table property > default | | `read.split.planning-lookback` | 10 | same | | `read.split.open-file-cost` | 4 MB | same | Malformed or invalid values fail planning before any planning work starts. ## Stream behavior Single pass, lazy, owns the underlying task stream and its metrics, and can outlive the scan. An executor set with `PlanWith()` is borrowed and must stay alive until the group stream is destroyed. Destroying the stream mid-consumption releases all planning resources. The stream retains the current file’s remaining splits across calls to `Next()`. Splitting requires no data-file I/O or Parquet bundle registration. ## Tests - `table_test` (core-only, includes `ScanTaskPlanningTest`): split coverage and merging, delete files and residual filters carried into every split, mixed Parquet/Avro groups, the Java weight formula, group packing (first fit, lookback, 1,024 cap, oversized singleton), settings precedence and errors, incremental consumption, early destruction. - Bundled `scan_test`, across manifest format versions: split offsets used with no footer read (the file path does not exist), fixed-size ranges for missing or invalid offsets, files at or below target stay whole, every row read exactly once across splits, scan option beats table property, no-snapshot scans, delete files carried into every split. `pre-commit` is clean. ## Related Part 1 #976 · Part 2a #1002 · Part 2b #1062 · Part 2c #1065. The bounded parallel reader and end-to-end validation follow in later parts.
This was referenced Nov 23, 2026
Open
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.
Summary
Let
FileScanTaskReaderread a byte range of a Parquet file. #976 added task ranges but rejected them at read time.How it works
Each row group goes to the split that contains its midpoint: the first column's first page plus half the row group's compressed size. This matches Java Iceberg, which reads splits through parquet-java's
withRange()filter. So splits that cover the file read every row exactly once, and C++ and Java pick the same row groups even when a split boundary cuts through a row group.Example: a file with 100-row groups starting at bytes 4, 1000, and 2000, each about 1000 bytes (midpoints near 500, 1500, and 2500):
_posstart=0, length=1000start=1000, length=2000_posand_row_idstay relative to the whole file, so deletes and row lineage still work.Other changes:
file_offsetis missingNotSupportedTesting
Splits return the same rows,
_pos, and_row_idas a whole-file read, with and without deletes. Also covers missing offsets, out-of-order row groups, invalid offsets and sizes, and splits that contain a row group's start but not its midpoint (and the reverse).ctest --test-dir build-clang -R "^(data_test|parquet_test|scan_test)$" --output-on-failureclang-format --dry-run --Werror,git diff --checkThis pull request and its description were written by Isaac.