Skip to content

Commit 10a2e56

Browse files
committed
more fixes for gharchive
Signed-off-by: Andrew Duffy <[email protected]>
1 parent 04b745a commit 10a2e56

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

encodings/fsst/src/array.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use vortex_array::DeserializeMetadata;
2121
use vortex_array::Precision;
2222
use vortex_array::ProstMetadata;
2323
use vortex_array::SerializeMetadata;
24+
use vortex_array::ToCanonical;
2425
use vortex_array::arrays::VarBinArray;
2526
use vortex_array::arrays::VarBinVTable;
2627
use vortex_array::serde::ArrayChildren;
@@ -42,7 +43,6 @@ use vortex_buffer::BufferHandle;
4243
use vortex_dtype::DType;
4344
use vortex_dtype::Nullability;
4445
use vortex_dtype::PType;
45-
use vortex_error::VortexExpect;
4646
use vortex_error::VortexResult;
4747
use vortex_error::vortex_bail;
4848
use vortex_error::vortex_ensure;
@@ -157,7 +157,10 @@ impl VTable for FSSTVTable {
157157
);
158158

159159
let mut children_iter = children.into_iter();
160-
let codes = children_iter.next().vortex_expect("codes child");
160+
let codes = children_iter
161+
.next()
162+
.ok_or_else(|| vortex_err!("FSSTArray with_children missing codes"))?;
163+
161164
let codes = codes
162165
.as_opt::<VarBinVTable>()
163166
.ok_or_else(|| {
@@ -169,7 +172,7 @@ impl VTable for FSSTVTable {
169172
.clone();
170173
let uncompressed_lengths = children_iter
171174
.next()
172-
.vortex_expect("uncompressed_lengths child");
175+
.ok_or_else(|| vortex_err!("FSSTArray with_children missing uncompressed_lengths"))?;
173176

174177
array.codes = codes;
175178
array.uncompressed_lengths = uncompressed_lengths;

vortex-layout/src/layouts/struct_/reader.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use vortex_array::ArrayRef;
1212
use vortex_array::IntoArray;
1313
use vortex_array::MaskFuture;
1414
use vortex_array::ToCanonical;
15+
use vortex_array::arrays::MaskedArray;
1516
use vortex_array::arrays::StructArray;
17+
use vortex_array::builtins::ArrayBuiltins;
1618
use vortex_array::expr::ExactExpr;
1719
use vortex_array::expr::Expression;
1820
use vortex_array::expr::Merge;
@@ -24,6 +26,7 @@ use vortex_array::expr::transform::PartitionedExpr;
2426
use vortex_array::expr::transform::partition;
2527
use vortex_array::expr::transform::replace;
2628
use vortex_array::expr::transform::replace_root_fields;
29+
use vortex_array::validity::Validity;
2730
use vortex_array::vtable::ValidityHelper;
2831
use vortex_dtype::DType;
2932
use vortex_dtype::FieldMask;
@@ -343,15 +346,14 @@ impl LayoutReader for StructReader {
343346
Ok(Box::pin(async move {
344347
if let Some(validity_fut) = validity_fut {
345348
let (array, validity) = try_join!(projected, validity_fut)?;
346-
let mask = Mask::from_buffer(validity.to_bool().bit_buffer().not());
347349

348350
// If root expression was a pack, then we apply the validity to each child field
349351
if is_pack_merge {
350352
let struct_array = array.to_struct();
351353
let masked_fields: Vec<ArrayRef> = struct_array
352354
.fields()
353355
.iter()
354-
.map(|a| vortex_array::compute::mask(a.as_ref(), &mask))
356+
.map(|a| a.mask(&validity))
355357
.try_collect()?;
356358

357359
Ok(StructArray::try_new(
@@ -364,7 +366,7 @@ impl LayoutReader for StructReader {
364366
} else {
365367
// If the root expression was not a pack or merge, e.g. if it's something like
366368
// a get_item, then we apply the validity directly to the result
367-
vortex_array::compute::mask(array.as_ref(), &mask)
369+
array.mask(&validity)
368370
}
369371
} else {
370372
projected.await

vortex-vector/src/listview/vector.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,18 @@ impl VectorOps for ListViewVector {
227227
ListViewScalar::new(self.slice(index..index + 1))
228228
}
229229

230-
fn slice(&self, _range: impl RangeBounds<usize> + Clone + Debug) -> Self {
231-
todo!()
230+
fn slice(&self, range: impl RangeBounds<usize> + Clone + Debug) -> Self {
231+
let offsets = self.offsets.slice(range.clone());
232+
let sizes = self.sizes.slice(range);
233+
// SAFETY: offsets/sizes combined still point at valid elements
234+
unsafe {
235+
Self::new_unchecked(
236+
self.elements().clone(),
237+
offsets,
238+
sizes,
239+
self.validity().clone(),
240+
)
241+
}
232242
}
233243

234244
fn clear(&mut self) {

vortex-vector/src/vector_mut.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ impl VectorMut {
8686
DType::Utf8(..) => StringVectorMut::with_capacity(capacity).into(),
8787
DType::Binary(..) => BinaryVectorMut::with_capacity(capacity).into(),
8888
DType::Extension(ext) => VectorMut::with_capacity(ext.storage_dtype(), capacity),
89-
DType::List(elem, ..) => ListViewVectorMut::with_capacity(elem.as_ref(), capacity).into(),
89+
DType::List(elem, ..) => {
90+
ListViewVectorMut::with_capacity(elem.as_ref(), capacity).into()
91+
}
9092
}
9193
}
9294
}

0 commit comments

Comments
 (0)