File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
vortex-vector/src/fixed_size_list Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -107,23 +107,35 @@ impl ScalarOps for FixedSizeListScalar {
107107 // Get the elements from the scalar's inner length-1 vector and repeat them
108108 // Clone the inner Vector from the Arc
109109 let scalar_elements = self . 0 . elements ( ) ;
110- let mut elements = scalar_elements. as_ref ( ) . clone ( ) . into_mut ( ) ;
110+
111+ let mut elements = scalar_elements. as_ref ( ) . clone ( ) ;
112+ elements. clear ( ) ;
113+ let mut elements = elements. into_mut ( ) ;
111114 elements. reserve ( ( n - 1 ) * list_size as usize ) ;
112115
116+ if self . is_null ( ) {
117+ elements. append_zeros ( ( n - 1 ) * list_size as usize ) ;
118+ let validity = MaskMut :: new_false ( n) ;
119+ return unsafe {
120+ VectorMut :: FixedSizeList ( FixedSizeListVectorMut :: new_unchecked (
121+ Box :: new ( elements) ,
122+ list_size,
123+ validity,
124+ ) )
125+ } ;
126+ }
127+
113128 // Repeat the elements n-1 more times (we already have 1 copy)
114129 for _ in 1 ..n {
115130 elements. extend_from_vector ( scalar_elements. as_ref ( ) ) ;
116131 }
117132
118- // Build validity for n lists
119- let validity = MaskMut :: new ( n, self . is_valid ( ) ) ;
120-
121133 // SAFETY: We've repeated the elements n times, so elements.len() == n * list_size
122134 unsafe {
123135 VectorMut :: FixedSizeList ( FixedSizeListVectorMut :: new_unchecked (
124136 Box :: new ( elements) ,
125137 list_size,
126- validity ,
138+ MaskMut :: new_true ( n ) ,
127139 ) )
128140 }
129141 }
You can’t perform that action at this time.
0 commit comments