laserninja opened a new issue, #18117:
URL: https://github.com/apache/iceberg/issues/18117
### Apache Iceberg version
main (development), commit `c4784768b`
### Query engine
Other: Java API
### Please describe the bug
The public single-value serializer writes an optional null map value, but
its parser cannot read that output.
```java
Types.MapType type = Types.MapType.ofOptional(
1, 2, Types.StringType.get(), Types.IntegerType.get());
Map<String, Integer> value = new HashMap<>();
value.put("a", null);
String json = SingleValueParser.toJson(type, value);
SingleValueParser.fromJson(type, json);
```
The JSON is `{"keys":["a"],"values":[null]}`. Parsing throws
`NullPointerException: null value in entry: a=null`.
Expected: recover the same map. Iceberg permits optional map values.
`mapFromJson` currently uses `ImmutableMap.Builder`, which rejects all null
values.
Proposed fix: allow optional null values while retaining immutable results
and rejecting null/duplicate keys and null required values. This report
concerns the single-value parser, not support for non-null map column defaults,
which are separately disallowed by the field builder.
### Willingness to contribute
- [x] I can contribute a fix for this bug independently
This report and its reproduction were prepared with AI assistance and
verified locally.
--
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]