Repository navigation
Conversation
5 tasks
Adds the core write surface to the Iceberg REST catalog service so Iceberg clients (PyIceberg, Spark RESTCatalog, DuckDB iceberg extension) can create and commit to tables, addressing the write-endpoint portion of unitycatalog#3: - POST /v1/{prefix}/namespaces (createNamespace, delegating to SchemaService) - POST /v1/{prefix}/namespaces/{ns}/tables (createTable: builds the initial TableMetadata, writes the 00000- metadata.json server-side, and registers the table in UC as an EXTERNAL table with the new ICEBERG data source format; staged creates are rejected with a clear error for now) - POST /v1/{prefix}/namespaces/{ns}/tables/{table} (updateTable/commit: validates UpdateRequirements against the current metadata, applies MetadataUpdates, writes the next metadata.json, and linearizes the commit with a compare-and-swap on the stored metadata location under a pessimistic row lock; losers get a 409 CommitFailedException) - DELETE /v1/{prefix}/namespaces/{ns}/tables/{table} (dropTable) The new endpoints are advertised in GET /v1/config so spec-aware clients discover write support. UniForm-enabled Delta tables remain readable but explicitly read-only through this API, since their Iceberg metadata is derived from the Delta log. Storage credential vending is now privilege-aware: FileIOFactory and TableConfigService take the requested privileges per call instead of the previous hardcoded read-only set, and loadTable/createTable/commit responses vend write-capable credentials for native Iceberg tables (all Iceberg REST routes currently authorize as metastore owner). SimpleLocalFileIO gains write/delete support for file:// locations, used by tests. Iceberg schemas are converted to UC columns (Spark StructField type_json shape) so REST-created tables are browsable through the UC API and UI.
Iceberg clients like DuckDB do not send a location in createTable and rely on the catalog to assign one. When the request has no location, assign <managed-root>/tables/<uuid> (schema's managed location, else the catalog's, else the storage-root.tables server property - the same resolution used for managed Delta staging locations) and register the table as MANAGED with the ICEBERG format, skipping the Delta staging contract. Explicit locations keep creating EXTERNAL tables as before.
Armeria stalls body-less 204 responses on HTTP/1.1 connections (the JUnit suite doesn't see this because Armeria's client speaks h2). Iceberg REST clients accept 200 here - DuckDB explicitly allows both, PyIceberg accepts any 2xx, and apache/iceberg-rest-fixture also returns 200.
Staged creation (createTable with stage-create=true) is stateless, mirroring Iceberg's reference CatalogHandlers: the initial TableMetadata is built and returned without a metadata-location and nothing is registered. The table materializes when the client commits with an assert-create requirement: the metadata is rebuilt from the commit's updates against an empty base (picking the format version out of upgrade-format-version first, like CatalogHandlers.create), the first metadata file is written, and the table is registered - so registration and the first snapshot land atomically. A concurrent create loses the race with a 409 CommitFailedException. The table is MANAGED when its location sits under the managed-tables area the service assigns from, EXTERNAL otherwise. For local file locations the table directory layout is pre-created at stage time, since clients write data and manifest files before the first commit and object-store-oriented writers don't create parent directories. This makes DuckDB's default configuration work end-to-end: CREATE TABLE AS SELECT stages the create, writes data files, and commits once with assert-create + the first snapshot.
dataders
force-pushed
the
iceberg-rest-write-endpoints
branch
from
June 20, 2026 14:50
948e5c6 to
078b002
Compare
Exercises TableRepository#setIcebergMetadataLocation under contention: N commits fire at once, each asserting the original current-schema-id and bumping the schema. The commits are mutually exclusive, so exactly one wins (200) and the rest lose cleanly (409 CommitFailedException) -- whether a loser loses the compare-and-swap race or reads post-winner state where its requirement no longer holds. Verifies no lost updates and that the table is left consistent at version 1. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JvXw7csrdND28W6LfTGEBa
The Iceberg REST update path writes the new metadata file before the compare-and-swap of the stored metadata location. Cleanup was previously scoped to BaseException, so an unexpected RuntimeException from the swap would leave the metadata file orphaned. Catch RuntimeException, delete the file in all cases, and still translate UPDATE_REQUIREMENT_CONFLICT into a CommitFailedException. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SNg6ZpLZHUeVxuJbQNNJcd
Replace the redundant per-class alias with a static import of CredentialContext.READ_WRITE, matching how the iceberg package classes reference the shared constant, and fold the authorization rationale into the loadTable comment where the read-write credential choice is made. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SNg6ZpLZHUeVxuJbQNNJcd
lockTableForUpdate is now shared by the Delta and Iceberg REST commit paths, but its javadoc only mentioned updateTableForDelta. Note both callers. Also fold the metastore-owner authorization rationale into the loadTable comment where the read/write credential choice is made. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SNg6ZpLZHUeVxuJbQNNJcd
Covers the write-path credential plumbing (the removed SELECT-only FIXME): FileIOFactory and TableConfigService now request read-only credentials by default and read/write when the Iceberg REST catalog asks for them. Two Mockito tests verify the privilege set reaching StorageCredentialVendor for each, using a GCS location so no cloud client is constructed. Also extends MetadataServiceTest with a write/delete round-trip against the existing Adobe S3Mock, exercising writeTableMetadata and deleteTableMetadata (previously uncovered) end to end on an S3 FileIO. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JvXw7csrdND28W6LfTGEBa
3 of 5 tasks
Collaborator
Contributor
Author
|
closing in favor of #1696 |
yili-db
added a commit
that referenced
this pull request
Aug 24, 2026
## Summary Unity Catalog's Iceberg REST catalog can now create and commit native Iceberg tables instead of limiting Iceberg clients to read-only Delta UniForm metadata. Spec-aware clients can discover the write endpoints, create managed or external tables, perform staged creates, commit new snapshots with conflict protection, and drop catalog-created tables. This draft is a current-`main`, DCO-clean continuation of the implementation developed by @dataders in #1618. The implementation credit and history are called out here explicitly; the commits were replayed onto current upstream because the original branch is behind `main` and its DCO check cannot be repaired by a third-party sign-off. ## Design decisions - Native `ICEBERG` tables are writable, while Delta UniForm tables remain read-only so Iceberg metadata cannot diverge from the Delta log. - Commits write a new metadata file and then compare-and-swap the catalog's metadata pointer under a row lock. Concurrent losers receive a conflict instead of silently overwriting another snapshot. - Location-less creates receive a managed location under Unity Catalog's configured managed root. Explicit locations remain external. - Staged creates remain unregistered until the client's `assert-create` commit materializes the table. - Storage credentials are vended according to the requested read or write privileges, and the write routes retain metastore-owner authorization. The remaining endpoint families in the broader Iceberg REST specification—such as multi-table transactions, rename/register, namespace property updates, and view writes—remain outside this change. ## Validation - Focused Iceberg, schema conversion, metadata, credential, and cloud-vendor suites: **24 passed, 0 failed**. - Full server suite: **313 total, 311 passed, 2 skipped, 0 failed, 0 errors**. - The two skipped classes are the MySQL and PostgreSQL Delta Commits Testcontainers suites. The local OrbStack endpoint requires Docker API 1.40+, while this repository's older Testcontainers client advertises API 1.32. Upstream CI should exercise these suites in its supported Docker environment. - `serverShaded/assembly`: **passed**. - Checkstyle and `git diff --check`: **passed**. - The DCO rewrite changed commit metadata only; the source tree hash remained identical before and after the rewrite. ## Known interoperability checks - Recheck the table `HEAD` endpoint with a real HTTP/1.1 Iceberg client; the Java integration suite passes, but an earlier local client probe could stall. - Lowercase REST boolean values work for `purgeRequested`; mixed-case values such as `False` remain an optional compatibility improvement. ## Related Related: #3 Continuation of and implementation credit: #1618 by @dataders. ## Post-deploy monitoring & validation - **Window/owner:** PR author and maintainers during CI, release qualification, and the first 24 hours of any deployment enabling the new endpoints. - **Exercise:** create a namespace and native Iceberg table, append two snapshots, force one concurrent stale commit, reload the table, and drop it through a released Iceberg client. - **Healthy signals:** create/commit/load/drop return expected 2xx responses; stale commits return 409; the stored metadata location advances once per successful commit; data remains readable after server restart. - **Watch logs for:** `CommitFailedException`, `UPDATE_REQUIREMENT_CONFLICT`, `Failed to update Iceberg metadata location`, credential-vending failures, and metadata read/write exceptions. - **Failure/rollback trigger:** unexpected 5xx responses, catalog pointers referencing missing metadata, unauthorized write credentials, or lost concurrent updates. Stop advertising the write endpoints and revert this change while preserving the catalog database and Iceberg metadata for diagnosis. ## PR checklist - [x] Description explains the behavior and design boundaries. - [x] Unit and integration coverage is included. - [x] Focused and full local server validation completed. - [ ] Upstream CI validates the Docker-backed database suites. - [ ] Maintainers confirm whether separate user documentation is required. --- [](https://github.com/EveryInc/compound-engineering-plugin) --------- Signed-off-by: Kia Yun <[email protected]> Signed-off-by: Yi Li <[email protected]> Co-authored-by: dataders <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Yi Li <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Iceberg REST catalog write endpoints
What this does
Adds the write side of the Iceberg REST catalog to OSS Unity Catalog, so spec-compliant clients (PyIceberg, Spark
RESTCatalog, the DuckDB iceberg extension, etc.) can actually create and commit to Iceberg tables — not just read UniForm. Covers the write-endpoint part of #3.POST …/namespacesSchemaService; single-level only, like today).POST …/tablesTableMetadata, write00000-*.metadata.jsonviaFileIO, register in UC asEXTERNALwith a newICEBERGformat.stage-createsupported and stateless (mirrors Iceberg'sCatalogHandlers).POST …/tables/{table}UpdateRequirements, applyMetadataUpdates, write the nextmetadata.json, then CAS the stored location under a row lock. Lost race → 409.assert-createcommits materialize a staged create atomically.DELETE …/tables/{table}New endpoints are advertised in
GET /v1/configso clients that do capability detection (DuckDB) light up automatically.A few supporting bits:
location(DuckDB) get aMANAGEDtable at<managed-root>/tables/<uuid>, resolved like managed Delta staging. Explicit location →EXTERNAL.ICEBERG-format tables accept commits, so the Delta log and Iceberg metadata can't diverge.FileIOFactory/TableConfigServiceno longer hardcodeSELECT(drops the oldFIXME); write creds are only vended to native Iceberg tables, and all routes still authorize as metastore owner.ColumnInfos via a newIcebergSchemaConverter, so tables show up in the UC API/UI. The metadata file stays source of truth for Iceberg clients.Not in scope (follow-ups, still under #3)
transactions/commit(multi-table),X-Iceberg-Access-Delegationnegotiation, register/rename/namespace-properties/views.Testing
IcebergRestCatalogTest— 5/5 passing, fullserver/testsuite green locally (286 tests, 0 failures). New coverage: full write lifecycle (create → commit → drop, plus dup/stale-requirement/UniForm-rejection cases) and staged-create-then-commit.Also ran it against real clients on a local server:
CTAS) and direct-create paths, plusINSERT/DROP.PR Checklist