feat: Extend Expr.reinterpret to all numeric types of the same size#26401
Open
leudz wants to merge 4 commits intopola-rs:mainfrom
Open
feat: Extend Expr.reinterpret to all numeric types of the same size#26401leudz wants to merge 4 commits intopola-rs:mainfrom
Expr.reinterpret to all numeric types of the same size#26401leudz wants to merge 4 commits intopola-rs:mainfrom
Conversation
leudz
commented
Feb 3, 2026
| } | ||
| #[cfg(not(feature = "dtype-u128"))] | ||
| { | ||
| unimplemented!() |
Author
There was a problem hiding this comment.
unimplemented!() was used originally so I kept it. unreachable!() might make more sense.
This comment applies to all of them.
Comment on lines
371
to
391
| fn reinterpret_signed(&self) -> Series { | ||
| match self.inner_dtype() { | ||
| #[cfg(feature = "dtype-f16")] | ||
| DataType::Float16 => reinterpret_list_chunked::<Float16Type, Int16Type>(self), | ||
| DataType::Float32 => reinterpret_list_chunked::<Float32Type, Int32Type>(self), | ||
| DataType::Float64 => reinterpret_list_chunked::<Float64Type, Int64Type>(self), | ||
| _ => unimplemented!(), | ||
| } | ||
| .into_series() | ||
| } | ||
|
|
||
| fn reinterpret_unsigned(&self) -> Series { | ||
| match self.inner_dtype() { | ||
| #[cfg(feature = "dtype-f16")] | ||
| DataType::Float16 => reinterpret_list_chunked::<Float16Type, UInt16Type>(self), | ||
| DataType::Float32 => reinterpret_list_chunked::<Float32Type, UInt32Type>(self), | ||
| DataType::Float64 => reinterpret_list_chunked::<Float64Type, UInt64Type>(self), | ||
| _ => unimplemented!(), | ||
| } | ||
| .into_series() | ||
| } |
Author
There was a problem hiding this comment.
I'm not sure where/how these are used. They are reinterpreting floats, which is interesting.
Should I add the new type combinations here?
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #26401 +/- ##
=======================================
Coverage 80.99% 80.99%
=======================================
Files 1782 1782
Lines 243078 243123 +45
Branches 3078 3078
=======================================
+ Hits 196879 196925 +46
+ Misses 45396 45395 -1
Partials 803 803 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Fixes #13659
Following the implementation outlined in this comment,
reinterpretnow works with all numeric types as long as they have the same size.reinterprettakes aDataTypeargument instead of abool.relevant and correct.