Repository navigation
Conversation
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a concrete DataSourceV2 implementation for ORC files (OrcDatasourceV2) with worker-side stripe chunking. It adds OrcFileChunker, OrcFileReader, OrcScanner, OrcInMemorySizeEstimator, and exposes the public read_orc API. Feedback on the implementation suggests optimizing the file reading loop in OrcFileReader by checking if the row limit has already been reached before opening subsequent files, thereby avoiding unnecessary I/O overhead.
| for path, chunk_metadatas in self._iter_contiguous_path_groups(input_split): | ||
| for table in self._read_path(path, chunk_metadatas): |
There was a problem hiding this comment.
To avoid unnecessary file opens and I/O overhead, we should check if the row limit has already been reached before calling _read_path for subsequent files in the outer loop.
| for path, chunk_metadatas in self._iter_contiguous_path_groups(input_split): | |
| for table in self._read_path(path, chunk_metadatas): | |
| for path, chunk_metadatas in self._iter_contiguous_path_groups(input_split): | |
| if self._limit is not None and rows_read >= self._limit: | |
| return | |
| for table in self._read_path(path, chunk_metadatas): |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
775827b to
82b21bf
Compare
4ba3909 to
ccd46d4
Compare
|
@laysfire hey - we just merged the datasource for v1. Should we rebase and build off the current v1, pull out any shared utilities if needed? Feel free to update the existing implementation in a way that makes sense |
Noted, Thanks |
Signed-off-by: yifan.xie <[email protected]>
Signed-off-by: yifan.xie <[email protected]>
a7aed7b to
267c530
Compare
Signed-off-by: yifan.xie <[email protected]>
|
Current procedure is as following: The current PyArrow ORC FileFragment does not have a subset() or stripe sub-fragment API. The same pds.Fragment cannot express "read only the 3rd–5th stripe". Meanwhile, in order to reuse functions such as retry, ordering, projection, limit, and stub column from the base class filerreader. Introduce
ORC extends this with OrcFileReader only need to to override:
The common
@ayushk7102 @richardliaw @goutamvenkat-anyscale @abhishekverma-ray Would you mind take a look? |
Signed-off-by: yifan.xie <[email protected]>
8859e19 to
15660b8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit d4698c0. Configure here.
Signed-off-by: yifan.xie <[email protected]>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
## Why `FileChunker` let a `FileIndexer` split one listed file into several manifest rows. Nothing uses that seam any more: Parquet splits by row group inside `FooterFileIndexer`'s footer read, every other indexer emits one row per file, and `FilePartitioner` groups files into read tasks. What remained was an abstract property every indexer had to implement, a `WholeFileChunker` that returned its input unchanged, and a `LineDelimitedFileChunker` with no callers outside its own tests. First PR of the DSv2 reorg series; #66066 and the follow-ups will be rebased onto it. ## What changes - Delete `FileChunker`, `WholeFileChunker`, `LineDelimitedFileChunker` and `LineDelimitedFileChunkMetadata`. The module keeps the manifest metadata types (`ChunkMetadata`, `create_chunk_metadata`, `ParquetRowGroupChunkMetadata`) that `OnlineBinPacker`, `FooterFileIndexer` and `FileManifest` still use. Files: `datasource_v2/chunkers/file_chunker.py` - `FileIndexer` drops the abstract `file_chunker` property. `NonSamplingFileIndexer` drops the constructor argument and property, and emits one manifest row per file with `None` chunk metadata. Files: `datasource_v2/listing/file_indexer.py` - Remove two stale comments naming a `StreamingFileChunker` that never existed. Files: `datasource_v2/readers/parquet_file_reader.py`, `logical/operators/read_operator.py` - Tests: `test_file_chunker.py` becomes `test_chunk_metadata.py` (metadata types only); chunker cases dropped from `test_file_indexer.py` and `test_read_parquet_v2.py`. ## Example Before, an indexer that lists whole files still had to answer the chunker question: ```python class MyIndexer(FileIndexer): @Property def file_chunker(self) -> FileChunker: # required; always WholeFileChunker() return WholeFileChunker() def list_files(self, ctx): ... ``` After: ```python class MyIndexer(FileIndexer): def list_files(self, ctx): ... ``` `read_parquet` behaviour is unchanged: `FooterFileIndexer` never used the chunker it inherited. Net diff is +37 / −287 lines. ## Checks Lint: ruff, ruff `--select I`, black, pydoclint with the CI flags, `git diff --check`. Type check: pyrefly on `python/ray/data`, no errors in the touched files. Tests run locally: ``` pytest python/ray/data/tests/unit/datasource_v2 # 217 passed pytest python/ray/data/tests/datasource/test_read_parquet_v2.py # 37 passed pytest python/ray/data/tests/test_parquet.py # 246 passed, 13 skipped (34 pre-existing moto fixture errors) pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py # 28 passed pytest python/ray/data/tests/test_predicate_pushdown.py # 51 passed, 2 skipped ``` Not a duplicate: the only open PR mentioning `FileChunker` is #66066, my own follow-up in this series. #64540 (ORC) adds an `OrcFileChunker` and will need to drop it when it rebases. Written with AI assistance (Claude Code). Every changed line was reviewed by me and the tests above were run locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Aarrya <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
## Why `FileChunker` let a `FileIndexer` split one listed file into several manifest rows. Nothing uses that seam any more: Parquet splits by row group inside `FooterFileIndexer`'s footer read, every other indexer emits one row per file, and `FilePartitioner` groups files into read tasks. What remained was an abstract property every indexer had to implement, a `WholeFileChunker` that returned its input unchanged, and a `LineDelimitedFileChunker` with no callers outside its own tests. First PR of the DSv2 reorg series; ray-project#66066 and the follow-ups will be rebased onto it. ## What changes - Delete `FileChunker`, `WholeFileChunker`, `LineDelimitedFileChunker` and `LineDelimitedFileChunkMetadata`. The module keeps the manifest metadata types (`ChunkMetadata`, `create_chunk_metadata`, `ParquetRowGroupChunkMetadata`) that `OnlineBinPacker`, `FooterFileIndexer` and `FileManifest` still use. Files: `datasource_v2/chunkers/file_chunker.py` - `FileIndexer` drops the abstract `file_chunker` property. `NonSamplingFileIndexer` drops the constructor argument and property, and emits one manifest row per file with `None` chunk metadata. Files: `datasource_v2/listing/file_indexer.py` - Remove two stale comments naming a `StreamingFileChunker` that never existed. Files: `datasource_v2/readers/parquet_file_reader.py`, `logical/operators/read_operator.py` - Tests: `test_file_chunker.py` becomes `test_chunk_metadata.py` (metadata types only); chunker cases dropped from `test_file_indexer.py` and `test_read_parquet_v2.py`. ## Example Before, an indexer that lists whole files still had to answer the chunker question: ```python class MyIndexer(FileIndexer): @Property def file_chunker(self) -> FileChunker: # required; always WholeFileChunker() return WholeFileChunker() def list_files(self, ctx): ... ``` After: ```python class MyIndexer(FileIndexer): def list_files(self, ctx): ... ``` `read_parquet` behaviour is unchanged: `FooterFileIndexer` never used the chunker it inherited. Net diff is +37 / −287 lines. ## Checks Lint: ruff, ruff `--select I`, black, pydoclint with the CI flags, `git diff --check`. Type check: pyrefly on `python/ray/data`, no errors in the touched files. Tests run locally: ``` pytest python/ray/data/tests/unit/datasource_v2 # 217 passed pytest python/ray/data/tests/datasource/test_read_parquet_v2.py # 37 passed pytest python/ray/data/tests/test_parquet.py # 246 passed, 13 skipped (34 pre-existing moto fixture errors) pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py # 28 passed pytest python/ray/data/tests/test_predicate_pushdown.py # 51 passed, 2 skipped ``` Not a duplicate: the only open PR mentioning `FileChunker` is ray-project#66066, my own follow-up in this series. ray-project#64540 (ORC) adds an `OrcFileChunker` and will need to drop it when it rebases. Written with AI assistance (Claude Code). Every changed line was reviewed by me and the tests above were run locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Aarrya <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
## Description This PR adds an internal ORC scanner and reader to DataSourceV2. `OrcScanner` and `OrcFileReader` reuse `ArrowFileScanner` and `FileReader` with PyArrow `OrcFileFormat` to scan whole-file fragments in batches. They support column projection, Arrow-evaluated row filters, limits, synthesized path/partition columns, and alignment to a supplied schema (including nulls for missing file columns). `OrcFileReader` retains Ray's pickled-object-column safety check. The PR also registers `FileFormat.ORC` and adds direct `FileManifest` tests. This PR also wires public `read_orc()` to `OrcDatasourceV2` through the shared `DataContext.use_datasource_v2` flag, which defaults to true. Setting it to false selects V1; `RAY_DATA_USE_DATASOURCE_V2` configures the same flag. Path filtering via `partition_filter` is supported. The datasource reuses generic file components and bounded schema sampling; columns present only in files outside the sample may be omitted. Stripe-level Ray task splitting and ORC-native predicate pruning remain follow-up work; DataSourceV2 abstract interfaces are unchanged. When partitioning is enabled in V2, directory values take precedence over same-named file columns. Partition predicates prune known nonmatching files before scanning; files with missing path keys retain the complete read filter. Existing partition-directory validation remains unchanged. The related ORC V2 PR #64540 is closed and unmerged; it used the retired `FileChunker` design. This implementation reuses the existing `ArrowFileScanner` and `FileReader` interfaces. ## Related issues Fixes #66526. ## Additional information ### Known limitations ORC V2 shares two filtering issues with Parquet V2 in the common file-reading path. Partition pruning can fail when parsed partition-value types differ from the Dataset's logical schema, as tracked in [#66915](#66915). Expression filters on a synthesized `path` column can return incorrect rows when a partition directory is also named `path`, or raise a missing-field error without partitioning, as tracked in [#66916](#66916). Both issues are tracked separately and remain unresolved by this PR. Path selection through `partition_filter` is distinct from expression filtering on the synthesized `path` column. ### Validation - `python -m pytest -q python/ray/data/tests/unit/datasource_v2/test_orc_file_reader.py python/ray/data/tests/unit/datasource_v2/test_orc_datasource_v2.py python/ray/data/tests/unit/datasource/test_pickle_gate_coverage.py python/ray/data/tests/unit/datasource_v2/test_file_scanner.py python/ray/data/tests/unit/datasource_v2/test_derive_list_files_pushdown.py` passed with Python 3.12.13 and PyArrow 23.0.1: 426 tests, with no failures, errors, or skips. - `python -m pytest -q python/ray/data/tests/datasource/test_orc.py` passed with Python 3.12.13 and PyArrow 23.0.1: 149 tests covering V1/V2 public reads, partition handling, filtering, projection, limits, and ORC read/write round trips, with no failures, errors, or skips. - Pyrefly 0.51.0 checked all ORC implementation and test files: 0 errors. - `python ci/pipeline/check-test-run.py` passed. - Repository hooks passed for the changed files, including Ruff, Black, pydoclint, AST, docstyle, and import checks. - Semgrep checked `orc_scanner.py` and `test_orc_file_reader.py`: no findings or errors. - PyArrow 17 compatibility was verified for OrcFileFormat fragment scanning, `batch_size`, `batch_readahead`, and missing-column null-fill alignment. PyArrow applies ORC row filters after reading selected columns; this PR does not claim ORC-native stripe pruning or a fixed decoded-memory bound from `batch_size`. AI assistance was used: Codex helped implement the change and draft this PR; Claude assisted with planning and code review. --------- Signed-off-by: jiangxt2 <[email protected]>

Description
Support read orc format
Related issues
Additional information