Repository navigation
[cherry-pick][2.60.1][Data] Raise an error for Delta tables with column mapping in write_delta (#67898) - #68231
Merged
sai-miduthuri merged 1 commit intoNov 18, 2026
Conversation
abhishekverma-ray
marked this pull request as ready for review
November 17, 2026 04:01
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces validation to prevent writing to Delta tables that use column mapping, which is currently unsupported by Dataset.write_delta. The DeltaDatasink has been updated to fetch full table metadata and check for column mapping at both the start and completion of a write. Additionally, the write_column_mapped_table helper was moved to a shared test utility file, and new unit tests were added to verify this rejection behavior. There are no review comments, so I have no feedback to provide.
sai-miduthuri
deleted the branch
ray-project:sai-miduthuri/cherry-pick-67895-2.60.1
November 17, 2026 23:49
abhishekverma-ray
changed the base branch from
sai-miduthuri/cherry-pick-67895-2.60.1
to
releases/2.60.1
November 18, 2026 00:02
…elta (ray-project#67898) `write_delta` now raises a clear `NotImplementedError` for an existing Delta table with column mapping, instead of committing data files that engines applying the mapping read as nulls. Write-side counterpart of test helper into a shared `ray/data/tests/delta_test_utils.py`. `write_delta` writes Parquet files with the table's column names and commits them with deltalake. A column-mapped table (`delta.columnMapping.mode` = `name` or `id`) stores its columns in data files under physical names such as `col-<uuid>`, or field ids, which only the Delta log maps to the column names. Engines that apply the mapping (Databricks, Spark) therefore read every column of the newly written files as null. The commit is permanent: the bad files stay in the table's log until someone rewrites them. What happens depends on the deltalake version, checked with a hand-built column-mapped table: | deltalake | reader 2 / writer 5, `mode=name` | reader 3 / writer 7, `mode=name` | |---|---|---| | 1.5.0 (Ray CI) | commit refused: `Unsupported table features required: [ColumnMapping]` (after the data files are written) | refused | | 1.6.6 | **commit succeeds**; the new file stores `id` instead of the physical name `col-a1` | **commit succeeds** | When the target table exists and `delta.columnMapping.mode` is anything but `none`, `write_delta` raises `NotImplementedError` naming the mode and pointing to ray-project#64854, for both `APPEND` and `OVERWRITE`: - `on_write_start` checks, so no data file is written and nothing is committed. It already reads the table's metadata there to check `partition_by`; that read now returns the whole `Metadata`. - The commit checks again, because `on_write_start` doesn't run for an empty dataset, and an empty `OVERWRITE` still commits. Tables with `mode = none` (or no property) and new tables write as before. ```mermaid flowchart TD subgraph Before subgraph BS[Subsystem: IO] subgraph BC["Component: DeltaDatasink (delta_datasink.py)"] B1["on_write_start: read partition columns"] --> B2["write: Parquet files with column names"] B2 --> B3["on_write_complete: commit"] end end end subgraph After subgraph AS[Subsystem: IO] subgraph AC["Component: DeltaDatasink (delta_datasink.py)"] A1["on_write_start: read metadata"] --> A0{"delta.columnMapping.mode<br/>!= none?"} A0 -->|yes| AE["NotImplementedError (ray-project#64854)"] A0 -->|no| A2["write: Parquet files"] A2 --> A3{"commit: column mapping?<br/>(also covers empty writes)"} A3 -->|yes| AE A3 -->|no| A4["commit (unchanged)"] end end end classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 classDef changed fill:#fff9c4,stroke:#f9a825,color:#000 class A0,A3,AE added class A1 changed ``` IO (`_internal/datasource/delta_datasink.py`). No open PR covers this. ray-project#67895 adds the same guard to `read_delta`; this PR covers writes and doesn't overlap with it. macOS / Python 3.12, env pinned to the CI lock (pyarrow 23.0.1, deltalake 1.5.0): - `pytest python/ray/data/tests/datasource/test_write_delta.py`: 105 passed on deltalake 1.5.0, and 105 passed with deltalake 1.6.6 on the path. deltalake can't write a column-mapped table (it stores the property but keeps the column names in the data files), so the shared helper `write_column_mapped_table` (moved from ray-project#67895's `test_delta.py` into `ray/data/tests/delta_test_utils.py`) writes the `_delta_log` of a reader 2 / writer 5 table by hand, with the data file storing the column under a physical name: - Appending to a `name` or `id` table raises `NotImplementedError` naming the mode and ray-project#64854, with no new data file and no new log version. - An empty `OVERWRITE` raises at commit time and leaves the log unchanged. - A table written with `mode = none` appends as before. - A missing configuration or an empty mode counts as `none`. - Without the check, the 3 rejection tests fail on deltalake 1.5.0 (deltalake refuses the commit only after the files are written) and on 1.6.6 (the commit succeeds); the `mode = none` test passes either way. - `test_delta.py`: 19 passed on 1.5.0 and 1.6.6, with the shared helper. - `test_write_delta_catalog_e2e.py` needs the local moto S3 server, which isn't available here. - pre-commit, pyrefly (CI file set) and the API param coverage check 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: Claude Opus 5.5 <[email protected]> (cherry picked from commit 1b7a10c) Signed-off-by: Abhishek Verma <[email protected]>
abhishekverma-ray
force-pushed
the
abhishekverma/cherry-pick-67898-2.60.1
branch
from
November 18, 2026 00:03
a766279 to
869d59c
Compare
sai-miduthuri
enabled auto-merge (squash)
November 18, 2026 00:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Cherry-pick of #67898 (master commit 1b7a10c) onto
releases/2.60.1.This was first stacked on #68213 (the #67895 pick), because #67898 moves the
_write_column_mapped_tabletest helper that #67895 added totest_delta.pyinto a sharedray/data/tests/delta_test_utils.py. #68213 and #68214 are merged now, so this PR is rebased ontoreleases/2.60.1. The rebase had no conflicts.write_deltawrites Parquet files with the table's column names. A column-mapped Delta table (delta.columnMapping.mode=nameorid) stores columns under physical names, so engines that apply the mapping (Databricks, Spark) read every column of those files as null. deltalake 1.6.6 commits such files; 1.5.0 refuses only after the data files are written.#67898 makes
write_deltaraiseNotImplementedErrorfor an existing table with column mapping, for bothAPPENDandOVERWRITE. It checks inon_write_start(nothing is written) and again at commit (on_write_startdoesn't run for an empty dataset, and an emptyOVERWRITEstill commits). Tables withmode = noneand new tables write as before.Related issues
Related to #67898 and #67895. Column mapping support is tracked in #64854.
Additional information
Cherry-pick details
git cherry-pick -xon top of #68213.delta_datasink.py,test_write_delta.pyand the newdelta_test_utils.pyapplied cleanly.test_delta.pyconflicted only on context: on master the removed helper sits next totest_delta_read_deletion_vectors_message_is_actionable, which isn't on this branch. I removed the helper and didn't add that test. The result matches the master commit: the same 4 files, +164/-68.Not a duplicate: no open or merged PR against
releases/2.60.1picks #67898.Testing
pytest datasource/test_write_delta.pypytest datasource/test_delta.pypytest test_catalog.py(databricks-sdk 0.143.0)pytest unit/datasource/-k column_map) with #68213'sdelta_datasink.pymode = nonecase passes, as it shouldThe four
pytestrows were rerun after the rebase ontoreleases/2.60.1(375b268). The revert check ran before the rebase, and the rebase didn't change this PR's diff. Each file ran in its own pytest process. Environment: Python 3.12.10 with the Ray 2.60.0 release wheel, this branch'spython/ray/dataandpython/ray/testslinked over it, and the CI lock pins: pyarrow 23.0.1, pandas 2.3.3, numpy 2.2.6, deltalake 1.5.0, pytest 7.4.4.AI assistance was used to prepare this cherry-pick; every line has been reviewed by the submitter.
🤖 Generated with Claude Code