Skip to content

[Data][Delta DSv2][6/11] Support generated_id_column checkpointing for Delta reads - #68285

Open
abhishekverma-ray wants to merge 2 commits into
abhishek/delta-dsv2-5-log-pruningfrom
abhishek/delta-dsv2-6-checkpoint
Open

abhishekverma-ray wants to merge 2 commits into
abhishek/delta-dsv2-5-log-pruningfrom
abhishek/delta-dsv2-6-checkpoint

Conversation

@abhishekverma-ray

@abhishekverma-ray abhishekverma-ray commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

CheckpointConfig(generated_id_column=...) now works with read_delta on the DataSourceV2 path. It doesn't depend on the log pruning in #68284; it sits above it only to keep the stack linear.

Replaces #67678, which was opened from a fork; earlier review is there. This PR is part of a GitHub stack, so its diff shows only this layer.

Before

Generated IDs are Parquet-only; #68282 rejects them for read_delta.

After

A generated ID names a row's place in its Parquet data file (file, row group, row). Delta data files never change, so a job resumed against the same table version finds every ID again, and its listing skips finished files and row groups as for Parquet. IDs use the table-relative data file path.

read_delta without version= reads the version that is latest at call time, so a resumed job may read a newer one:

  • Appends in between add files and remove none. Their rows are new work, and the finished IDs still match, so the resume works.
  • A rewrite in between (compaction, overwrite) moves finished rows into new files with new IDs, which would be written again. The resumed job's listing checks that every file the checkpoint has as finished is still in the version it reads. If one isn't, it raises InvalidCheckpointingConfig before reading, and says to pass version= with the version the earlier run read.
  • Binding the column without version= warns once and names the version read (for example "pass version=2"), so the user has the number.

Why not stricter or looser:

  • Requiring version= with generated_id_column would also block the safe append-only case.
  • Storing the version in the checkpoint and reusing it needs a checkpoint metadata format; that can follow separately.
  • Limit: the listing only gets the fully finished read units, so a row group that was only partly committed isn't checked.

Subsystems

Logical planning (rules/bind_generated_id_column.py), IO (formats/delta/); messages and docs in planner.py, checkpoint/interfaces.py.

Testing

  • test_checkpoint.py: test_generated_id_recovery_no_missing_rows (fail partway, resume, every row written, checkpoint deleted) and test_generated_id_rerun_after_success_writes_nothing are parametrized over read_parquet and read_delta.
  • test_delta_v2.py:
    • IDs name each row's file / row group / row.
    • test_generated_id_resume_of_the_latest_version: an append between runs is read as new rows; a compaction makes the resume raise; resuming at the pinned version writes nothing again. It fails without the check.
    • test_generated_id_warns_unless_the_version_is_pinned: the warning appears only without version=, and names the version.
  • test_delta_datasource_v2.py: binding adds the column.
  • test_delta.py, test_delta_v2.py and the Delta unit tests: 269 passed together with test_checkpoint.py's generated-ID tests. test_checkpoint.py alone: 133 passed; 1 moto-S3 case (test_skip_checkpoint_flag[...s3...]) times out locally, as it does without this stack.
  • CI-style pyrefly reports no errors in the changed files.

AI assistance was used (Claude Code); every line has been reviewed by the submitter.

🤖 Generated with Claude Code

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@abhishekverma-ray abhishekverma-ray added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Nov 18, 2026
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from 5a38701 to e254751 Compare November 18, 2026 04:36
raise InvalidCheckpointingConfig(
"`generated_id_column` doesn't support `read_delta` yet."
)
_warn_if_delta_version_not_pinned(scanner)

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.

Without version=, a compaction between runs makes the rerun process every row again, and only a log line says so:

ray.data.read_delta(path).write_parquet(out)  # 18 rows
DeltaTable(path).optimize.compact()
ray.data.read_delta(path).write_parquet(out)  # the same 18 rows again

Is a warning enough here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, a warning isn't enough: a resumed job wrote the rewritten rows again with nothing to stop it. I looked at three options:

  1. Require version= whenever generated_id_column is set. It's the simplest, but it also blocks the most common safe case: an append-only table, where resuming at the latest version is correct. Appends add files without removing any, so the finished IDs still match, and the new files are just new work.
  2. Save the version in the checkpoint and reuse it when resuming. This is the cleanest for users. But today the checkpoint holds only row IDs, so this needs a new checkpoint metadata format and its compatibility story. I'd rather do that separately than inside this stack.
  3. Detect the rewrite on resume and fail before reading (what I did). A generated ID already names its data file. When a job resumes, the Delta listing checks that every file the checkpoint has as finished is still in the version it reads. A compaction or overwrite removes those files, so the listing raises InvalidCheckpointingConfig before any row is read. The error says to pass version= with the version the earlier run read. Appends pass the check, so they keep working.

To make that error easy to act on, the unpinned-read warning now names the version that was read, for example "pass version=2 to read_delta". The user has the number from the first run's log.

Limit: the listing only receives the read units the checkpoint has as fully done (whole files and whole row groups). A row group that was only partly committed isn't checked. If its file was compacted away and no fully done unit was, those few rows would still be written again. Closing that gap means passing the partly done units to the listing too, which changes the shared generated-ID planner. Option 2 would close it as well, so I'd do it together with that.

Your example now: the second write_parquet raises after the compaction. With version= set to the earlier version, it resumes and writes nothing again. test_generated_id_resume_of_the_latest_version covers append (new rows read), compact (raises), then pinned resume (nothing written).

@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from e254751 to eb666a2 Compare November 19, 2026 03:48
@abhishekverma-ray
abhishekverma-ray removed this pull request from stack #68288 November 19, 2026 04:25
@abhishekverma-ray abhishekverma-ray changed the title [Data][Delta DSv2][6/8] Support generated_id_column checkpointing for Delta reads [Data][Delta DSv2][6/9] Support generated_id_column checkpointing for Delta reads Nov 19, 2026
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from eb666a2 to c6931f3 Compare November 19, 2026 04:49
)


def test_generated_id_rerun_after_success_writes_nothing(checkpointed_table, tmp_path):

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.

These two tests copy test_checkpoint.py's test_generated_id_rerun_after_success_writes_nothing and test_generated_id_recovery_no_missing_rows; parametrize those over read_parquet / read_delta instead. test_scanner_knows_whether_the_version_was_pinned checks a stored argument; asserting the warning through read_delta covers it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. test_generated_id_recovery_no_missing_rows and test_generated_id_rerun_after_success_writes_nothing in test_checkpoint.py are parametrized over read_parquet and read_delta, and the two copies are gone. test_scanner_knows_whether_the_version_was_pinned is replaced by test_generated_id_warns_unless_the_version_is_pinned, which checks the warning through read_delta (and that it names the version).

@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from c6931f3 to 9601d6a Compare November 20, 2026 17:28
@abhishekverma-ray
abhishekverma-ray removed this pull request from stack #68331 November 20, 2026 17:29
@abhishekverma-ray abhishekverma-ray changed the title [Data][Delta DSv2][6/9] Support generated_id_column checkpointing for Delta reads [Data][Delta DSv2][6/11] Support generated_id_column checkpointing for Delta reads Nov 20, 2026
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from 9601d6a to 82d43bc Compare November 23, 2026 10:15
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from 82d43bc to f342235 Compare November 23, 2026 10:26
sampan-s-nayak pushed a commit that referenced this pull request Nov 23, 2026
…68282)

## Summary

Adds `DeltaDatasourceV2` and `DeltaScanner`, the DataSourceV2 datasource
for one version of a Delta Lake table. Third part of the split of
#67676. `read_delta` starts using it in #68283.

Replaces #67889, which was opened from a fork; earlier review is there.
This PR is part of a GitHub stack, so its diff shows only this layer.

## Before

No DataSourceV2 datasource for Delta.

## After

- `DeltaDatasourceV2(DataSourceWithMetadata)`: the driver pins the
version and takes the schema and partition columns from the log. The
file list is built from the log in a Ray task, not on the driver;
deltalake 1.6 and later load it when the table is opened anyway
(`without_files` is ignored there). `_get_file_indexer()` returns the
`DeltaFileIndexer` from #67888, and `get_file_partitioner()` the shared
row-group bin packer from #67887. #68407 opens the table only once, in a
Ray task.
- `DeltaScanner(ParquetScanner)`: data files are Parquet, so filter,
column and limit pushdown are inherited. Partition columns keep their
place in the output; an `include_paths` `path` column comes last, as
with the V1 reader.
- Partition values come from the log, not the paths (#67888):
`DeltaScanner` prunes partitions with `DeltaPartitionPruner`, which the
listing applies to each file's values, and reads with `DeltaFileReader`,
a `ParquetFileReader` that takes each file's values from the manifest's
`__delta_partition_values` column. `ParquetScanner` gets a
`reader_class` class attribute so the scanner can swap the reader
without copying `create_reader`.
- Everything is read through a filesystem rooted at the table directory,
as `DeltaTable.to_pyarrow_dataset` does: the caller's, or `deltalake`'s
`DeltaStorageHandler` built from `storage_options`. Credentials and
`az://` behave as in V1.
- Data files are opened with their sizes from the log, so S3 gets no
HEAD request per open:
- With `deltalake`'s filesystem, `DeltaTableFileSystemHandler` wraps
`DeltaStorageHandler`. The listing gives it every file's size before the
footer reads, and `DeltaFileReader` gives it each manifest's sizes. It
builds the deltalake handler on first use.
- With a caller's `SubTreeFileSystem` over S3 (what `read_unity_catalog`
passes), `filesystem_for_sized_opens` now unwraps it, as it already did
a plain `S3FileSystem`.
- `count()` takes each file's row count from the log (`numRecords`), not
from its Parquet footer: the whole-file listing that `count()` uses
carries the counts in a `__delta_num_records` manifest column, and
`DeltaFileReader.read_metadata` reads a footer only for a file whose
writer recorded no stats. Tables with deletion vectors, whose counts
include deleted rows, never reach this reader.
- `delta_datasource_v2_unsupported_reason()` says when a table must stay
on the V1 reader: reader features beyond `timestampNtz` (deletion
vectors, ...), column mapping, a partition column type whose values
don't round-trip through a string (binary, ...), PyArrow scan options,
or a table `path` column with `include_paths`. It fails closed. V1 reads
some of these tables; it rejects the others (column mapping, deletion
vectors) with the same error as before. #68408 replaces this fallback
with errors, before #68286 makes V2 the default.
- `generated_id_column` rejects Delta reads for now (#68285 adds
support).
- The pickle gate scan allowlists `delta_datasource_v2.py`: its only
match is a schema `.to_arrow()`; data files are read and gated in
`ParquetFileReader`.

```mermaid
flowchart LR
    subgraph IO["Subsystem: IO"]
        subgraph D["Component: datasource_v2/formats/delta"]
            DS["driver: DeltaDatasourceV2<br/>log schema, pinned version"] --> IX["DeltaFileIndexer (2/11)"]
            DS --> BP["make_row_group_bin_packer (1/11)"]
            DS --> SC["DeltaScanner → DeltaFileReader<br/>partition values from the manifest,<br/>table-rooted filesystem"]
        end
    end
    classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000
    class DS,SC added
```

## Subsystems

IO (`_internal/datasource_v2/formats/delta/`;
`ParquetScanner.reader_class`; `filesystem_for_sized_opens` in
`_internal/util.py`). Ripple: logical planning
(`bind_generated_id_column.py` rejects Delta scanners).

## Not a duplicate

Split out of #67676, which takes over #65142 (tobby168, credited as
co-author). No other open PR reads Delta through DSv2.

## Testing

Same env as #67887:

- `pytest
python/ray/data/tests/unit/datasource_v2/test_delta_datasource_v2.py`:
20 passed. It covers:
  - the schema and partitioning from the log, and version pinning;
  - column order and `path` placement, and unknown-column errors;
- pickling the indexer and scanner, and reading through the unpickled
reader: each row gets its file's partition values from the log, and
every data file opens with its size from the log (fails if the reader
doesn't pass the sizes, or if two files' partition values are swapped);
- `count()`'s row counts: from the log with no file opened, and from the
footers when the log has no counts (with the reader change reverted, the
first case opens all 3 files and fails);
- every fallback reason, and a real table passing the eligibility check;
  - the `generated_id_column` rejection.
- `pytest python/ray/data/tests/unit/datasource_v2/`: 1546 passed (rerun
after the review round in a fresh env with the Nov 18 Ray nightly and CI
pins). At the top of the stack (#68287), after the `count()` change:
unit 1740 passed, `test_delta.py` and `test_delta_v2.py` 138 passed, 1
skipped. I skipped `test_text_datasource_v2.py`, which master added this
week and which needs `snappy`, not installed locally.
- `tests/unit/datasource/` (pickle gate scan): 125 passed.
- `pytest python/ray/data/tests/test_util.py`: 51 passed, including
`filesystem_for_sized_opens` on a `SubTreeFileSystem` over S3.
- The S3 request count is tested end to end in #68283.
- pre-commit and pyrefly (CI file set) pass.

AI assistance was used (Claude Code); every line has been reviewed by
the submitter.

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

---------

Signed-off-by: Abhishek Verma <[email protected]>
Co-authored-by: tobby168 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@sampan-s-nayak
sampan-s-nayak force-pushed the abhishek/delta-dsv2-6-checkpoint branch from f342235 to 690ac43 Compare November 23, 2026 11:13
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch 2 times, most recently from ade118b to e508405 Compare November 24, 2026 03:09
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch from e508405 to 0511f4e Compare November 24, 2026 05:57
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-dsv2-6-checkpoint branch 2 times, most recently from 07b4a34 to aeae208 Compare November 26, 2026 03:34
goutamvenkat-anyscale pushed a commit that referenced this pull request Nov 27, 2026
…(opt-in) (#68283)

## Summary

Routes `ray.data.read_delta` through the Delta Lake DataSourceV2 reader
behind the private, temporary `DataContext._use_delta_datasource_v2`
(off by default). Last part of the split of #67676. #68284, #68285,
#68330, #68407 and #68408 build on it. #68286 deletes the switch, so
`use_datasource_v2` alone decides, as it does for `read_parquet` and
`read_orc`.

Replaces #67890, which was opened from a fork; earlier review is there.
This PR is part of a GitHub stack, so its diff shows only this layer.

## Before

`read_delta` opens the whole table on the driver
(`DeltaTable.to_pyarrow_dataset()`), builds the full file list there,
and reads it through the V1 `ParquetDatasource`, one read task per file.

## After

With the switch on (and `use_datasource_v2`, already the default),
`read_delta` reads through `DeltaDatasourceV2` (#68282):

- The table on the driver is used only for its log metadata
(`without_files=True` on deltalake before 1.6; later versions ignore
it).
- The file list is built in a Ray task from the log at the pinned
version (#67888).
- Files are split into row-group read units, and DSv2 pushdown and
resume apply.
- Files are listed in path order, so one version lists its files in one
order however its log is checkpointed. `deltalake`'s own order follows
the row layout of the latest checkpoint, which the protocol leaves to
the writer.
- `filesystem=`, `storage_options`, `catalog=` and `include_paths`
behave as before.

Some reads keep using the V1 reader, with an info log saying why:

- Tables that `delta_datasource_v2_unsupported_reason()` rejects. V1
then reads the table that was checked, at the same version. On deltalake
1.6+ it reuses that table rather than loading it again; before 1.6 it
reopens it with its file list.
- Reads that pass `partition_filters` (added in #67900). The V2 reader
doesn't apply them yet and would read every partition, so these reads go
to V1 without opening the table for the V2 check, with their own info
log. #68330 applies them in V2.

`filter(expr)` on partition columns already prunes in V2.

Later layers change this before #68286 makes V2 the default:

- #68407 opens the table only once, in a Ray task, instead of on the
driver and again in the listing. That task also rejects a log that names
data files by absolute path (as a shallow clone's does), so `read_delta`
fails right away. V1 can't read such tables either.
- #68408 replaces the V1 fallback with errors.

### Changes from V1

- An empty table's `schema()` is the schema in the log. V1 returns
`None`.
- `input_files()` is empty until the read runs, because the files are
listed in Ray tasks (as for `read_parquet` on DataSourceV2).
- Read tasks hold row-group runs packed by size, not one file each. A
large file can be split across tasks, and small files share one.
- The log is read in Ray tasks (the listing here; from #68407 also the
table open), so worker nodes, not only the driver, need read access to
the table's `_delta_log`. Credentials in `storage_options` travel with
the tasks. #68286 says so in the `read_delta` docstring.
- A data file whose size is missing from the log is still read (its
footer read finds the size); only files of size 0 are skipped.
- With `preserve_order=True`, rows come back in path order. V1 reads
files in `deltalake`'s order (newest commit first for JSON commits),
which can change for one version when a checkpoint lays out its rows in
another order.
- Unchanged: the version is pinned when `read_delta` is called.

```mermaid
flowchart TD
    subgraph Before
        subgraph BS[Subsystem: IO]
            subgraph BC["Component: read_delta (read_api.py)"]
                B1["driver: DeltaTable(...).to_pyarrow_dataset()<br/>(full file list)"] --> B2["V1 ParquetDatasource.from_pyarrow_dataset"]
                B2 --> B3["Read: one task per file"]
            end
        end
    end
    subgraph After
        subgraph AS[Subsystem: IO]
            subgraph AC["Component: read_delta → DataSourceV2 formats/delta"]
                A0{"_use_delta_datasource_v2, table supported<br/>and no partition_filters?"} -->|no| A5["V1 path (unchanged)"]
                A0 -->|yes| A1["driver: DeltaTable (log metadata)<br/>pin version, schema, partition cols"]
                A1 --> A2["ListFiles task: DeltaFileIndexer<br/>add actions at pinned version, sorted by path, footer reads"]
                A2 --> A3["OnlineBinPacker: row-group read units"]
                A3 --> A4["ReadFiles: DeltaScanner / ParquetFileReader"]
            end
        end
    end
    classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000
    classDef changed fill:#fff9c4,stroke:#f9a825,color:#000
    class A0 changed
    class A1,A2,A3,A4 added
```

## Subsystems

API (`read_api.read_delta`, the private
`DataContext._use_delta_datasource_v2`) carries the change; IO for the
listing order, the README and the tests.

## Not a duplicate

Split out of #67676, which takes over #65142 (tobby168, credited as
co-author). richardliaw asked for a restart on the current DSv2 layout.
No other open PR reads Delta through DSv2.

## Testing

Same env as #67887 (deltalake 1.5.0, pyarrow 23).

Each module runs in its own pytest process, as CI runs one `py_test` per
file:

- `test_delta.py`: 54 passed. `test_delta_v2.py`: 35 passed.
`tests/datasource_v2/test_delta_footer_listing.py`: 2 passed.
- `test_delta.py` runs under both readers through conftest's
`datasource_v2` fixture. Tests that take the V1 path with either reader
run once: the `partition_filters` tests (until #68330), the
multiple-paths check, `_delta_file_sizes` and `use_datasource_v2 =
False`. An empty table's schema from the log is a separate V2-only test.
- The no-`get_file_info` check
(`test_delta_read_takes_file_sizes_from_the_log`) runs under both
readers. Its handler records each call in a file, so calls made inside
Ray tasks count too.
- What `test_delta_v2.py` checks, V2 only (`datasource_v2` fixture,
`ray_start_regular_shared`), through `read_delta` and `Dataset` methods.
It tells the readers apart by the read operator's name in `ds.stats()`.
- V2 returns the same rows and schema as V1 for partitioned tables
(special-character, null, int and date partitions).
- Filters on partition and data columns, `columns=`, `include_paths` and
a table-rooted `filesystem=`.
- Count after overwrite, version pinning at call time, row-group
splitting, the read order, a seeded shuffle, and each V1 fallback.
- `test_delta_footer_listing.py` builds the indexer as `read_delta` does
and lists the table: the row groups a resumed job skips, and those a
filter prunes. Footer reads run in Ray actors, so these live in
`tests/datasource_v2/`, not `tests/unit/`.
- Tests that fail without this layer's fixes:
- `test_a_version_reads_its_files_in_one_order` reads a table, rewrites
its checkpoint with the rows in reverse order (as the protocol allows),
and reads the same version again, through the same Dataset and a new
`read_delta`. Without the path sort, the order changes; so does the
listing-order check in
`test_indexer_and_scanner_survive_worker_serialization`.
- `test_snapshot_repr_leaves_out_storage_options` fails when
`storage_options` is in the snapshot's `repr`.
- `test_partition_filters_fall_back_to_v1` fails without the fallback
(the read goes to V2).
- `test_skips_only_empty_files` fails with the old size check, which
also dropped files of unknown size.
- `test_falls_back_to_v1_with_pyarrow_scan_options` appends to the table
right after the check, with deltalake reporting 1.5 and 1.6. It checks
that V1 reads the checked version and, on 1.6, opens the table once.
Both cases fail with the old code, which reopened the latest version.
- `test_partition_values_come_from_the_log` reads tables whose paths
don't give their partition values: random file prefixes, timestamp
partitions with a time zone, and the string `__HIVE_DEFAULT_PARTITION__`
next to nulls. It reads them through V2 and matches V1, with and without
a filter on the partition column.
- `test_delta_read_does_not_unpickle_a_tampered_data_file`: a data file
swapped for one with a pickled-object column reads as plain bytes under
both readers, and its pickle never runs. The test also writes the
swapped file's size into the log, because V2 opens data files with the
log's sizes, as Delta readers do.
- `test_s3_reads_send_no_head_requests` reads a table on moto S3,
through deltalake's filesystem and through a caller's
`SubTreeFileSystem` over S3. Using moto's request recorder, it checks
that no data file gets a HEAD request.
- `tests/unit/datasource_v2/` and `tests/unit/datasource/`: 1521 passed,
225 skipped. `test_write_delta.py`: 105 passed.
- Each guard was removed one at a time, and a test failed each time:
path decoding, the log-based whole-file indexer, version pinning,
projection pinning, the protocol fallback, shuffle, the indexer's own
filesystem, schema pinning against tampered files, the path order and
the `repr`.
- pre-commit and pyrefly (CI file set, with deltalake 1.5 and pyarrow 23
resolved) pass.

AI assistance was used (Claude Code); every line has been reviewed by
the submitter.

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

---------

Signed-off-by: Abhishek Verma <[email protected]>
Co-authored-by: tobby168 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
abhishekverma-ray and others added 2 commits November 27, 2026 10:12
A generated ID names a row's place in its Parquet data file. Delta data
files never change, so the DataSourceV2 Delta reader, whose scanner is a
`ParquetScanner`, can produce them: a job resumed against the same table
version finds every ID again, and its listing skips the finished files
and row groups.

`read_delta` without `version=` reads the version that is latest when
the dataset is created, so a resumed job may read a newer one, and rows
a commit in between rewrote into new files (compaction, an overwrite)
get new IDs and are processed again. Binding the column warns once in
that case and asks for `version=`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abhishek Verma <[email protected]>
…rewritten

A generated ID names a row's data file. A job that reads the latest Delta
version and is resumed after a commit that rewrote files (OPTIMIZE, an
overwrite) found new files with new IDs and wrote their rows again, with only
a warning from the first run.

The Delta listing now checks the read units the checkpoint has as finished
against the version's data files. If any names a file the version doesn't
have, it raises InvalidCheckpointingConfig before reading, and says to pass
`version=` with the version the checkpointed run read. Appends between runs
remove no files, so their rows are read as new work, as before. The warning
for an unpinned read now names the version read (`DeltaScanner.version`), so
the user knows what to pass.

Why not stricter or looser:
- Requiring `version=` with generated_id_column would also block the common
  append-only case, where resuming the latest version is correct.
- Storing the version in the checkpoint and reusing it would need a new
  checkpoint metadata format; that can follow separately.

`_row_group_unit_file` maps a row group's read unit id back to its file.

Tests: `test_checkpoint.py`'s recovery and rerun-after-success tests are
parametrized over read_parquet and read_delta instead of copied. A Delta test
appends (rows read as new), compacts (the resume raises), then resumes at the
pinned version (nothing written again). The pinned-version scanner test is
replaced by one that checks the warning through read_delta.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abhishek Verma <[email protected]>
@goutamvenkat-anyscale
goutamvenkat-anyscale force-pushed the abhishek/delta-dsv2-6-checkpoint branch from aeae208 to 3ce9fa4 Compare November 27, 2026 18:12

This branch has not been deployed

No deployments
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