Skip to content

[Data] DSv2 Reorg [0/6]: Remove FileChunker - #66244

Merged
goutamvenkat-anyscale merged 4 commits into
ray-project:masterfrom
AarryaSaraf:dsv2-remove-file-chunker
Sep 18, 2026
Merged

goutamvenkat-anyscale merged 4 commits into
ray-project:masterfrom
AarryaSaraf:dsv2-remove-file-chunker

Conversation

@AarryaSaraf

Copy link
Copy Markdown
Contributor

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:

class MyIndexer(FileIndexer):
    @property
    def file_chunker(self) -> FileChunker:   # required; always WholeFileChunker()
        return WholeFileChunker()

    def list_files(self, ctx): ...

After:

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

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Aarrya <[email protected]>
@AarryaSaraf
AarryaSaraf marked this pull request as ready for review September 17, 2026 20:02
@AarryaSaraf
AarryaSaraf requested a review from a team as a code owner September 17, 2026 20:02
@AarryaSaraf AarryaSaraf added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Sep 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the FileChunker abstraction (including WholeFileChunker, LineDelimitedFileChunker, and LineDelimitedFileChunkMetadata) from the DataSourceV2 listing and indexing pipeline. Instead of using a chunker to split files during listing, the FileIndexer now directly batches files into manifests with None chunk metadata, simplifying the listing path. Format-specific indexers (such as the Parquet footer indexer) are expected to handle their own splitting by overriding list_files. Associated unit tests and integration tests have been updated or removed accordingly. I have no further feedback to provide as there are no review comments.

@goutamvenkat-anyscale
goutamvenkat-anyscale merged commit b2a17bd into ray-project:master Sep 18, 2026
6 checks passed
AarryaSaraf added a commit to AarryaSaraf/ray that referenced this pull request Sep 18, 2026
Same change rebuilt on top of ray-project#66244 (PR 0); the tree is identical to e631f0e.

Signed-off-by: Aarrya <[email protected]>
AarryaSaraf added a commit to AarryaSaraf/ray that referenced this pull request Sep 18, 2026
goutamvenkat-anyscale pushed a commit that referenced this pull request Sep 19, 2026
…arquet datasources (#66066)

## Description

Second PR of the DSv2 Reorg series (`[0/6]` … `[6/6]`), stacked on
#66244
(`[0/6]`); the diff shows both until that one merges.

`_read_datasource_v2` in `read_api.py` reads four attributes and calls
one
method that `DataSourceV2` never declared. Parquet defines them all, so
it
worked; any other datasource that implemented only the abstract methods
failed
with `AttributeError` inside the read code. After this PR, implementing
the
abstract members of `DataSourceV2` is enough for a new datasource to
work end
to end, and a missing one is reported at construction. No behavior
change for
Parquet.

```mermaid
flowchart LR
  R[read_api._read_datasource_v2] -->|reads paths, filesystem, file_extensions, shuffle; calls _get_file_indexer| D[DataSourceV2 base class]
  D -->|abstract: paths, filesystem, _get_file_indexer| S[new datasource subclass]
  D -->|default None: file_extensions, shuffle| S
```

### Changes

1. Declare everything the read code uses on `DataSourceV2`: `paths`,
`filesystem`, `_get_file_indexer` abstract; `file_extensions`, `shuffle`
   default `None`.
2. `filesystem` may be `None`, for sources that read through their own
   library (PyIceberg, Lance, hudi-rs).
3. `FileScanner.prune_manifest` → `Scanner.prune_input_split`, so
partition
   pruning runs for every scanner, not only `FileScanner` subclasses.
4. `FileIndexer` docstring updated for the per-file listing contract
left
   after #66244.

## Additional information

Not a duplicate: no open PR changes the `DataSourceV2` base class.
#65887 and
#65888 also touch `file_indexer.py` / `listing_utils.py`, so expect
small merge
conflicts there.

Tests run locally from this branch (macOS, `~/ray/.venv`), from
`python/ray/data`:

```
pytest -q tests/unit/datasource_v2                     # 119 passed
pytest -q tests/datasource/test_read_parquet_v2.py     # 37 passed
pytest -q tests/datasource/test_parquet.py             # 246 passed, 13 skipped, 34 errors
```

The 34 errors are moto `s3_fs` fixture setup errors (`moto_server` not
on
PATH), identical on master. `ruff`, `black` and `pydoclint` at the
pre-commit
pins are clean; `pyrefly` reports the same pre-existing errors as the
base
commit.

Written with Claude Code; I reviewed every changed line and ran the
tests above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Aarrya <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
## 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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…arquet datasources (ray-project#66066)

## Description

Second PR of the DSv2 Reorg series (`[0/6]` … `[6/6]`), stacked on
ray-project#66244
(`[0/6]`); the diff shows both until that one merges.

`_read_datasource_v2` in `read_api.py` reads four attributes and calls
one
method that `DataSourceV2` never declared. Parquet defines them all, so
it
worked; any other datasource that implemented only the abstract methods
failed
with `AttributeError` inside the read code. After this PR, implementing
the
abstract members of `DataSourceV2` is enough for a new datasource to
work end
to end, and a missing one is reported at construction. No behavior
change for
Parquet.

```mermaid
flowchart LR
  R[read_api._read_datasource_v2] -->|reads paths, filesystem, file_extensions, shuffle; calls _get_file_indexer| D[DataSourceV2 base class]
  D -->|abstract: paths, filesystem, _get_file_indexer| S[new datasource subclass]
  D -->|default None: file_extensions, shuffle| S
```

### Changes

1. Declare everything the read code uses on `DataSourceV2`: `paths`,
`filesystem`, `_get_file_indexer` abstract; `file_extensions`, `shuffle`
   default `None`.
2. `filesystem` may be `None`, for sources that read through their own
   library (PyIceberg, Lance, hudi-rs).
3. `FileScanner.prune_manifest` → `Scanner.prune_input_split`, so
partition
   pruning runs for every scanner, not only `FileScanner` subclasses.
4. `FileIndexer` docstring updated for the per-file listing contract
left
   after ray-project#66244.

## Additional information

Not a duplicate: no open PR changes the `DataSourceV2` base class.
ray-project#65887 and
ray-project#65888 also touch `file_indexer.py` / `listing_utils.py`, so expect
small merge
conflicts there.

Tests run locally from this branch (macOS, `~/ray/.venv`), from
`python/ray/data`:

```
pytest -q tests/unit/datasource_v2                     # 119 passed
pytest -q tests/datasource/test_read_parquet_v2.py     # 37 passed
pytest -q tests/datasource/test_parquet.py             # 246 passed, 13 skipped, 34 errors
```

The 34 errors are moto `s3_fs` fixture setup errors (`moto_server` not
on
PATH), identical on master. `ruff`, `black` and `pydoclint` at the
pre-commit
pins are clean; `pyrefly` reports the same pre-existing errors as the
base
commit.

Written with Claude Code; I reviewed every changed line and ran the
tests above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Aarrya <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants