vortex_compute/cast/
primitive.rs1use vortex_dtype::DType;
5use vortex_error::VortexResult;
6use vortex_vector::Scalar;
7use vortex_vector::Vector;
8use vortex_vector::match_each_pscalar;
9use vortex_vector::match_each_pvector;
10use vortex_vector::primitive::PrimitiveScalar;
11use vortex_vector::primitive::PrimitiveVector;
12
13use crate::cast::Cast;
14
15impl Cast for PrimitiveVector {
16 type Output = Vector;
17
18 fn cast(&self, target_dtype: &DType) -> VortexResult<Vector> {
21 match_each_pvector!(self, |v| { Cast::cast(v, target_dtype) })
22 }
23}
24
25impl Cast for PrimitiveScalar {
26 type Output = Scalar;
27
28 fn cast(&self, target_dtype: &DType) -> VortexResult<Scalar> {
31 match_each_pscalar!(self, |s| { Cast::cast(s, target_dtype) })
32 }
33}