Skip to content

Commit 2914853

Browse files
committed
wip
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 6bd1832 commit 2914853

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

vortex-vector/src/fixed_size_list/scalar.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)