Repository navigation
Revert "[Data] [1/4] Add generated_id_column to CheckpointConfig with V2 Parquet row-group IDs" - #66183
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the auto-generated row IDs feature (generated_id_column) from Ray Data checkpointing, deleting its implementation in the Parquet datasource, file readers, planners, and configuration interfaces, along with all associated unit tests. The feedback suggests making id_column a mandatory positional argument in CheckpointConfig and updating its type annotations to str instead of Optional[str], as it is now strictly required.
| @@ -132,7 +128,6 @@ def __init__( | |||
| id_column: Optional[str] = None, | |||
There was a problem hiding this comment.
Since generated_id_column has been removed, id_column is now strictly required for checkpointing. The default value of None and the Optional type annotation should be removed to make it a mandatory positional argument, which improves API clarity and type safety.
| id_column: Optional[str] = None, | |
| id_column: str, |
| # Use generated_id_column as the id_column | ||
| id_column = generated_id_column | ||
|
|
||
| self.id_column: Optional[str] = id_column |
…th V2 Parquet row-group IDs" This reverts commit 0ab7db2. Reverting to land the DSv2 reorganization first; the checkpointing series re-lands on top of it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Aarrya <[email protected]>
2ef598d to
70b93a5
Compare
…th V2 Parquet row-group IDs" (ray-project#66183) Reverts ray-project#65885 Reverting this PR to clean up DSv2 first. Signed-off-by: Aarrya <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
…as a DSv2 synthesized column (#66732) ## Why are these changes needed? Job-level checkpointing (`CheckpointConfig(id_column=...)`) needs a unique ID column in the input. Many batch-inference datasets don't have one. Ray Data generates a stable ID for every row from where it lives in its Parquet file, and a resumed job skips committed work at the source. This is a redo of #65885, which was reverted (#66183) so the DSv2 reorg could land first. The reorg added the seams this needs (`SynthesizedColumn`, `ReadUnit`, the `excluded_read_unit_ids` listing hook), so this version adds **no reader code** for the ID itself. This PR (1/4) adds the config and the ID column. Restore comes in 3/4. ## What changes - **`CheckpointConfig(generated_id_column=...)`**, exactly one of `id_column` / `generated_id_column`. The generated name is also exposed as `id_column`, so the existing checkpoint write (two-phase commit) works unchanged. - **`GeneratedIdColumn`** (`checkpoint/generated_id.py`), a `SynthesizedColumn` with `requires_read_unit_boundaries = True`. It builds a struct ID per row from the batch's `ReadUnitPosition`: `path_prefix`, `file_name`, `fragment` (row group), `num_fragments`, `num_rows`, `row_id` (position in the row group). - **Whole-file guard:** if a batch comes from a whole-file read unit (no row-group info), the column raises instead of writing IDs that can't name a row group. Parquet always lists by footer today, so this isn't reachable in normal reads. - **Explicit plumbing, no public API change:** `read_parquet` builds the column from the checkpoint config and passes it to `ParquetDatasourceV2(extra_synthesized_columns=...)`. Ray Data's own checkpoint reads opt out with an internal `_add_generated_id_column=False`, popped from `**arrow_parquet_args` like the existing `_block_udf`. Checkpoint files are Parquet too and must never get the column. - **Name clash:** `ParquetDatasourceV2.infer_schema` raises if a file already has a column with the requested name, instead of silently replacing user data the way `path` / `row_hash` do. - **Safe on its own:** until 3/4 wires up restore, the planner plans only the checkpoint write for generated-ID configs (plus cleanup of a crashed run's pending checkpoints). A rerun redoes every row instead of sending struct IDs into the numpy-based `id_column` filter. ## Related issue number N/A. Not a duplicate: I searched open PRs for `generated_id_column`, "row group checkpoint", `excluded_rows` and `requires_read_unit_boundaries`. The only matches are my earlier pre-reorg drafts #65886–#65888, which this stack replaces and which I'm closing. **Stack:** 1/4 (this, #66732) → 2/4 (#66733) → 3/4 (#66736) is the feature chain. 4/4 (#66734) is an independent speed-up that lands last. ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit (`ruff`, `black`, `pydoclint`, Ray import/doc style) on all changed files: clean. The API-annotation check (`ci/lint/check_api_annotations.py`, scoped to `ray.data`) 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 (macOS, nightly wheel + this branch's `ray/data`): - `pytest python/ray/data/tests/unit/datasource_v2/test_generated_id_column.py`: 10 passed. Covers ID fields per row group, uniqueness across files and row groups, `row_id` continuing across batches, determinism under a pushed-down filter, whole-file guard, projection, schema advertisement, name clash, and no-op without config. - `pytest python/ray/data/tests/test_checkpoint.py` (run from `python/ray/data/tests/`): 88 passed, 1 failed. The failure, `test_skip_checkpoint_flag[s3]`, is a pre-existing local moto-S3 timing flake that also fails on unmodified master. New tests: config validation, `read_parquet` adds the column and the checkpoint read opts out, rerun redoes rows with no filter op planned, pending-checkpoint cleanup before rerun (verified it fails without the fix). - `pytest python/ray/data/tests/unit/datasource_v2 python/ray/data/tests/datasource_v2`: 214 passed. 🤖 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]>
Reverts #65885
Reverting this PR to clean up DSv2 first.