Skip to content

[Data] Fix the misleading deletion-vector error in read_delta - #66275

Merged
sampan-s-nayak merged 1 commit into
uc/parquet-readfrom
uc/dv-error
Oct 8, 2026
Merged

sampan-s-nayak merged 1 commit into
uc/parquet-readfrom
uc/dv-error

Conversation

@NightWing1998

@NightWing1998 NightWing1998 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

Unity Catalog credential vending is covered for AWS, but the Azure path was only
tested as far as resolve(): the Databricks SDK is mocked, the assertions check
that AZURE_STORAGE_SAS_TOKEN lands in os.environ, and no byte is ever read.
Once tests actually read data through a vended Azure SAS, two real bugs showed
up — and a third, unrelated to Azure, turned up on the way.

Verified against a real Azure Databricks workspace with a Unity Catalog managed
Delta table (12,000 rows, 4 log versions, 24 Parquet files) throughout.

What does this PR achieve

Deltalake python SDK does not support reading tables with deletion vectors. Current
error message requests to update the deltalake library version but no version so
released so far has this support. Correct the exception message raised to show that.

Links

PR is a part of stacked PRs. Chain: #66272 > #66273 > #66274 > #66275 > #66276

@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 error message raised when reading a Delta table that uses deletion vectors in ray.data.read_delta. Since pyarrow datasets cannot apply deletion-vector bitmaps, upgrading deltalake does not resolve the issue. The new error message provides actionable advice on how to disable the delta.enableDeletionVectors property and drop the feature from the table's protocol, while also including a test to verify the correctness and helpfulness of this message. I have no feedback to provide as there are no review comments.

@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Sep 18, 2026
@NightWing1998
NightWing1998 removed request for a team, edoakes and richardliaw September 28, 2026 06:12
raise RuntimeError(
f"Delta table uses Deletion Vectors, which requires deltalake>=0.10.0. "
f"Error: {error_msg}\n"
"This Delta table declares the `deletionVectors` reader "

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.

Does it need to be this verbose. Consider rephrasing to be user friendly without losing useful details.

Reading a Delta table that declares the `deletionVectors` reader feature
reported "requires deltalake>=0.10.0". No deltalake release lifts this: the
restriction belongs to `to_pyarrow_dataset`, which hands raw Parquet fragments
to pyarrow, and pyarrow cannot apply deletion-vector bitmaps. The engine-backed
QueryBuilder path reads the same table fine.

Two things the old message hid: the table is rejected for *declaring* the
feature, whether or not any deletion vectors were written; and Databricks
enables them by default on managed tables, so this is the common case for
reading Unity Catalog tables.

The new message names the cause, the reader path and the
`delta.enableDeletionVectors` property, and drops the version hint. It
deliberately does not prescribe the ALTER TABLE / REORG / DROP FEATURE
sequence -- that rewrites data files and changes what every other reader and
writer sees, which is not a decision to take from a stack trace. A test asserts
that absence.

Message only. Making such tables readable would need a read path that avoids
pyarrow datasets.

Testing:

    pytest python/ray/data/tests/datasource/test_delta.py
    16 passed

AI assistance was used for this change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Dhruvil Shah <[email protected]>
@sampan-s-nayak
sampan-s-nayak merged commit 1183ff3 into master Oct 8, 2026
7 checks passed
@sampan-s-nayak
sampan-s-nayak deleted the uc/dv-error branch October 8, 2026 15:15
sampan-s-nayak pushed a commit that referenced this pull request Oct 8, 2026
…6272)

## Why

Unity Catalog credential vending is covered for AWS, but the Azure path
was only
tested as far as resolve(): the Databricks SDK is mocked, the assertions
check
that AZURE_STORAGE_SAS_TOKEN lands in os.environ, and no byte is ever
read.
Once tests actually read data through a vended Azure SAS, two real bugs
showed
up — and a third, unrelated to Azure, turned up on the way.

Verified against a real Azure Databricks workspace with a Unity Catalog
managed
Delta table (12,000 rows, 4 log versions, 24 Parquet files) throughout.

## What does this PR achieve?

This PR is solely focused in improving the test coverage around azure
unity catalog.
Some tests added in the PR actually fail in CI but are fixed in later PR
part of the stack.

## Links

PR is a part of `stacked PRs`. Chain: #66272 > #66273 > #66274 > #66275
> #66276

---------

Signed-off-by: Dhruvil Shah <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
sampan-s-nayak pushed a commit that referenced this pull request Oct 8, 2026
…t them (#66273)

## Why

Unity Catalog credential vending is covered for AWS, but the Azure path
was only
tested as far as resolve(): the Databricks SDK is mocked, the assertions
check
that AZURE_STORAGE_SAS_TOKEN lands in os.environ, and no byte is ever
read.
Once tests actually read data through a vended Azure SAS, two real bugs
showed
up — and a third, unrelated to Azure, turned up on the way.

Verified against a real Azure Databricks workspace with a Unity Catalog
managed
Delta table (12,000 rows, 4 log versions, 24 Parquet files) throughout.

## What does this PR achieve

Fix the Azure credential vending to allow non-driver node task/actor
operators
to read delta tables from Unity Catalog.

## Links

PR is a part of stacked PRs. Chain: #66272 > #66273 > #66274 > #66275 >
#66276

Signed-off-by: Dhruvil Shah <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
sampan-s-nayak pushed a commit that referenced this pull request Oct 8, 2026
…row (#66274)

## Why

Unity Catalog credential vending is covered for AWS, but the Azure path
was only
tested as far as resolve(): the Databricks SDK is mocked, the assertions
check
that AZURE_STORAGE_SAS_TOKEN lands in os.environ, and no byte is ever
read.
Once tests actually read data through a vended Azure SAS, two real bugs
showed
up — and a third, unrelated to Azure, turned up on the way.

Verified against a real Azure Databricks workspace with a Unity Catalog
managed
Delta table (12,000 rows, 4 log versions, 24 Parquet files) throughout.

## What does this PR achieve?

PyArrow v20.0.0 or above is required to support UC Parquet file based
tables.
Bump the minimum pyarrow version required so that users with older
pyarrow
version don't see exception during pipeline execution.

## Links

PR is a part of stacked PRs. Chain: #66272 > #66273 > #66274 > #66275 >
#66276

Signed-off-by: Dhruvil Shah <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
sampan-s-nayak pushed a commit that referenced this pull request Oct 8, 2026
…#66276)

## Why
Unity Catalog credential vending is covered for AWS, but the Azure path
was only
tested as far as resolve(): the Databricks SDK is mocked, the assertions
check
that AZURE_STORAGE_SAS_TOKEN lands in os.environ, and no byte is ever
read.
Once tests actually read data through a vended Azure SAS, two real bugs
showed
up — and a third, unrelated to Azure, turned up on the way.

Verified against a real Azure Databricks workspace with a Unity Catalog
managed
Delta table (12,000 rows, 4 log versions, 24 Parquet files) throughout.

## What does this PR achieve

Add azurite to CI so that we can actively test UC code path against mock
azure.

## Links

PR is a part of stacked PRs. Chain: #66272 > #66273 > #66274 > #66275 >
#66276

---------

Signed-off-by: Dhruvil Shah <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
sai-miduthuri added a commit that referenced this pull request Nov 17, 2026
…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]>
sai-miduthuri added a commit that referenced this pull request Nov 17, 2026
…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]>
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.

3 participants