Skip to content

Commit b66783b

Browse files
committed
all better
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 74a63f8 commit b66783b

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

encodings/fastlanes/src/bitpacking/vtable/operations.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ impl OperationsVTable<BitPacked> for BitPacked {
3131
#[cfg(test)]
3232
mod test {
3333
use std::ops::Range;
34-
use std::sync::LazyLock;
3534

3635
use vortex_array::DynArray;
3736
use vortex_array::IntoArray;
38-
use vortex_array::VortexSessionExecute;
3937
use vortex_array::arrays::PrimitiveArray;
4038
use vortex_array::arrays::SliceArray;
4139
use vortex_array::assert_arrays_eq;
@@ -46,7 +44,6 @@ mod test {
4644
use vortex_array::dtype::PType;
4745
use vortex_array::patches::Patches;
4846
use vortex_array::scalar::Scalar;
49-
use vortex_array::session::ArraySession;
5047
use vortex_array::validity::Validity;
5148
use vortex_buffer::Alignment;
5249
use vortex_buffer::Buffer;
@@ -56,16 +53,12 @@ mod test {
5653
use crate::BitPacked;
5754
use crate::BitPackedArray;
5855

59-
static SESSION: LazyLock<vortex_session::VortexSession> =
60-
LazyLock::new(|| vortex_session::VortexSession::empty().with::<ArraySession>());
61-
62-
fn slice_via_kernel(array: &BitPackedArray, range: Range<usize>) -> BitPackedArray {
56+
fn slice_via_reduce(array: &BitPackedArray, range: Range<usize>) -> BitPackedArray {
6357
let array_ref = array.clone().into_array();
6458
let slice_array = SliceArray::new(array_ref.clone(), range);
65-
let mut ctx = SESSION.create_execution_ctx();
6659
let sliced = array_ref
6760
.vtable()
68-
.execute_parent(&array_ref, &slice_array.into_array(), 0, &mut ctx)
61+
.reduce_parent(&array_ref, &slice_array.into_array(), 0)
6962
.expect("execute_parent failed")
7063
.expect("expected slice kernel to execute");
7164
sliced.as_::<BitPacked>().clone()
@@ -78,7 +71,7 @@ mod test {
7871
6,
7972
)
8073
.unwrap();
81-
let sliced = slice_via_kernel(&arr, 1024..2048);
74+
let sliced = slice_via_reduce(&arr, 1024..2048);
8275
assert_nth_scalar!(sliced, 0, 1024u32 % 64);
8376
assert_nth_scalar!(sliced, 1023, 2047u32 % 64);
8477
assert_eq!(sliced.offset(), 0);
@@ -92,7 +85,7 @@ mod test {
9285
6,
9386
)
9487
.unwrap();
95-
let sliced = slice_via_kernel(&arr, 512..1434);
88+
let sliced = slice_via_reduce(&arr, 512..1434);
9689
assert_nth_scalar!(sliced, 0, 512u32 % 64);
9790
assert_nth_scalar!(sliced, 921, 1433u32 % 64);
9891
assert_eq!(sliced.offset(), 512);
@@ -132,12 +125,12 @@ mod test {
132125
6,
133126
)
134127
.unwrap();
135-
let sliced = slice_via_kernel(&arr, 512..1434);
128+
let sliced = slice_via_reduce(&arr, 512..1434);
136129
assert_nth_scalar!(sliced, 0, 512u32 % 64);
137130
assert_nth_scalar!(sliced, 921, 1433u32 % 64);
138131
assert_eq!(sliced.offset(), 512);
139132
assert_eq!(sliced.len(), 922);
140-
let doubly_sliced = slice_via_kernel(&sliced, 127..911);
133+
let doubly_sliced = slice_via_reduce(&sliced, 127..911);
141134
assert_nth_scalar!(doubly_sliced, 0, (512u32 + 127) % 64);
142135
assert_nth_scalar!(doubly_sliced, 783, (512u32 + 910) % 64);
143136
assert_eq!(doubly_sliced.offset(), 639);
@@ -155,7 +148,7 @@ mod test {
155148
assert_eq!(patch_indices.len(), 1);
156149

157150
// Slicing drops the empty patches array.
158-
let sliced_bp = slice_via_kernel(&array, 0..64);
151+
let sliced_bp = slice_via_reduce(&array, 0..64);
159152
assert!(sliced_bp.patches().is_none());
160153
}
161154

0 commit comments

Comments
 (0)