@@ -8,7 +8,7 @@ use vortex_array::compute::fill_null;
88use vortex_array:: validity:: Validity ;
99use vortex_array:: vtable:: ValidityHelper ;
1010use vortex_array:: { ArrayRef , Canonical , IntoArray , ToCanonical } ;
11- use vortex_buffer:: Buffer ;
11+ use vortex_buffer:: { Buffer , BufferMut } ;
1212use vortex_dtype:: { DType , Nullability , match_each_decimal_value_type, match_each_native_ptype} ;
1313use vortex_error:: { VortexExpect , VortexResult , VortexUnwrap } ;
1414use vortex_scalar:: Scalar ;
@@ -136,7 +136,7 @@ fn fill_decimal_array(
136136 let validity_bits = validity_bool_array. bit_buffer( ) ;
137137 let data_buffer = array. buffer:: <D >( ) ;
138138
139- let mut new_data = Vec :: with_capacity( array. len( ) ) ;
139+ let mut new_data = BufferMut :: with_capacity( array. len( ) ) ;
140140 for i in 0 ..array. len( ) {
141141 if validity_bits. value( i) {
142142 new_data. push( data_buffer[ i] ) ;
@@ -145,7 +145,8 @@ fn fill_decimal_array(
145145 }
146146 }
147147
148- DecimalArray :: from_option_iter( new_data. into_iter( ) . map( Some ) , decimal_dtype)
148+ DecimalArray :: try_new( new_data. freeze( ) , decimal_dtype, result_nullability. into( ) )
149+ . vortex_unwrap( )
149150 . into_array( )
150151 }
151152 }
0 commit comments