KangJiJi opened a new pull request, #7099:
URL: https://github.com/apache/paimon/pull/7099
### 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:**
```json
{
"id": 1,
"name": "column_name",
"required": false,
"type": "string",
"doc": null
}
```
**After:**
```json
{
"id": 1,
"name": "column_name",
"required": false,
"type": "string"
}
```
### Tests
- `IcebergDataFieldTest#testDocFieldSerializationWithNullValue`
- `IcebergDataFieldTest#testDocFieldSerializationWithNonNullValue`
### API and Format
No API changes.
### Documentation
[Iceberg](https://iceberg.apache.org/spec/#schemas)
--
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]