Repository navigation
fix(rest): send spec-id 0 in create_table when the partition spec has none - #3530
Open
ninglinLiu wants to merge 2 commits into
Open
ninglinLiu wants to merge 2 commits into
ninglinLiu wants to merge 2 commits into
Conversation
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.
Which issue does this PR close?
What changes are included in this PR?
RestCatalog::create_tablenow sendsspec-id: 0when theUnboundPartitionSpecin theTableCreationhas no spec id, and keeps the id unchanged when one is set.Since #2610, an unset spec id is omitted from the request. Servers that parse the request with Iceberg Java's
PartitionSpecParser(for example Polaris 1.3.0) requirespec-idand reject the request with a bare HTTP 400. The first spec of a new table always has id 0, which is also what the Java client sends.The default is applied where the REST request is built, so the serde behaviour of
UnboundPartitionSpec(which is also used forTableUpdate::AddSpecand elsewhere) is unchanged.Are these changes tested?
Yes.
test_create_tablenow matches the request body and requires"partition-spec": {"spec-id": 0}for a spec built without an id. It fails onmainand passes with this change.test_create_table_keeps_explicit_partition_spec_idchecks that an explicitly set spec id (3) is sent unchanged.cargo test -p iceberg-catalog-rest --lib(97 tests),cargo clippy -p iceberg-catalog-rest --all-targets -- -D warningsandcargo fmt --all -- --checkpass.This PR was prepared with AI assistance and reviewed/tested by the author.