File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
vortex-vector/src/fixed_size_list Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -104,17 +104,15 @@ impl ScalarOps for FixedSizeListScalar {
104104
105105 let list_size = self . 0 . list_size ( ) ;
106106
107- // Get the elements from the scalar's inner length-1 vector and repeat them
108- // Clone the inner Vector from the Arc
109107 let scalar_elements = self . 0 . elements ( ) ;
110-
111108 let mut elements = scalar_elements. as_ref ( ) . clone ( ) ;
109+ // ensure we don't allocate a vector with the wrong size.
112110 elements. clear ( ) ;
113111 let mut elements = elements. into_mut ( ) ;
114- elements. reserve ( ( n - 1 ) * list_size as usize ) ;
112+ elements. reserve ( n * list_size as usize ) ;
115113
116114 if self . is_null ( ) {
117- elements. append_zeros ( ( n - 1 ) * list_size as usize ) ;
115+ elements. append_zeros ( n * list_size as usize ) ;
118116 let validity = MaskMut :: new_false ( n) ;
119117 return unsafe {
120118 VectorMut :: FixedSizeList ( FixedSizeListVectorMut :: new_unchecked (
@@ -126,7 +124,7 @@ impl ScalarOps for FixedSizeListScalar {
126124 }
127125
128126 // Repeat the elements n-1 more times (we already have 1 copy)
129- for _ in 1 ..n {
127+ for _ in 0 ..n {
130128 elements. extend_from_vector ( scalar_elements. as_ref ( ) ) ;
131129 }
132130
You can’t perform that action at this time.
0 commit comments