Skip to content

fix(rest): send spec-id 0 in create_table when the partition spec has none - #3484

Open
ahlag wants to merge 1 commit into
apache:mainfrom
ahlag:fix-rest-create-table-spec-id
Open

ahlag wants to merge 1 commit into
apache:mainfrom
ahlag:fix-rest-create-table-spec-id

Conversation

@ahlag

@ahlag ahlag commented Oct 17, 2026

Copy link
Copy Markdown

Which issue does this PR close?

What changes are included in this PR?

RestCatalog::create_table now sends spec-id: 0 when the UnboundPartitionSpec has no spec id, and keeps the id when one is set. Since #2610 an unset id is omitted, and servers that parse the request with Iceberg Java's PartitionSpecParser (e.g. Polaris) reject it with HTTP 400. 0 is the initial spec id, and is what the Java client sends for a new table.

The default is applied where the request is built rather than in the serde attributes of UnboundPartitionSpec, which is also serialized for TableUpdate::AddSpec (#2702 discussed moving the skip out of the core type).

Are these changes tested?

Yes, test_create_table now matches the request body for "partition-spec": {"spec-id": 0}. It fails without the fix.

AI Disclosure

I used Claude Code to find the cause and write the fix and test. I reviewed the change and checked that the test fails without the fix. Points to check: whether 0 is the right default (Java servers assign a fresh spec id on create, so I believe the value is not used), and whether the literal 0 is fine here since DEFAULT_PARTITION_SPEC_ID is pub(crate) in iceberg.

… none

Servers that parse the request with Iceberg Java's PartitionSpecParser,
such as Apache Polaris, reject a partition spec without spec-id.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST create_table omits partition spec-id; Java-based servers (Polaris) reject it

1 participant