File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ impl MaxPartial {
6767 }
6868
6969 fn is_poisoned ( & self ) -> bool {
70- self . max . as_ref ( ) . is_some_and ( scalar_is_nan)
70+ self . element_dtype . is_float ( ) && self . max . as_ref ( ) . is_some_and ( scalar_is_nan)
7171 }
7272}
7373
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ impl MinPartial {
6767 }
6868
6969 fn is_poisoned ( & self ) -> bool {
70- self . min . as_ref ( ) . is_some_and ( scalar_is_nan)
70+ self . element_dtype . is_float ( ) && self . min . as_ref ( ) . is_some_and ( scalar_is_nan)
7171 }
7272}
7373
Original file line number Diff line number Diff line change @@ -149,6 +149,10 @@ pub(crate) fn nan_scalar(dtype: &DType) -> Scalar {
149149
150150/// Whether a scalar holds a primitive float NaN value.
151151pub ( crate ) fn scalar_is_nan ( scalar : & Scalar ) -> bool {
152+ if !scalar. dtype ( ) . is_float ( ) {
153+ return false ;
154+ }
155+
152156 scalar. as_primitive_opt ( ) . is_some_and ( |p| p. is_nan ( ) )
153157}
154158
@@ -233,7 +237,7 @@ impl MinMaxPartial {
233237
234238 /// Whether the partial state is poisoned to NaN.
235239 fn is_poisoned ( & self ) -> bool {
236- self . min . as_ref ( ) . is_some_and ( scalar_is_nan)
240+ self . element_dtype . is_float ( ) && self . min . as_ref ( ) . is_some_and ( scalar_is_nan)
237241 }
238242}
239243
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use num_traits::Unsigned;
2121use num_traits:: bounds:: UpperBounded ;
2222use vortex_error:: VortexError ;
2323use vortex_error:: VortexResult ;
24+ use vortex_error:: vortex_bail;
2425use vortex_error:: vortex_err;
2526
2627use crate :: dtype:: DType ;
@@ -845,7 +846,7 @@ impl TryFrom<&DType> for PType {
845846 if let DType :: Primitive ( p, _) = value {
846847 Ok ( * p)
847848 } else {
848- Err ( vortex_err ! ( "Cannot convert DType {} into PType" , value ) )
849+ vortex_bail ! ( "Cannot convert DType {value } into PType" )
849850 }
850851 }
851852}
You can’t perform that action at this time.
0 commit comments