feat: support casting Time32 to Int64#8971
Merged
alamb merged 2 commits intoapache:mainfrom Dec 11, 2025
Merged
Conversation
alamb
reviewed
Dec 10, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thanks @tshauck -- this is great. The only thing I think is missing is updating can_cast_types to communicate this cast is supported.
arrow-rs/arrow-cast/src/cast/mod.rs
Line 95 in 112e581
Thank you 🙏
| let to_type = DataType::Int64; | ||
| let cast_options = CastOptions::default(); | ||
|
|
||
| let result = cast_with_options(&array, &to_type, &cast_options); |
Contributor
There was a problem hiding this comment.
Can we please also add a test that verifies that can_cast_types supports the cast too, similar to
Something like this maybe:
assert!(can_cast_types(array.data_type(), &to_type);
alamb
approved these changes
Dec 10, 2025
Time32 to Int64
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?
While this issue was raised on the datafusion side, I think this is where the underlying issue exists, i.e., that arrow cannot do the cast directly.
Rationale for this change
It should be possible to directly go from a time32 to an int64, but currently it is not.
What changes are included in this PR?
Are these changes tested?
Yes, adds test to mimic the case described in the datafusion issue.
Are there any user-facing changes?
No