Skip to content

REST catalog CreateTableRequest sends explicit null values, causing 400 errors with Polaris #2135

@jonbjo

Description

@jonbjo

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

  1. Set up Apache Polaris as a REST catalog
  2. Create a RestCatalog client pointing to Polaris
  3. Attempt to create an unpartitioned table without specifying location, partition_spec, or write_order
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions