Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vortex-array/src/aggregate_fn/fns/max/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl MaxPartial {
}

fn is_poisoned(&self) -> bool {
self.max.as_ref().is_some_and(scalar_is_nan)
self.element_dtype.is_float() && self.max.as_ref().is_some_and(scalar_is_nan)
}
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/aggregate_fn/fns/min/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl MinPartial {
}

fn is_poisoned(&self) -> bool {
self.min.as_ref().is_some_and(scalar_is_nan)
self.element_dtype.is_float() && self.min.as_ref().is_some_and(scalar_is_nan)
}
}

Expand Down
6 changes: 5 additions & 1 deletion vortex-array/src/aggregate_fn/fns/min_max/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ pub(crate) fn nan_scalar(dtype: &DType) -> Scalar {

/// Whether a scalar holds a primitive float NaN value.
pub(crate) fn scalar_is_nan(scalar: &Scalar) -> bool {
if !scalar.dtype().is_float() {
return false;
}

scalar.as_primitive_opt().is_some_and(|p| p.is_nan())
}

Expand Down Expand Up @@ -233,7 +237,7 @@ impl MinMaxPartial {

/// Whether the partial state is poisoned to NaN.
fn is_poisoned(&self) -> bool {
self.min.as_ref().is_some_and(scalar_is_nan)
self.element_dtype.is_float() && self.min.as_ref().is_some_and(scalar_is_nan)
}
}

Expand Down
3 changes: 2 additions & 1 deletion vortex-array/src/dtype/ptype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use num_traits::Unsigned;
use num_traits::bounds::UpperBounded;
use vortex_error::VortexError;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
use vortex_error::vortex_err;

use crate::dtype::DType;
Expand Down Expand Up @@ -845,7 +846,7 @@ impl TryFrom<&DType> for PType {
if let DType::Primitive(p, _) = value {
Ok(*p)
} else {
Err(vortex_err!("Cannot convert DType {} into PType", value))
vortex_bail!("Cannot convert DType {value} into PType")
}
}
}
Expand Down
Loading