Repository navigation
[Data] Make Azure UC Parquet reads work, and fail clearly on old pyarrow - #66274
Conversation
There was a problem hiding this comment.
Code Review
This pull request upgrades the minimum supported version of pyarrow from 17.0.0 to 20.0.0 across the codebase, updating dependencies, lockfiles, and CI build configurations. It also introduces support for reading Azure-backed Parquet tables through Unity Catalog, utilizing the sas_token parameter introduced in pyarrow 20.0.0. Feedback on the changes suggests normalizing the extracted Azure storage account name to lowercase to ensure robustness against casing variations.
| container, _, host = parsed.netloc.partition("@") | ||
| account = host.split(".")[0] |
There was a problem hiding this comment.
Azure storage account names are strictly lowercase (3-24 characters, numbers and lowercase letters only). To ensure robustness against any potential casing variations in the host or netloc, it is safer to normalize the extracted account name to lowercase.
| container, _, host = parsed.netloc.partition("@") | |
| account = host.split(".")[0] | |
| container, _, host = parsed.netloc.partition("@") | |
| account = host.split(".")[0].lower() |
79da41b to
2a9d019
Compare
2a9d019 to
5fa5b6e
Compare
5fa5b6e to
95aa535
Compare
95aa535 to
a89ff5a
Compare
a89ff5a to
fd4798d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 fd4798d. Configure here.
`read_parquet` is filesystem-only -- it ignores `storage_options` entirely -- so Azure `resolve()` returning no filesystem left a vended SAS no route to it. That failed badly rather than clearly: pyarrow reports a missing Azure credential by falling through to `DefaultAzureCredential`, which stalls on the instance-metadata endpoint or, over plain HTTP, aborts the process with SIGABRT. Build a `pyarrow.fs.AzureFileSystem` carrying the SAS. It needs pyarrow >= 20.0.0 (apache/arrow#45705); below that, resolution raises ImportError naming the requirement. Two details, each of which fails as a bare unauthenticated 404: - the `sas_token` keeps its leading `?`. pyarrow appends it to the service URL verbatim, so a bare token is taken as a path segment. deltalake's `storage_options` and AZURE_STORAGE_SAS_TOKEN both want it stripped, so the two channels genuinely disagree on format. - the `<container>@<account>.dfs.core.windows.net` authority comes off the path. pyarrow parses that Hadoop-style form only when it builds the filesystem from the URI itself; handed one, it treats the authority as part of the path. Delta keeps no pyarrow floor: its SAS goes to deltalake's object_store, which carries its own Azure client. Also adds the bazel target for the new test file. Testing: pytest python/ray/data/tests/datasource/test_catalog_azure.py # real Azure 4 passed, 2 skipped pytest python/ray/data/tests/datasource/test_catalog_azure.py \ python/ray/data/tests/test_catalog.py # Azurite 51 passed, 1 skipped Run on pyarrow 23.0.1; the version boundary is asserted by pinning the reported version, so the < 20 side is covered by those tests rather than by this install. AI assistance was used for this change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Dhruvil Shah <[email protected]>
fd4798d to
dbe08f4
Compare
…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]>
…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]>
## 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]>
…#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]>

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