-
Notifications
You must be signed in to change notification settings - Fork 407
Description
Apache Iceberg Rust version
0.6.0 (latest version)
Describe the bug
When creating a table via RestCatalog, the CreateTableRequest is serialized with explicit null values for optional fields like location, partition_spec, write_order, and stage_create. Some REST catalog implementations, such as Apache Polaris, reject these requests with HTTP 400 Bad Request.
Current serialized JSON:
{ "name": "my_table", "location": null, "schema": { ... }, "partition_spec": null, "write_order": null, "stage_create": null, "properties": {} }
Expected (per JSON convention for optional fields):
{ "name": "my_table", "schema": { ... }, "properties": {} }
To Reproduce
- Set up Apache Polaris as a REST catalog
- Create a RestCatalog client pointing to Polaris
- Attempt to create an unpartitioned table without specifying location, partition_spec, or write_order
- Observe HTTP 400 Bad Request response
Expected behavior
Table creation should succeed. Optional fields with None values should be omitted from the JSON request body rather than serialized as null.
Additional context
The fix is to add #[serde(skip_serializing_if = "Option::is_none")] to the affected fields in CreateTableRequest and related types (UnboundPartitionSpec, UnboundPartitionField).
Expected behavior
No response
Willingness to contribute
None