You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Unity Catalog Creds and Iceberg REST endpoint construction (delta-io#5904)
## Summary
This PR fixes Unity Catalog credential detection and refactors Iceberg
REST catalog endpoint construction to properly implement the Iceberg
REST catalog specification.
**Key Changes:**
- Fix credential detection to recognize Unity Catalog's `option.fs.*`
credential properties
- Refactor `/v1/config` endpoint handling to follow Iceberg REST catalog
spec
- Move prefix discovery logic from `UnityCatalogMetadata` to
`IcebergRESTCatalogPlanningClient`
- Improve robustness with trailing slash handling and HTTP client reuse
- More test coverage with explicit path verification
- Fix module separation issues and improve code organization
## Testing
Tests now explicitly verify:
- Correct `/v1/config` endpoint calls with `warehouse` query parameter
- Proper prefix application in `/plan` request paths
- Behavior when no prefix is returned (uses baseUri directly per Iceberg
REST spec)
- Token handling consistency between tests and production
- Trailing slash handling robustness
---
## Compatibility
This is an internal refactoring with no changes to public APIs or
user-facing behavior. The changes:
- Improve correctness of credential detection for Unity Catalog
- Fix internal endpoint construction to follow Iceberg REST spec
- Maintain backward compatibility with existing Unity Catalog
configurations
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: iceberg/src/main/scala/org/apache/spark/sql/delta/serverSidePlanning/IcebergRESTCatalogPlanningClient.scala
Copy file name to clipboardExpand all lines: iceberg/src/main/scala/org/apache/spark/sql/delta/serverSidePlanning/IcebergRESTCatalogPlanningClientFactory.scala
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,10 @@ class IcebergRESTCatalogPlanningClientFactory extends ServerSidePlanningClientFa
Copy file name to clipboardExpand all lines: iceberg/src/test/java/shadedForDelta/org/apache/iceberg/rest/IcebergRESTCatalogAdapterWithPlanSupport.java
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,10 @@ class IcebergRESTCatalogAdapterWithPlanSupport extends RESTCatalogAdapter {
66
66
// Static field for test credential injection - credentials to inject into /plan responses
67
67
// Volatile is used to guarantee correct cross-thread access (test thread and Jetty server thread).
Copy file name to clipboardExpand all lines: iceberg/src/test/scala/org/apache/spark/sql/delta/serverSidePlanning/IcebergRESTCatalogPlanningClientSuite.scala
+59-39Lines changed: 59 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ class IcebergRESTCatalogPlanningClientSuite extends QueryTest with SharedSparkSe
83
83
// Tests that the REST /plan endpoint returns 0 files for an empty table.
84
84
test("basic plan table scan via IcebergRESTCatalogPlanningClient") {
0 commit comments