diff --git a/vortex-datetime-parts/src/compute.rs b/vortex-datetime-parts/src/compute.rs index fa27e2929f..c1cbcab5b2 100644 --- a/vortex-datetime-parts/src/compute.rs +++ b/vortex-datetime-parts/src/compute.rs @@ -222,18 +222,10 @@ mod test { let local = decode_to_localdatetime(&date_times.into_array()).unwrap(); let elem0: i64 = scalar_at(&local.timestamps(), 0) - .unwrap() - .value() - .as_pvalue() - .unwrap() .unwrap() .try_into() .unwrap(); let elem1: i64 = scalar_at(&local.timestamps(), 1) - .unwrap() - .value() - .as_pvalue() - .unwrap() .unwrap() .try_into() .unwrap(); diff --git a/vortex-scalar/src/primitive.rs b/vortex-scalar/src/primitive.rs index 71a16d52c6..f1e25f3958 100644 --- a/vortex-scalar/src/primitive.rs +++ b/vortex-scalar/src/primitive.rs @@ -123,6 +123,14 @@ macro_rules! primitive_scalar { .ok_or_else(|| vortex_err!("Can't extract present value from null scalar")) } } + + impl TryFrom for $T { + type Error = VortexError; + + fn try_from(value: Scalar) -> Result { + <$T>::try_from(&value) + } + } }; }