File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
vortex-array/src/array/constant Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use arrow_array::builder::make_view;
22use arrow_buffer:: BooleanBuffer ;
33use vortex_buffer:: { buffer, Buffer , BufferMut } ;
44use vortex_dtype:: { match_each_native_ptype, DType , Nullability } ;
5- use vortex_error:: { vortex_bail, VortexResult } ;
5+ use vortex_error:: { vortex_bail, VortexExpect , VortexResult } ;
66use vortex_scalar:: { BinaryScalar , BoolScalar , ExtScalar , Utf8Scalar } ;
77
88use crate :: array:: constant:: ConstantArray ;
@@ -36,7 +36,15 @@ impl IntoCanonical for ConstantArray {
3636 DType :: Primitive ( ptype, ..) => {
3737 match_each_native_ptype ! ( ptype, |$P | {
3838 Canonical :: Primitive ( PrimitiveArray :: new(
39- Buffer :: full( $P :: try_from( scalar) . unwrap_or_else( |_| $P :: default ( ) ) , self . len( ) ) ,
39+ if scalar. is_valid( ) {
40+ Buffer :: full(
41+ $P :: try_from( scalar)
42+ . vortex_expect( "Couldn't unwrap scalar to primitive" ) ,
43+ self . len( ) ,
44+ )
45+ } else {
46+ Buffer :: zeroed( self . len( ) )
47+ } ,
4048 validity,
4149 ) )
4250 } )
You can’t perform that action at this time.
0 commit comments