Core: Parse optional null map values in SingleValueParser - #18118
Open
laserninja wants to merge 3 commits into
Open
laserninja wants to merge 3 commits into
laserninja wants to merge 3 commits into
Conversation
Preserve ordered immutable maps while permitting optional null values and retaining key and required-value validation. Fixes apache#18117 Generated-by: Codex
Generated-by: Codex
Exercise task serialization and row consumption so optional null values survive the consumer path. Generated-by: Codex
1 task
uros-b
reviewed
Sep 15, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Nice, thank you @laserninja! This closes a real toJson/fromJson asymmetry (ImmutableMap.Builder rejects the null values toJson already emits); the LinkedHashMap + unmodifiableMap swap is well-chosen, validation correctly ordered (null-key → null-required → duplicate), round-trip verified both ways with a ScanTaskParser consumer regression.
Member
|
For further review, cc @nastra who has more context in core serialization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18117.
SingleValueParser.toJsoncan serialize an optional null map value, butfromJsonfails on that output becauseImmutableMap.Builderrejects nulls.Build a
LinkedHashMapand return an unmodifiable view to preserve iteration order and immutability while accepting optional null values. Explicitly reject null keys, duplicate keys (including an earlier null value), and null required values with argument errors.Validation on JDK 17: the five new regressions failed before the fix.
TestSingleValueParser,TestSchemaParser,TestDataTaskParser,TestContentFileParser, andTestExpressionParserpassed afterward, along with core formatting, checkstyle, andrevapichecks.Consumer regression: a
StaticDataTaskcontaining an optional null map value is serialized throughScanTaskParser, restored, and its rows consumed. This test fails with the original parser (null-value exception) and passes with the fix. The fullTestDataTaskParsersuite and core formatting/checkstyle checks pass on JDK 17.Additional local validation at
76b236c67: the full core check passed on JDK 17, with 8,258 passing tests, 550 skipped tests, and zero failures or errors. Apache RAT (dev/check-license) and the full Java CI command (./gradlew check -DsparkVersions= -DflinkVersions= -DkafkaVersions= -Pquick=true -x javadoc -x spotlessCheck) also passed. The latter includes the OpenAPI tests and specification validation; it does not run the Spark/Flink/Kafka test matrices.AI Disclosure