Skip to content

Commit 1f61d99

Browse files
feat[array]: fixup operator stuff (#5711)
simple fixes from #5704 Signed-off-by: Joe Isaacs <[email protected]>
1 parent 4e28866 commit 1f61d99

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

encodings/fsst/src/array.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use vortex_buffer::BufferHandle;
4242
use vortex_dtype::DType;
4343
use vortex_dtype::Nullability;
4444
use vortex_dtype::PType;
45-
use vortex_error::VortexExpect;
4645
use vortex_error::VortexResult;
4746
use vortex_error::vortex_bail;
4847
use vortex_error::vortex_ensure;
@@ -157,7 +156,10 @@ impl VTable for FSSTVTable {
157156
);
158157

159158
let mut children_iter = children.into_iter();
160-
let codes = children_iter.next().vortex_expect("codes child");
159+
let codes = children_iter
160+
.next()
161+
.ok_or_else(|| vortex_err!("FSSTArray with_children missing codes"))?;
162+
161163
let codes = codes
162164
.as_opt::<VarBinVTable>()
163165
.ok_or_else(|| {
@@ -169,7 +171,7 @@ impl VTable for FSSTVTable {
169171
.clone();
170172
let uncompressed_lengths = children_iter
171173
.next()
172-
.vortex_expect("uncompressed_lengths child");
174+
.ok_or_else(|| vortex_err!("FSSTArray with_children missing uncompressed_lengths"))?;
173175

174176
array.codes = codes;
175177
array.uncompressed_lengths = uncompressed_lengths;

vortex-array/src/arrays/bool/vtable/operator.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ impl ArrayParentReduceRule<Exact<BoolVTable>, Exact<MaskedVTable>> for BoolMaske
3333
&self,
3434
array: &BoolArray,
3535
parent: &MaskedArray,
36-
_child_idx: usize,
36+
child_idx: usize,
3737
) -> VortexResult<Option<ArrayRef>> {
38+
if child_idx > 0 {
39+
return Ok(None);
40+
}
41+
3842
// Merge the parent's validity mask into the child's validity
3943
// TODO(joe): make this lazy
4044
Ok(Some(

vortex-vector/src/listview/vector.rs

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

335-
fn slice(&self, _range: impl RangeBounds<usize> + Clone + Debug) -> Self {
336-
todo!()
335+
fn slice(&self, range: impl RangeBounds<usize> + Clone + Debug) -> Self {
336+
let offsets = self.offsets.slice(range.clone());
337+
let sizes = self.sizes.slice(range);
338+
// SAFETY: offsets/sizes combined still point at valid elements
339+
unsafe {
340+
Self::new_unchecked(
341+
self.elements().clone(),
342+
offsets,
343+
sizes,
344+
self.validity().clone(),
345+
)
346+
}
337347
}
338348

339349
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(..) => ListViewVectorMut::with_capacity(dtype, capacity).into(),
89+
DType::List(elem, ..) => {
90+
ListViewVectorMut::with_capacity(elem.as_ref(), capacity).into()
91+
}
9092
}
9193
}
9294
}

0 commit comments

Comments
 (0)