Skip to content

[Data][1/4] Iceberg Checkpoint: only read committed parquet on checkpoint restore - #66387

Merged
richardliaw merged 1 commit into
ray-project:masterfrom
smortime:smortimer/pass-restore-commited-files-only
Sep 30, 2026
Merged

richardliaw merged 1 commit into
ray-project:masterfrom
smortime:smortimer/pass-restore-commited-files-only

Conversation

@smortime

@smortime smortime commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

During checkpoint restoration, instead of passing the entire checkpoint directory, which may contain pending files, pass only the committed .parquet.

Related issues

Related to #59870

Additional information

This isn't directly part of supporting iceberg checkpointing, but was teased out of the implementation / added first, so it can be merged without concern of iceberg-related items.

Stack:

@smortime smortime changed the title [Data][1/6 Iceberg Checkpoint] Pass just the committed parquet to read_parquet on checkpoint restore [Data][1/6] Pass just the committed parquet to read_parquet on checkpoint restore Sep 23, 2026
@smortime smortime changed the title [Data][1/6] Pass just the committed parquet to read_parquet on checkpoint restore [Data][1/6] Pass only committed parquet to read_parquet on checkpoint restore Sep 23, 2026
@smortime smortime changed the title [Data][1/6] Pass only committed parquet to read_parquet on checkpoint restore [Data][1/6] Iceberg Checkpoint: Pass only committed parquet to read_parquet on checkpoint restore Sep 23, 2026
@smortime smortime changed the title [Data][1/6] Iceberg Checkpoint: Pass only committed parquet to read_parquet on checkpoint restore [Data][1/6] Iceberg Checkpoint: only read committed parquet on checkpoint restore Sep 23, 2026
@smortime
smortime force-pushed the smortimer/pass-restore-commited-files-only branch from ef4fdd0 to 0146017 Compare September 26, 2026 04:15
@smortime
smortime marked this pull request as ready for review September 26, 2026 04:41
@smortime
smortime requested a review from a team as a code owner September 26, 2026 04:41

@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 updates the checkpoint loading mechanism to only read committed parquet files, explicitly excluding pending checkpoints and non-parquet files during restoration. Additionally, it introduces a delete_on_execution_success option to LoadCheckpointCallback to allow deferring checkpoint cleanup upon successful execution. Unit tests have been added to verify these behaviors. There are no review comments, so I have no feedback to provide.

@smortime smortime changed the title [Data][1/6] Iceberg Checkpoint: only read committed parquet on checkpoint restore [Data][1/4] Iceberg Checkpoint: only read committed parquet on checkpoint restore Sep 26, 2026
@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Sep 26, 2026
self,
config: CheckpointConfig,
*,
delete_on_execution_success: bool = True,

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.

What is the need for this flag? The intuition behind it?

Nothing in this PR or the rest of the stack sets delete_on_execution_success. #66505 skips adding the callback for Iceberg instead of passing it.

Could we drop it for now, along with test_checkpoint_callback_can_defer_success_cleanup, and add it when something needs it?

],
ids=["local", "s3"],
)
def test_load_checkpoint_excludes_pending_files(

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.

Nice test! Could we add one more version where the checkpoint files sit in hive like sub-folders (like date=2024-01-01/) and a partition filter is set? Put both committed and pending files in there.

That checks two things this PR changes:

  • sub-folders get searched
  • the partition filter still works now that we pass read_parquet a list of files instead of a folder

@abhishekverma-ray abhishekverma-ray 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.

LGTM. Left two non-blocking suggestions, please take a look.

@richardliaw richardliaw added the go add ONLY when ready to merge, run all tests label Sep 30, 2026
@richardliaw
richardliaw enabled auto-merge (squash) September 30, 2026 21:48
@richardliaw
richardliaw merged commit 5528c74 into ray-project:master Sep 30, 2026
8 checks passed
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…oint restore (ray-project#66387)

## Description

During checkpoint restoration, instead of passing the entire checkpoint
directory, which may contain pending files, pass only the committed
`.parquet`.

## Related issues

Related to ray-project#59870

## Additional information

This isn't directly part of supporting iceberg checkpointing, but was
teased out of the implementation / added first, so it can be merged
without concern of iceberg-related items.

Stack:
- ray-project#66387 (you are here)
- ray-project#66503
- ray-project#66504
- ray-project#66505

Signed-off-by: Schuyler Mortimer <[email protected]>
goutamvenkat-anyscale pushed a commit that referenced this pull request Oct 14, 2026
…and partial row masks (#66733)

Follow-up to 1/4 (#66732, merged). 3/4 (#66736) builds on this.

## Why are these changes needed?

A resumed generated-ID job has to know what's already done, in terms the
DSv2 read path understands: **read units** (files and Parquet row
groups). This PR turns the committed generated IDs into exactly that, so
the planner in 3/4 (#66736) can skip it: listing drops the done units,
and a step after the read drops the done rows of partly done row groups.

## What changes

-
**`GeneratedIdColumnCheckpointManager.load_generated_id_checkpoint()`**
returns a `GeneratedIdCheckpoint`, kept in Arrow so it stays small on
the driver and cheap to send to tasks:
- `done_unit_ids`: an Arrow string array. A file's path when every row
group of the file is committed, otherwise `"<path>#rg<N>"` per committed
row group. Ids come from DSv2's `_row_group_unit_id`, so they match what
the listing hook `excluded_read_unit_ids` (#66398) expects.
- `partial_masks`: an Arrow table, one row per row group with only some
rows committed: `unit_id` and a boolean `partial_mask` indexed by
`row_id`. These are small: only row groups in flight when a job stopped
are partly done.
- **Compaction:** committed IDs are grouped per file with Ray Data
(`groupby(path_prefix, file_name).map_groups`) into one row per done or
partly done read unit: `unit_id` plus `partial_mask` (null when done). A
file whose row groups are all done is a single row with its path. Masks
stay numpy end to end. Duplicate IDs, from rows written more than once,
are counted once, so a partly done row group never looks done.
- **Refactor:** `CheckpointManager.load_checkpoint` is split so the
shared steps live in `_load_checkpoint_block`: clean pending
checkpoints, list committed files only (#66387), read, preprocess, one
block. The `id_column` path's behavior is unchanged. The generated-ID
manager's `load_checkpoint` (the numpy array path) raises, because
struct IDs can't go there.
- The checkpoint read opts out of the generated ID column (from 1/4).
- **CI:** `checkpoint/generated_id.py` joins
`ci/lint/pyrefly-excluded-files.txt`. Its `pyarrow.compute` calls
(`pc.struct_field` and friends) are generated at runtime, so pyrefly
reports them as missing; other pyarrow-heavy checkpoint files
(`checkpoint_filter.py`, `interfaces.py`) are excluded for the same
reason.


Nothing calls the new load yet; 3/4 does.

## Related issue number

N/A. Not a duplicate (see 1/4).

## Checks

- [x] I've signed off every commit (DCO).
- [x] I've run pre-commit on all changed files: clean. The
API-annotation check reports nothing unannotated.
- [x] AI assistance (Claude Code) was used for the development of this
PR. I, Abhishek Verma, am the human submitter signing off on it: I have
reviewed every changed line, run the tests below locally, and can defend
the change end-to-end.
- Testing:
- `pytest python/ray/data/tests/unit/test_generated_id_checkpoint.py`: 9
passed. Covers done vs. partial row groups, duplicates counted once,
whole file named when all row groups are done, and compacted paths
matching the source path exactly (bare file name, absolute path, and a
backslash Windows-style path) and IDs outside a row group never marking
it done.
- `pytest python/ray/data/tests/test_checkpoint.py` (on current master):
92 passed, 1 failed (the same pre-existing local moto-S3 flake as 1/4).
New: loading real checkpoint files with pending files ignored and the
generated-ID config active during the load; empty checkpoint.
- pyrefly (CI's file set and flags) on the changed files: 0 errors. API
parameter coverage check: nothing newly undocumented.

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

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

Labels

community-contribution Contributed by the community 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.

3 participants