Repository navigation
Conversation
antonlin1
marked this pull request as draft
October 28, 2026 14:42
This branch has not been deployed
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.
Rationale for this change
Replacing a dataset with an incompatible schema currently requires callers to drop and recreate the table or assemble low-level metadata updates. Dropping first can leave the table missing if the replacement write fails.
Add
Catalog.replace_table_transactionto publish a replacement definition and its data in one commit:The implementation follows Java's table metadata replacement and REST replacement transaction. It reuses column IDs by name and matching historical schema, partition-spec, and sort-order IDs. It retains the table UUID, old snapshots, and other refs while starting replacement data on a new snapshot lineage. The existing transaction and catalog commit paths provide publication and retry handling. Commit requirements protect ID allocation and concurrent metadata changes.
For v1 tables, removed partition fields become void fields. The change also handles writes when their source columns have been removed, including Avro encoding of null-only partition fields.
Are these changes tested?
The full unit suite and repository lint pass. Behavioral tests cover visibility before commit, incompatible schemas, historical reads, empty replacements, exceptions, stale UUIDs, concurrent appends and schema changes, ID allocation, layout replacement, and format upgrades. REST request tests verify reconstruction through the normal commit endpoint. Null-field Avro tests read the output with fastavro to check encoding independently.
The new integration test passes against the Apache Iceberg Java REST fixture for both v1 and v2 tables, with both local-file storage and the repository's S3 test storage. The existing REST catalog tests also pass with the authenticated test configuration. It verifies that the old rows remain readable until commit, then checks the replacement rows and retained UUID, snapshots, and tags. It also verifies a subsequent empty replacement.
Are there any user-facing changes?
Yes. The new API accepts an Iceberg or Arrow schema and optional location, partition spec, sort order, and properties. Partitioning and sorting default to unpartitioned and unsorted. Properties merge with existing properties and location defaults to the existing location.
The API documentation includes an example and these semantics. No new REST endpoint or dependency is introduced.