Repository navigation
[Data] Raise an error for Delta tables with column mapping in read_delta - #67895
Conversation
`read_delta` reads through `DeltaTable.to_pyarrow_dataset()`, which gives PyArrow the table's column names but the raw Parquet files. A column-mapped table stores its columns there under physical names (such as `col-<uuid>`) that only the log maps to the column names, so PyArrow finds none of them and returns nulls, while `ds.schema()` still shows the right names. deltalake 1.6.4 to 1.6.6 don't reject reader 2 / writer 5 column-mapped tables (they declare no reader features), so the read succeeds with every mapped column null. `read_delta` (and `read_unity_catalog`, which calls it) now raises `NotImplementedError` when `delta.columnMapping.mode` is anything but `none`, whatever the protocol version or deltalake version, and points to ray-project#64854. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abhishek Verma <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a check in ray.data.read_delta to reject Delta tables using column mapping, raising a NotImplementedError to prevent reading incorrect or null data. It also adds corresponding unit tests and updates the documentation. The review feedback recommends a defensive fallback when retrieving the delta.columnMapping.mode configuration to avoid a potential AttributeError if the configuration dictionary or the mode value is None.
| assert "not yet supported by the deltalake reader" in message | ||
|
|
||
|
|
||
| def _write_column_mapped_table( |
There was a problem hiding this comment.
Two of these tests catch nothing the others don't:
test_read_unity_catalog_rejects_column_mapping:read_unity_catalogonly forwards toread_delta, andtest_catalog.py::test_read_unity_catalog_deprecation_delegatesalready checks that.- The
("name", 3, 7)case: on CI's deltalake 1.5.0 the reader 2 / writer 5 cases already fail without the check (DeltaProtocolErrorfromto_pyarrow_dataset), so they already show it runs first.
Without them, and with the none table written by write_deltalake(path, data, configuration={"delta.columnMapping.mode": "none"}), the helper only writes mapped reader 2 / writer 5 tables and can drop its version arguments and mapped branches.
There was a problem hiding this comment.
Agreed, removed both and simplified the helper as suggested: the none table now comes from write_deltalake(configuration=...), and the helper only writes mapped reader 2 / writer 5 tables. Thanks!
…ing tests - Treat a missing configuration or an empty delta.columnMapping.mode as "none" instead of failing on .lower(). - Drop the read_unity_catalog test (it only forwards to read_delta, which test_catalog.py already checks) and the reader 3 / writer 7 case (on deltalake 1.5.0 the reader 2 / writer 5 cases already fail without the check). Write the mode=none table with write_deltalake, so the hand-built helper only writes mapped reader 2 / writer 5 tables. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abhishek Verma <[email protected]>
…elta (#67898) ## Summary `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 #67895; column mapping support is tracked in #64854. It moves #67895's test helper into a shared `ray/data/tests/delta_test_utils.py`. ## Before `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** | ## After When the target table exists and `delta.columnMapping.mode` is anything but `none`, `write_delta` raises `NotImplementedError` naming the mode and pointing to #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 (#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 ``` ## Subsystems IO (`_internal/datasource/delta_datasink.py`). ## Not a duplicate No open PR covers this. #67895 adds the same guard to `read_delta`; this PR covers writes and doesn't overlap with it. ## Testing 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 #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 #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]>
…mn mapping in read_delta (#67895) (#68213) ## Description Cherry-pick of #67895 (master commit 3094de2) onto `releases/2.60.1`. **Bottom of a 2-PR stack on `releases/2.60.1`:** this PR, then #68214 (the #67900 pick). Merging #68214 with `gh stack merge` lands both in order. `read_delta` reads through `DeltaTable.to_pyarrow_dataset()`, which doesn't apply a Delta table's column mapping. A table with `delta.columnMapping.mode` set to `name` or `id` stores its columns in the data files under physical names such as `col-<uuid>`. With deltalake 1.6.4 to 1.6.6, a reader 2 / writer 5 table passes deltalake's own protocol check, and every mapped column comes back as nulls. `ds.schema()` still shows the right names, so nothing downstream notices. #67895 makes `read_delta`, and `read_unity_catalog` through it, raise `NotImplementedError` for these tables before reading. The message names the mode and points to #64854. Tables without column mapping, including an explicit `mode = none`, read as before. ## Related issues Related to #67895. Reading column-mapped tables is tracked in #64854. ## Additional information ### Cherry-pick details `read_api.py` applied cleanly with `git cherry-pick -x`. `test_delta.py` conflicted only on context. On master, the new tests follow `test_delta_read_deletion_vectors_message_is_actionable`, which #66275 added and which isn't on this branch. I kept only what #67895 adds: `import json`, `_write_column_mapped_table`, `test_delta_read_rejects_column_mapping` and `test_delta_read_column_mapping_mode_none`. The added lines are identical to the master commit's, in the same 2 files, +109/-0. Not a duplicate: neither `releases/2.60.1` nor any open or merged PR against it contains #67895. No open PR on any branch picks it. ### Testing The four suites are `datasource/test_delta.py`, `test_catalog.py`, `datasource/test_write_delta.py` and `unit/datasource/`, under `python/ray/data/tests/`. The last three are the other suites #67895 was tested with on master. `test_catalog.py` skips the whole module without `databricks-sdk`, and this branch's Data CI locks don't include it, so CI skips the file here. I ran it with `databricks-sdk` 0.143.0, in its own pytest process as Bazel would. Sharing a process with the other suites makes 10 of its tests, the ones that start their own Ray cluster, error with "Maybe you called ray.init twice". That happens on `releases/2.60.1` too. | Command | Result | |---|---| | `pre-commit run` on the 2 changed files | Passed | | `pytest datasource/test_delta.py datasource/test_write_delta.py unit/datasource/`, deltalake 1.5.0 | 202 passed. On `releases/2.60.1` without this PR: 199 passed | | `pytest test_catalog.py`, deltalake 1.5.0, databricks-sdk 0.143.0 | 34 passed, the same as on `releases/2.60.1` without this PR | | `pytest datasource/test_delta.py`, deltalake 1.5.0 and 1.6.6 | 18 passed on each. Without this PR: 15 passed | | The 3 new tests (`-k column_mapping`) with `releases/2.60.1`'s `read_api.py`, deltalake 1.5.0 and 1.6.6 | On each, `test_delta_read_rejects_column_mapping[name]` and `[id]` fail and `test_delta_read_column_mapping_mode_none` passes | The environment was Python 3.12.12 with the Ray 2.60.0 release wheel, which was built from `releases/2.60.0` at b7f4259. This branch's `python/ray/data` and `python/ray/tests` were copied over it. The other packages were pinned to the CI lock: pyarrow 23.0.1, pandas 2.3.3, numpy 2.2.6, fsspec 2023.12.1, and deltalake 1.5.0, or 1.6.6 where noted. `databricks-sdk` 0.143.0 was added for `test_catalog.py`. Building Ray from source for `bazel test` wasn't practical on my machine. An earlier version of this description counted `test_catalog.py` among the suites run. My run had skipped it because `databricks-sdk` wasn't installed. AI assistance was used to prepare this cherry-pick. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Abhishek Verma <[email protected]> Signed-off-by: Sai Miduthuri <[email protected]> Co-authored-by: abhishekverma-ray <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…ake file sizes from the log (#67900) (#68214) ## Description Cherry-pick of #67900 (master commit 63ff72c) onto `releases/2.60.1`. **Top of a 2-PR stack on `releases/2.60.1`:** #68213 (the #67895 pick), then this PR. Merging this PR with `gh stack merge` lands both in order. #67900 makes two changes to `read_delta`: - **`partition_filters`.** This new keyword-only parameter takes deltalake's `(column, op, value)` tuples. A flat list is an AND, and a list of lists is an OR of ANDs. Only the matching partitions' files become fragments, so only they are listed and read. Every column must be a partition column. An OR of groups needs deltalake 1.6.6 and raises a clear error on older versions. `read_unity_catalog` passes it through `reader_kwargs`. The default, `None`, keeps the current behavior. - **File sizes from the Delta log.** `ParquetDatasource.from_pyarrow_dataset` takes them as `known_file_sizes` and calls `get_file_info` only for paths missing from it. Before, it made one `get_file_info` request per file. On the 26,085-file table in #67900, that was 26,085 requests before a read started. `read_delta` is the only caller of `from_pyarrow_dataset` on this branch. ## Related issues Related to #67900. ## Additional information ### Cherry-pick details The #67900 commit applied cleanly with `git cherry-pick -x` on top of the #67895 pick. It has the same 3 files, +303/-3, and the same `git patch-id --stable` as the master commit. It needs #68213 because its `read_api.py` hunk sits right after the column-mapping check that #67895 adds. A second commit adds `from unittest import mock` to `test_delta.py`. `test_read_unity_catalog_partition_filters`, which #67900 adds, uses `mock.patch.object`. On master the import comes from #66275, which isn't on this branch, so ruff reports `F405` and the test would fail with a `NameError`. The import sits where master has it. Not a duplicate: neither `releases/2.60.1` nor any open or merged PR against it contains #67900. No open PR on any branch picks it. ### Testing The four suites are `datasource/test_delta.py`, `test_catalog.py`, `datasource/test_write_delta.py` and `unit/datasource/`, under `python/ray/data/tests/`. They're the suites #67900 was tested with on master. `test_catalog.py` skips the whole module without `databricks-sdk`, and this branch's Data CI locks don't include it, so CI skips the file here. I ran it with `databricks-sdk` 0.143.0, in its own pytest process as Bazel would. Sharing a process with the other suites makes 10 of its tests, the ones that start their own Ray cluster, error with "Maybe you called ray.init twice". That happens on `releases/2.60.1` too. The new `read_unity_catalog` test is in `test_delta.py`, so it runs either way. | Command | Result | |---|---| | `pre-commit run` on the 3 changed files | Passed with the `mock` import. Without it, ruff fails with `F405` on `mock` | | `pytest datasource/test_delta.py datasource/test_write_delta.py unit/datasource/`, deltalake 1.5.0 | 214 passed. #68213 alone: 202 passed | | `pytest test_catalog.py`, deltalake 1.5.0, databricks-sdk 0.143.0 | 34 passed, the same as with #68213 alone and on `releases/2.60.1` | | `pytest datasource/test_delta.py`, deltalake 1.5.0 and 1.6.6 | 30 passed on each. #68213 alone: 18 passed. Master has 31 because it also has #66275's test | `test_delta_read_partition_filters_or_groups` covers both deltalake paths. It reads an OR of groups through `file_pruning_predicate` on 1.6.6, and checks the "needs deltalake 1.6.6 or later" error on 1.5.0. The environment was Python 3.12.12 with the Ray 2.60.0 release wheel, which was built from `releases/2.60.0` at b7f4259. This branch's `python/ray/data` and `python/ray/tests` were copied over it. The other packages were pinned to the CI lock: pyarrow 23.0.1, pandas 2.3.3, numpy 2.2.6, fsspec 2023.12.1, and deltalake 1.5.0, or 1.6.6 where noted. `databricks-sdk` 0.143.0 was added for `test_catalog.py`. Building Ray from source for `bazel test` wasn't practical on my machine. An earlier version of this description counted `test_catalog.py` among the suites run. My run had skipped it because `databricks-sdk` wasn't installed. AI assistance was used to prepare this cherry-pick. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Abhishek Verma <[email protected]> Signed-off-by: Sai Miduthuri <[email protected]> Co-authored-by: abhishekverma-ray <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…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]>
…mn mapping in write_delta (#67898) (#68231) ## 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_table` test helper that #67895 added to `test_delta.py` into a shared `ray/data/tests/delta_test_utils.py`. #68213 and #68214 are merged now, so this PR is rebased onto `releases/2.60.1`. The rebase had no conflicts. `write_delta` writes Parquet files with the table's column names. A column-mapped Delta table (`delta.columnMapping.mode` = `name` or `id`) 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_delta` raise `NotImplementedError` for an existing table with column mapping, for both `APPEND` and `OVERWRITE`. It checks in `on_write_start` (nothing is written) and again at commit (`on_write_start` doesn't run for an empty dataset, and an empty `OVERWRITE` still commits). Tables with `mode = none` and 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 -x` on top of #68213. `delta_datasink.py`, `test_write_delta.py` and the new `delta_test_utils.py` applied cleanly. `test_delta.py` conflicted only on context: on master the removed helper sits next to `test_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.1` picks #67898. ### Testing | Command | Result | |---|---| | pre-commit (commit hooks) on the 4 changed files | Passed | | `pytest datasource/test_write_delta.py` | 105 passed. On #68213 without this PR: 101 | | `pytest datasource/test_delta.py` | 30 passed (18 from before #68214, plus #68214's new tests) | | `pytest test_catalog.py` (databricks-sdk 0.143.0) | 34 passed | | `pytest unit/datasource/` | 83 passed | | The 4 new tests (`-k column_map`) with #68213's `delta_datasink.py` | 3 fail; the `mode = none` case passes, as it should | The four `pytest` rows were rerun after the rebase onto `releases/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's `python/ray/data` and `python/ray/tests` linked 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](https://claude.com/claude-code) Signed-off-by: Abhishek Verma <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
read_delta(andread_unity_catalog, which calls it) now raises a clearNotImplementedErrorfor Delta tables with column mapping instead of returning nulls for their columns. This is a stopgap for a patch release; reading these tables is tracked in #64854.Before
read_deltareads throughDeltaTable.to_pyarrow_dataset(), which gives PyArrow the table's column names but the raw Parquet files. A column-mapped table (delta.columnMapping.mode=nameorid) stores its columns there under physical names such ascol-<uuid>, which only the Delta log maps to the column names. PyArrow finds none of them and fills them with nulls, whileds.schema()still shows the right names, so nothing downstream notices.What happens depends on the deltalake version and the table's protocol:
DeltaProtocolErrorabout reader versionscolumnMappingfeatureDeltaProtocolErrorDeltaProtocolErrorA user hit the silent case on a reader 2 / writer 5 table: two columns with 326,733 and 80,543 non-null values in one file came back with none.
After
Before calling
to_pyarrow_dataset(),read_deltaraisesNotImplementedErrorwhendelta.columnMapping.modeis anything butnone. It checks the table property, not the protocol, because reader 2 / writer 5 tables declare no reader features. The message names the mode, explains that the data files use physical column names, and points to #64854. Tables without column mapping, including an explicitmode = none, read as before.flowchart TD subgraph Before subgraph BS[Subsystem: API] subgraph BC["Component: read_delta (read_api.py)"] B1["DeltaTable(path, version)"] --> B2["to_pyarrow_dataset()"] B2 --> B3["ParquetDatasource: mapped columns read as nulls"] end end end subgraph After subgraph AS[Subsystem: API] subgraph AC["Component: read_delta (read_api.py)"] A1["DeltaTable(path, version)"] --> A0{"delta.columnMapping.mode<br/>!= none?"} A0 -->|yes| AE["NotImplementedError (#64854)"] A0 -->|no| A2["to_pyarrow_dataset()"] A2 --> A3["ParquetDatasource (unchanged)"] end end end classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 class A0,AE addedSubsystems
API (
read_api.read_delta).Not a duplicate
No open PR covers this. #64929 tried to read column-mapped tables and was closed without merging; this PR only stops the wrong results until that support exists (#64854).
Testing
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_delta.py: 19 passed. deltalake can't write a column-mapped table (it stores the property but keeps the logical column names), so the new tests write the_delta_logof a reader 2 / writer 5 table by hand, with the data file storing the column under a physical name:nameandidraiseNotImplementedErrornaming the mode and [Data] ray.data.read_delta silently drops columns on Delta tables with column mapping enabled #64854.mode = nonestill reads.none.mode = nametable: on deltalake 1.6.6,to_pyarrow_dataset()returns[None, None]andread_deltanow raises; on 1.6.3, deltalake raisedDeltaProtocolErrorandread_deltanow raises its clearer error first.test_catalog.py: 46 passed;test_write_delta.py: 101 passed.AI assistance was used (Claude Code); every line has been reviewed by the submitter.
🤖 Generated with Claude Code