Skip to content

[Data] Add Azure Unity Catalog Delta tests over a real data plane - #66272

Merged
sampan-s-nayak merged 3 commits into
masterfrom
uc/azure-tests
Oct 8, 2026
Merged

sampan-s-nayak merged 3 commits into
masterfrom
uc/azure-tests

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?

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

@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 introduces a new test suite test_catalog_azure.py to verify Azure-backed DatabricksUnityCatalog Delta reads using either a local Azurite emulator or a real Azure workspace, and updates the test requirements with databricks-sdk and azure-storage-blob. The review feedback highlights two important resource management improvements: wrapping the Azurite startup logic in a try...except block to prevent leaking temporary directories and processes on failure, and calling wait() after killing the process in stop() to avoid zombie processes.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Sep 18, 2026

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

Looks good.

@NightWing1998 NightWing1998 added the go add ONLY when ready to merge, run all tests label Sep 25, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9cc467. Configure here.

@NightWing1998
NightWing1998 requested a review from a team as a code owner September 29, 2026 17:56
@NightWing1998
NightWing1998 force-pushed the uc/azure-tests branch 2 times, most recently from 323620f to b1e1fdc Compare October 5, 2026 12:08
NightWing1998 and others added 3 commits October 8, 2026 12:31
Azure coverage for `DatabricksUnityCatalog` stopped at `resolve()`: the
Databricks SDK was mocked and no byte was ever read, so nothing verified that a
vended SAS actually gets a reader to the data.

`test_catalog_azure.py` reads for real, through two backends behind one fixture:
a local Azurite emulator by default -- only the Databricks control plane is
faked, with a genuine signature-checked SAS that Azurite validates -- and a real
Azure Databricks workspace when RAY_TEST_AZURE_DATABRICKS_HOST, _TOKEN and
_UC_DELTA_TABLE are set. The module docstring carries the table's DDL.

The table spans several commits and several Parquet files on purpose: a
one-file one-version table would pass with a single credential reaching a single
process. `test_table_shape_is_non_trivial` asserts the shape rather than
trusting it.

Also declares `databricks-sdk` and `azure-storage-blob` in
data-test-requirements.txt. `databricks-sdk` reached the data images only
transitively via mlflow-skinny, so every Unity Catalog test would have silently
skipped if mlflow dropped it. The deplocks are not regenerated here.

Two of the four tests fail: the vended credential does not reach the read tasks.

Testing:

    pytest python/ray/data/tests/datasource/test_catalog_azure.py
    2 passed, 2 failed

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 fc2157c into master Oct 8, 2026
6 checks passed
@sampan-s-nayak
sampan-s-nayak deleted the uc/azure-tests branch October 8, 2026 15:15
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
## 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

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 pushed a commit that referenced this pull request Nov 18, 2026
…dentials to the environment (#67899) (#68232)

## Description

Backport of #67899 (master commit
596241a) onto `releases/2.60.1`, **AWS
part only**. It's based directly on `releases/2.60.1` and is independent
of #68213 / #68214 and the #67898 pick; all of them merge with it
without conflicts.

On this branch, `DatabricksUnityCatalog.resolve()` writes vended AWS
credentials into the driver's `os.environ` and, if Ray isn't running
yet, starts Ray with them in `runtime_env`. AWS env vars take precedence
over the instance role, so after one Unity Catalog read the driver and
every worker use a short-lived credential scoped to that one table.
Writes to the job's own buckets (checkpoints, logs) then fail with
`ACCESS_DENIED`.

With this PR, AWS credentials travel only in the objects that use them,
which pickle into the read and write tasks:

- An explicit `S3FileSystem` for every reader and mode. Before, AWS
Parquet reads used the environment.
- For Delta, the AWS keys and region in `storage_options`, for
deltalake's log read and the `write_delta` commit. `read_delta`,
`write_delta` and the datasink's credential refresh already merge
`resolved.storage_options` on this branch.

GCS was already environment-free and is unchanged. A response with no
known credential type still raises `ValueError`.

Behavior changes worth a release note (the same as on master):

- AWS Parquet reads through Unity Catalog now need `region`, which the
`DatabricksUnityCatalog` docstring already lists as required for AWS.
- Code that relied on the vended AWS keys being in the environment
afterwards no longer gets them.

## Related issues

Related to #67899.

## Additional information

### How this differs from #67899

`releases/2.60.1` doesn't have the Azure Unity Catalog work #67899 edits
(#66272–#66276: Azure SAS in `storage_options`, `AzureFileSystem` for
Parquet, Azurite tests). So `git cherry-pick` conflicts in `catalog.py`
and `test_catalog.py` and tries to bring in that Azure code and the
Gravitino catalog. I ported the AWS change by hand instead:

- **Azure is unchanged.** It still gets the SAS through `_apply_env`
(the environment plus `runtime_env`), because nothing else delivers it
on this branch. Removing that would break Azure reads. `_creds_to_env`
is gone: Azure calls `_parse_azure_creds` directly, and the unknown-type
`ValueError` moved into `_resolve_storage`, as on master.
- **Not taken:** master's `delta_datasink.py` and `test_write_delta.py`
changes. They're comment-only and say Unity Catalog never touches the
environment, which is still false for Azure here.
`test_catalog_azure.py` doesn't exist on this branch.
- **Tests:** master's strict `isolated_env` fixture (environment must
come back unchanged, `ray.init` fails if called) covers every AWS and
GCS `resolve()` test. The two Azure tests keep the old lenient fixture,
renamed `azure_env`. Master deleted
`test_resolve_initializes_ray_with_runtime_env`; here it becomes
`test_resolve_azure_initializes_ray_with_runtime_env`, since Azure still
does that. As on master, `test_resolve_aws_requires_region` covers both
readers, and `test_resolve_rejects_unknown_credential_type` and the
`storage_options` asserts in the `write_delta` test are added.

Not a duplicate: no open or merged PR against `releases/2.60.1` picks
#67899.

### Testing

`test_catalog.py` skips the whole module without `databricks-sdk`, and
this branch's Data CI locks don't include it, so **CI doesn't run these
tests here**. I ran them locally:

| Command | Result |
|---|---|
| pre-commit (commit hooks) on the 2 changed files | Passed |
| `pytest test_catalog.py` (databricks-sdk 0.143.0) | 36 passed. On
`releases/2.60.1`: 34 |
| The same with `releases/2.60.1`'s `catalog.py` | 8 failed and 7
fixture errors: every AWS `resolve()` test, the Parquet region check,
and the `write_delta` `storage_options` asserts |
| `pytest datasource/test_write_delta.py` | 101 passed |
| `pytest datasource/test_delta.py` | 15 passed |
| `pytest unit/datasource/` | 83 passed |

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.

Not checked on a real Databricks workspace, as with #67899 on master.

AI assistance was used to prepare this backport; 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]>
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.

4 participants