diff --git a/vortex-array/src/builders/list.rs b/vortex-array/src/builders/list.rs index 91fcb8d0e..f93445e1c 100644 --- a/vortex-array/src/builders/list.rs +++ b/vortex-array/src/builders/list.rs @@ -34,7 +34,7 @@ where ) -> Self { // I would expect the list to have more than one value per index let value_builder = builder_with_capacity(value_dtype.as_ref(), 2 * capacity); - let mut index_builder = PrimitiveBuilder::with_capacity(nullability, capacity); + let mut index_builder = PrimitiveBuilder::with_capacity(Nullability::NonNullable, capacity); // The first index of the list, which is always 0 and represents an empty list. index_builder.append_zero(); diff --git a/vortex-array/src/builders/struct_.rs b/vortex-array/src/builders/struct_.rs index 5ddb49eac..546d8296c 100644 --- a/vortex-array/src/builders/struct_.rs +++ b/vortex-array/src/builders/struct_.rs @@ -49,9 +49,10 @@ impl StructBuilder { } if let Some(fields) = struct_scalar.fields() { - for (builder, field) in self.builders.iter_mut().zip(fields) { + for (builder, field) in self.builders.iter_mut().zip_eq(fields) { builder.append_scalar(&field)?; } + self.validity.append_value(true); } else { self.append_null() } @@ -94,6 +95,7 @@ impl ArrayBuilder for StructBuilder { } fn finish(&mut self) -> VortexResult { + let len = self.len(); let fields: Vec = self .builders .iter_mut() @@ -105,12 +107,9 @@ impl ArrayBuilder for StructBuilder { Nullability::Nullable => Validity::Array(self.validity.finish()?), }; - Ok(StructArray::try_new( - self.struct_dtype.names().clone(), - fields, - self.len(), - validity, - )? - .into_array()) + Ok( + StructArray::try_new(self.struct_dtype.names().clone(), fields, len, validity)? + .into_array(), + ) } }