Repository navigation
GH-43146: [C++][Python] Validate list value nullability when casting - #53948
Closed
1932819331hy-debug wants to merge 1 commit into
Closed
1932819331hy-debug wants to merge 1 commit into
1932819331hy-debug wants to merge 1 commit into
Conversation
1932819331hy-debug
requested review from
AlenkaF,
raulcd and
rok
as code owners
October 16, 2026 01:42
|
|
Member
|
Fully automated PRs are not welcome, see https://arrow.apache.org/docs/developers/overview.html#ai-generated-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.
Rationale for this change
Casting a list value field to non-nullable currently accepts null values, producing an array whose data contradicts its nested field nullability. For example,
[[1, null, 3], [], [4, 5]]can be cast tolist<item: int64 not null>.Fixes #43146.
What changes are included in this PR?
Flattenutility so nested keys retain the map's non-null key constraint.Are these changes tested?
arrow-compute-scalar-cast-testfrom the current Arrow 27 source with Apple Clang 17 in Debug mode; all 113 tests passed.Table.castregression cases for list/large-list and safe/unsafe modes. All four reproduce the missing exception against released PyArrow 26.0.0. The Python extension was not rebuilt locally; the fixed behavior was validated through the native C++ suite.Are there any user-facing changes?
List casts that would produce null values in a non-nullable value field now raise
ArrowInvalid, including withsafe=False. The added list-value check respects null ancestors and slice boundaries.This PR contains a "Critical Fix" for casts that currently produce data inconsistent with the declared nested nullability.
Was AI used for this PR?
Code, regression tests, and this description were generated with AI assistance. The implementation was independently reviewed by AI agents, exercised against the reported failure, and validated with the native test suite above.
PR code and description written by:
Reviewed before submission by: