Repository navigation
Conversation
A null or missing nullable struct still appends placeholder slots to its
child builders so later rows stay aligned. RawBuilderSet::AppendNull
checked those hidden slots against each child's nullability, so reading
{} or {"my_struct": null} failed with "a required field was null".
Pass parent_is_null through the recursion so slots masked by a null
parent skip that check. Real JSON nulls and absent values for required
fields are still rejected.
Generated-by: OpenAI Codex, Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Rationale for this change
The JSON reader rejects a missing or null nullable struct when that struct has non-nullable children. With an explicit schema where
my_structis nullable and its childsome_informationis a non-nullable int64, reading{}or{"my_struct": null}fails with "JSON parse error: a required field was null". Each of those rows should produce one null struct.What changes are included in this PR?
A null struct still needs placeholder slots in its child arrays so later rows stay aligned.
RawBuilderSet::AppendNullappends those slots recursively, but it also checked each hidden child slot against the child's nullability, as if it were a real JSON null.This passes
parent_is_nullthrough that recursion so slots masked by a null parent can be appended. Calls for actual JSON values keep the required-field check, so{"my_struct": {}}and{"my_struct": {"some_information": null}}are still rejected. No public API changes.Are these changes tested?
Yes. Two parser tests were added.
BlockParserWithSchema.NullableStructWithRequiredChildrenreads null and missing nullable structs with required children, including a required nested struct with a required boolean child, then a populated row. It checks parent validity, the populated row's child values and full array validation.BlockParserWithSchema.RequiredChildrenOfValidStructchecks that absent or null required children are still rejected after a null parent row, and that absent or null non-nullable parents are rejected.On upstream main dd456e0, macOS arm64, Apple Clang 21, Debug minimal preset with tests, compute, JSON and CSV enabled.
arrow-json-testbinary passes 248 tests from 60 test suites.git diff --checkpass.Not run here. Python bindings, Linux, Windows, sanitizers, the full Arrow suite and upstream CI. This is independent of the output-schema nullability work in GH-31957 and the open PR for GH-43115.
Are there any user-facing changes?
Yes. Valid JSON that was rejected now reads as null structs.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by:
OpenAI Codex searched for overlapping work, investigated the parser, wrote the fix and regression tests and ran the first validation. Claude Code re-ran the validation on current main and updated this description.
🤖 Generated with Claude Code