fix: preserve inner list field name, nullability and metadata in array_slice (#24341) - #24343
Closed
waterWang wants to merge 1 commit into
Closed
fix: preserve inner list field name, nullability and metadata in array_slice (#24341)#24343waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
Member
|
Would you mind reviewing #24345 instead? It includes SLT tests, which our project prefers. |
Contributor
This was referenced Aug 14, 2026
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.

Which issue does this PR close?
Closes #24341.
What changes are included in this PR?
general_array_sliceinextract.rswas rebuilding the output list's inner field from scratch usingField::new_list_field(array.value_type(), true), which always producesField("item", T, nullable: true). This discards the input field's name, nullability, and metadata, contradictingArraySlice::return_typewhich promisesarg_types[0].clone().This fix extracts the field from the input array's data type instead, matching the approach already used in
general_list_view_array_slicefor ListView arrays.Are these changes tested?
Yes. Added
test_array_slice_preserves_inner_fieldwhich verifies that the output list type preserves the input field's name and nullability.Issue body for reference
Describe the bug
ArraySlice::return_typepromisesarg_types[0].clone(), i.e. the input list type verbatim — inner field name, nullability and metadata included. But the kernel rebuilds the output's inner field from scratch ingeneral_array_slice(extract.rs:685):That drops the field name (any name →
item), drops inner metadata, and forcesnullable: true. Whenever the input list's inner field is anything other thanField("item", T, nullable: true), the returned array disagrees with the promised type. On debug builds this trips the return-type assertion added in #17515; on release builds it silently produces a batch whose field name/nullability disagrees with the schema the planner recorded.This is the same defect fixed for
array_sortin #19