44use vortex_dtype:: {
55 DType , DecimalType , PrecisionScale , match_each_decimal_value_type, match_each_native_ptype,
66} ;
7- use vortex_error:: { VortexExpect , VortexResult } ;
7+ use vortex_error:: VortexExpect ;
88use vortex_scalar:: { BinaryScalar , BoolScalar , DecimalScalar , PrimitiveScalar , Scalar , Utf8Scalar } ;
99use vortex_vector:: binaryview:: { BinaryVectorMut , StringVectorMut } ;
1010use vortex_vector:: bool:: BoolVectorMut ;
@@ -13,29 +13,7 @@ use vortex_vector::null::NullVectorMut;
1313use vortex_vector:: primitive:: { PVectorMut , PrimitiveVectorMut } ;
1414use vortex_vector:: { VectorMut , VectorMutOps } ;
1515
16- use crate :: ArrayRef ;
17- use crate :: arrays:: { ConstantArray , ConstantVTable } ;
18- use crate :: execution:: { BatchKernelRef , BindCtx , kernel} ;
19- use crate :: vtable:: OperatorVTable ;
20-
21- impl OperatorVTable < ConstantVTable > for ConstantVTable {
22- fn bind (
23- array : & ConstantArray ,
24- selection : Option < & ArrayRef > ,
25- ctx : & mut dyn BindCtx ,
26- ) -> VortexResult < BatchKernelRef > {
27- let mask = ctx. bind_selection ( array. len , selection) ?;
28- let scalar = array. scalar ( ) . clone ( ) ;
29-
30- Ok ( kernel ( move || {
31- // TODO(ngates): would be good to do a sum aggregation, rather than execution.
32- let mask = mask. execute ( ) ?;
33- Ok ( to_vector ( scalar, mask. true_count ( ) ) . freeze ( ) )
34- } ) )
35- }
36- }
37-
38- fn to_vector ( scalar : Scalar , len : usize ) -> VectorMut {
16+ pub ( super ) fn to_vector ( scalar : Scalar , len : usize ) -> VectorMut {
3917 match scalar. dtype ( ) {
4018 DType :: Null => NullVectorMut :: new ( len) . into ( ) ,
4119 DType :: Bool ( _) => to_vector_bool ( scalar. as_bool ( ) , len) . into ( ) ,
0 commit comments