ninglinLiu opened a new pull request, #3530:
URL: https://github.com/apache/iceberg-rust/pull/3530
## Which issue does this PR close?
- Closes #3469.
## What changes are included in this PR?
`RestCatalog::create_table` now sends `spec-id: 0` when the
`UnboundPartitionSpec` in the `TableCreation` has 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) require `spec-id` and 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 for
`TableUpdate::AddSpec` and elsewhere) is unchanged.
## Are these changes tested?
Yes.
- `test_create_table` now matches the request body and requires
`"partition-spec": {"spec-id": 0}` for a spec built without an id. It fails on
`main` and passes with this change.
- New `test_create_table_keeps_explicit_partition_spec_id` checks 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 warnings` and `cargo fmt --all --
--check` pass.
This PR was prepared with AI assistance and reviewed/tested by the author.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]