API: Propagate allowMissing to nested structs in StructProjection#17052
Open
thswlsqls wants to merge 1 commit into
Open
API: Propagate allowMissing to nested structs in StructProjection#17052thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
StructProjection's private 3-arg constructor recurses into a nested struct field using the 2-arg constructor, which always passes allowMissing=false. As a result, StructProjection.createAllowMissing still throws IllegalArgumentException when an optional field is missing inside a nested struct, even though the top-level struct allows missing fields as documented. Pass the outer allowMissing value through to the recursive call for the STRUCT case so nested structs behave the same as the top level. Closes apache#16123 Generated-by: Claude Code
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.
Closes #16123
Summary
StructProjection's private 3-arg constructor recurses into a STRUCT field via the 2-arg constructor, which always passesallowMissing=false.StructProjection.createAllowMissing(...)still throwsIllegalArgumentExceptionfor a missing optional field inside a nested struct, even though the top-level struct allows it.allowMissingvalue through to the recursive constructor call in the STRUCT case, so nested structs behave the same as the top level.Testing done
TestStructProjection#createAllowMissingAllowsMissingOptionalFieldInNestedStructand#createStillThrowsForMissingOptionalFieldInNestedStruct, covering the positive (allowMissing) and negative (strict create) cases for a missing optional nested field.IllegalArgumentExceptionagainst the unmodified constructor, and passes after the fix../gradlew :iceberg-api:check— 1197 tests passed, 0 failures../gradlew :iceberg-api:revapi— passed (only a private constructor call site changed).