Repository navigation
feat(scan): Support split and parallel scans - Part-1: validated FileScanTask byte ranges - #976
Merged
Conversation
kamcheungting-db
marked this pull request as ready for review
October 1, 2026 09:05
kamcheungting-db
force-pushed
the
feat/file-scan-task-ranges
branch
from
October 4, 2026 01:59
2014413 to
cce43f7
Compare
Preserve start and length in core and REST JSON, and reject partial reads until the reader can honor ranges.
kamcheungting-db
force-pushed
the
feat/file-scan-task-ranges
branch
from
October 12, 2026 00:03
cf714b3 to
3bae712
Compare
Co-authored-by: Isaac <[email protected]>
zhjwpku
reviewed
Oct 12, 2026
Co-authored-by: Isaac <[email protected]>
zhjwpku
approved these changes
Oct 13, 2026
zhjwpku
left a comment
Collaborator
There was a problem hiding this comment.
Other than the two minor issues, LGTM.
wgtmac
reviewed
Oct 14, 2026
A shared DataFile's size may change after MakeSplit, so ToJson could emit a range that FileScanTaskFromJson rejects. Revalidate the range before serializing, matching the REST serializer. Co-authored-by: Isaac <[email protected]>
wgtmac
approved these changes
Oct 15, 2026
| int64_t start; | ||
| int64_t length; | ||
| // Size when the range was validated. Always positive, so safe to divide by. | ||
| int64_t file_size; |
Member
There was a problem hiding this comment.
IMHO, this file_size field is duplicated with that in the data_file. Can we remove this to avoid duplication and possible inconsistency in the future?
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
Allow
FileScanTaskto represent a validated half-open byte range instead of always representing an entire data file. Standalone and REST task JSON now preserve those ranges.FileScanTask::MakeSplit,start,length, andis_splitFileScanTaskReaderuntil range-aware file reading is implementedRange behavior
startis a byte offset, andlengthis the number of bytes to scan, not the ending offset. For a 10-byte file, these two tasks cover the file without overlap:{"start": 0, "length": 4} {"start": 4, "length": 6}A full-file range is canonicalized to the existing whole-file task representation. A zero-length range is valid only for a zero-byte file:
start=0, length=0.Both C++ JSON parsers return
JsonParseErrorfor invalid supplied ranges. Standalone JSON requires both fields. REST JSON defaults to the whole file only when both fields are absent.C++ and Java comparison
Valid standalone ranges behave the same in C++ and Java. C++ additionally validates range bounds. REST range transport differs: Java currently ignores these fields and creates whole-file tasks.
The tables assume a 10-byte data file and otherwise valid JSON, except where a zero-byte file is explicitly mentioned. Java behavior was checked at commit
db43b88.Standalone task JSON
This is the self-contained format with embedded schema, partition spec, and delete files.
startandlengthnull1.0), or integer outside signed 64-bit range(0,10)(0,9)or(4,6)(1,10)(0,0)for a zero-byte fileAll C++ rejections above return
JsonParseError. Error wording can differ from Java. Java accepting a range during parsing does not establish that the range is valid or readable.Sources: Java
FileScanTaskParser,BaseFileScanTask.SplitScanTask, andJsonUtil.getLong.REST scan-task JSON
This format uses external partition specs and references a shared delete-file list.
startandlength(0,10)(0,10)(4,6)All C++ rejections above return
JsonParseError. The current Java REST parser and RESTFileScanTaskschema do not define range handling. These fields are therefore a C++ extension, and this PR does not establish interoperable REST split transport with Java. Sending two partial tasks for the same file to that Java implementation can turn them into two whole-file tasks.Sources: Java
RESTFileScanTaskParserand the RESTFileScanTaskschema.Scope
This PR models, validates, and transports byte ranges. It does not enable partial file reads yet. Returning
NotSupportedprevents a split task from silently rereading the entire file; range-aware format readers will follow separately.Testing
ctest --test-dir build-clang -R "^(scan_test|data_test|rest_catalog_test)$" --output-on-failurejson_serde_testandrest_catalog_testpre-commitpassed on the five changed JSON source/header/test filesgit diff --checkpassed