Repository navigation
fix: casting list to fixedsizelist didn't respect input length - #10228
Merged
Merged
Conversation
Jefffrey
commented
Jun 28, 2026
Comment on lines
-72
to
-82
| pub(crate) fn cast_values_to_fixed_size_list( | ||
| array: &dyn Array, | ||
| to: &FieldRef, | ||
| size: i32, | ||
| cast_options: &CastOptions, | ||
| ) -> Result<ArrayRef, ArrowError> { | ||
| let values = cast_with_options(array, to.data_type(), cast_options)?; | ||
| let list = FixedSizeListArray::try_new(to.clone(), size, values, None)?; | ||
| Ok(Arc::new(list)) | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
This is a drive-by refactor; I inlined it where it's used because it was slightly confusing that the docstring stated its for size 1 (and indeed at its only usage size is only 1) but we accept an arbitrary size
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?
Rationale for this change
When casting from list[view] to degenerate fixedsizelist (0 size), if output has no nulls then it'll incorrectly output an array of length 0 which is mismatched with input array length. This can cause problems for downstream like DataFusion, since they expect input length = output length for cast kernel.
What changes are included in this PR?
Special path for degenerate fixedsizelist cast if we don't have a null buffer to infer length from.
Are these changes tested?
Yes
Are there any user-facing changes?
No