Skip to content

Conversation

@KangJiJi
Copy link
Contributor

Purpose

When using Paimon table with metadata.iceberg.storage option to read metadata as Iceberg table, Iceberg fails to parse the metadata JSON with the following error:

Error while reading table: iceberg, error message: Failed to parse Iceberg table schema 
with the following error: [json.exception.type_error] type must be string, but is null

This happens because Paimon serializes the doc field as "doc": null when the field description is not set. According to Iceberg spec, the doc field is optional. It is preferable to omit it rather than set it to null when not present.

This PR adds @JsonInclude(JsonInclude.Include.NON_NULL) annotation to the doc field in IcebergDataField, so that null values are excluded from JSON output.

Before:

{
  "id": 1,
  "name": "column_name",
  "required": false,
  "type": "string",
  "doc": null
}

After:

{
  "id": 1,
  "name": "column_name",
  "required": false,
  "type": "string"
}

Tests

  • IcebergDataFieldTest#testDocFieldSerializationWithNullValue
  • IcebergDataFieldTest#testDocFieldSerializationWithNonNullValue

API and Format

No API changes.

Documentation

Iceberg

@JingsongLi
Copy link
Contributor

+1 thanks @KangJiJi

@JingsongLi JingsongLi merged commit af23563 into apache:master Jan 22, 2026
13 checks passed
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.

2 participants