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.
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.
Consumer reproduction: a StaticDataTask containing an optional null map value can be serialized with ScanTaskParser.toJson, but restoring it with ScanTaskParser.fromJson fails with the same null-value exception. The regression in #18118 verifies serialization, restoration, and consumption of the resulting rows. It fails before the fix and passes afterward.
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
This report and its reproduction were prepared with AI assistance and verified locally.
Apache Iceberg version
main (development), commit
c4784768bQuery 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.
The JSON is
{"keys":["a"],"values":[null]}. Parsing throwsNullPointerException: null value in entry: a=null.Expected: recover the same map. Iceberg permits optional map values.
mapFromJsoncurrently usesImmutableMap.Builder, which rejects all null values.Consumer reproduction: a
StaticDataTaskcontaining an optional null map value can be serialized withScanTaskParser.toJson, but restoring it withScanTaskParser.fromJsonfails with the same null-value exception. The regression in #18118 verifies serialization, restoration, and consumption of the resulting rows. It fails before the fix and passes afterward.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
This report and its reproduction were prepared with AI assistance and verified locally.