Replace From<Vec<_>> impls with TryFroms for FixedSizeBinaryArray#10019
Open
quantumish wants to merge 1 commit into
Open
Replace From<Vec<_>> impls with TryFroms for FixedSizeBinaryArray#10019quantumish wants to merge 1 commit into
From<Vec<_>> impls with TryFroms for FixedSizeBinaryArray#10019quantumish wants to merge 1 commit into
Conversation
alamb
approved these changes
May 28, 2026
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @quantumish -- this makes sense to me and I think is reasonable to avoid panic's
If other maintainers feel otherwise, we could potentially leave the old from impls
From<Vec<_>> impls with TryFroms for FixedSizeBinaryArray
etseidl
approved these changes
May 28, 2026
Contributor
etseidl
left a comment
There was a problem hiding this comment.
This does seem more correct, but elsewhere we've kept both fallible and infallible APIs, but there we could explain the difference in the docs. Here, as @quantumish notes, From mandates a perfect infallible conversion, which the current code breaks.
TLDR I don't think we need to keep the old impls.
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?
FixedSizeBinaryArrayimplementsFrom<Vec<&[u8]>>etc despite conversion being fallible #10018.Rationale for this change
There isn't a clear way to fix the
From<Vec<_>>implementations forFixedSizeBinaryArraythat wouldn't be confusing, so making themTryFromis a better fit since they are in genuine use across e.g. tests within the Arrow library as well as a terser way of callingFixedSizeBinaryArray::try_from_iterorFixedSizeBinaryArray::try_from_sparse_iter.What changes are included in this PR?
From<Vec<&[u8]>>,From<Vec<&[u8; N]>>, andFrom<Vec<Option<&[u8]>>>implementations forFixedSizeBinaryArraytoTryFromimplementations.TryFrom<Vec<Option<&[u8; N]>>>implementation for the missing combination of types.try_from().unwrap()instead offrom().Are these changes tested?
This is sort of a transparent change in that only the API for expressing failure cases has changed rather than the actual failure cases. All existing tests surrounding conversion failures have been updated to check whether a conversion has correctly failed.
Are there any user-facing changes?
Yes, this is a breaking API change since user-facing trait implementations have been replaced with different trait implementations.