Skip to content

Commit 240403b

Browse files
authored
Remove Operator VTable (#5588)
This PR moves the execute function onto the main Array trait, and then removes the old operator vtable / bind experiments. --------- Signed-off-by: Nicholas Gates <[email protected]>
1 parent 208d8bc commit 240403b

File tree

77 files changed

+151
-2939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+151
-2939
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

encodings/alp/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ vortex-error = { workspace = true }
2828
vortex-fastlanes = { workspace = true }
2929
vortex-mask = { workspace = true }
3030
vortex-scalar = { workspace = true }
31+
vortex-session = { workspace = true }
3132
vortex-utils = { workspace = true }
3233
vortex-vector = { workspace = true }
3334

encodings/alp/benches/alp_compress.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,6 @@ fn decompress_alp<T: ALPFloat + NativePType>(bencher: Bencher, args: (usize, f64
100100
.bench_values(decompress_into_array);
101101
}
102102

103-
#[divan::bench(types = [f32, f64], args = BENCH_ARGS)]
104-
fn decompress_alp_vector<T: ALPFloat + NativePType>(bencher: Bencher, args: (usize, f64, f64)) {
105-
let (n, fraction_patch, fraction_valid) = args;
106-
let mut rng = StdRng::seed_from_u64(0);
107-
let mut values = buffer![T::from(1.234).unwrap(); n].into_mut();
108-
if fraction_patch > 0.0 {
109-
for index in 0..values.len() {
110-
if rng.random_bool(fraction_patch) {
111-
values[index] = T::from(1000.0).unwrap()
112-
}
113-
}
114-
}
115-
let validity = if fraction_valid < 1.0 {
116-
Validity::from_iter((0..values.len()).map(|_| rng.random_bool(fraction_valid)))
117-
} else {
118-
Validity::NonNullable
119-
};
120-
let values = values.freeze();
121-
bencher
122-
.with_inputs(|| {
123-
let alp_array = alp_encode(
124-
&PrimitiveArray::new(Buffer::copy_from(&values), validity.clone()),
125-
None,
126-
)
127-
.unwrap();
128-
alp_array.to_array()
129-
})
130-
.bench_refs(|array| array.execute().unwrap());
131-
}
132-
133103
#[divan::bench(types = [f32, f64], args = [10_000, 100_000])]
134104
fn compress_rd<T: ALPRDFloat>(bencher: Bencher, n: usize) {
135105
let primitive = PrimitiveArray::new(buffer![T::from(1.23).unwrap(); n], Validity::NonNullable);

encodings/alp/src/alp/array.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ impl VTable for ALPVTable {
6464
type VisitorVTable = Self;
6565
type ComputeVTable = NotSupported;
6666
type EncodeVTable = Self;
67-
type OperatorVTable = NotSupported;
6867

6968
fn id(&self) -> ArrayId {
7069
ArrayId::new_ref("vortex.alp")
@@ -141,17 +140,17 @@ impl VTable for ALPVTable {
141140
)
142141
}
143142

144-
fn execute(array: &ALPArray, ctx: &mut dyn ExecutionCtx) -> VortexResult<Vector> {
145-
let encoded_vector = array.encoded().execute_batch(ctx)?;
143+
fn batch_execute(array: &ALPArray, ctx: &mut ExecutionCtx) -> VortexResult<Vector> {
144+
let encoded_vector = array.encoded().batch_execute(ctx)?;
146145

147146
let patches_vectors = if let Some(patches) = array.patches() {
148147
Some((
149-
patches.indices().execute_batch(ctx)?,
150-
patches.values().execute_batch(ctx)?,
148+
patches.indices().batch_execute(ctx)?,
149+
patches.values().batch_execute(ctx)?,
151150
patches
152151
.chunk_offsets()
153152
.as_ref()
154-
.map(|co| co.execute_batch(ctx))
153+
.map(|co| co.batch_execute(ctx))
155154
.transpose()?,
156155
))
157156
} else {
@@ -454,15 +453,19 @@ impl VisitorVTable<ALPVTable> for ALPVTable {
454453
#[cfg(test)]
455454
mod tests {
456455
use std::f64::consts::PI;
456+
use std::sync::LazyLock;
457457

458458
use rstest::rstest;
459459
use vortex_array::arrays::PrimitiveArray;
460460
use vortex_array::vtable::ValidityHelper;
461461
use vortex_dtype::PTypeDowncast;
462+
use vortex_session::VortexSession;
462463
use vortex_vector::VectorOps;
463464

464465
use super::*;
465466

467+
static SESSION: LazyLock<VortexSession> = LazyLock::new(VortexSession::empty);
468+
466469
#[rstest]
467470
#[case(0)]
468471
#[case(1)]
@@ -477,7 +480,7 @@ mod tests {
477480
let values = PrimitiveArray::from_iter((0..size).map(|i| i as f32));
478481
let encoded = alp_encode(&values, None).unwrap();
479482

480-
let result_vector = encoded.to_array().execute().unwrap();
483+
let result_vector = encoded.to_array().execute(&SESSION).unwrap();
481484
// Compare against the traditional array-based decompress path
482485
let expected = decompress_into_array(encoded);
483486

@@ -501,7 +504,7 @@ mod tests {
501504
let values = PrimitiveArray::from_iter((0..size).map(|i| i as f64));
502505
let encoded = alp_encode(&values, None).unwrap();
503506

504-
let result_vector = encoded.to_array().execute().unwrap();
507+
let result_vector = encoded.to_array().execute(&SESSION).unwrap();
505508
// Compare against the traditional array-based decompress path
506509
let expected = decompress_into_array(encoded);
507510

@@ -531,7 +534,7 @@ mod tests {
531534
let encoded = alp_encode(&array, None).unwrap();
532535
assert!(encoded.patches().unwrap().array_len() > 0);
533536

534-
let result_vector = encoded.to_array().execute().unwrap();
537+
let result_vector = encoded.to_array().execute(&SESSION).unwrap();
535538
// Compare against the traditional array-based decompress path
536539
let expected = decompress_into_array(encoded);
537540

@@ -559,7 +562,7 @@ mod tests {
559562
let array = PrimitiveArray::from_option_iter(values);
560563
let encoded = alp_encode(&array, None).unwrap();
561564

562-
let result_vector = encoded.to_array().execute().unwrap();
565+
let result_vector = encoded.to_array().execute(&SESSION).unwrap();
563566
// Compare against the traditional array-based decompress path
564567
let expected = decompress_into_array(encoded);
565568

@@ -598,7 +601,7 @@ mod tests {
598601
let encoded = alp_encode(&array, None).unwrap();
599602
assert!(encoded.patches().unwrap().array_len() > 0);
600603

601-
let result_vector = encoded.to_array().execute().unwrap();
604+
let result_vector = encoded.to_array().execute(&SESSION).unwrap();
602605
// Compare against the traditional array-based decompress path
603606
let expected = decompress_into_array(encoded);
604607

@@ -640,7 +643,7 @@ mod tests {
640643
let slice_len = slice_end - slice_start;
641644
let sliced_encoded = encoded.slice(slice_start..slice_end);
642645

643-
let result_vector = sliced_encoded.execute().unwrap();
646+
let result_vector = sliced_encoded.execute(&SESSION).unwrap();
644647
let result_primitive = result_vector.into_primitive().into_f64();
645648

646649
for idx in 0..slice_len {

encodings/alp/src/alp_rd/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ impl VTable for ALPRDVTable {
7777
type VisitorVTable = Self;
7878
type ComputeVTable = NotSupported;
7979
type EncodeVTable = Self;
80-
type OperatorVTable = NotSupported;
8180

8281
fn id(&self) -> ArrayId {
8382
ArrayId::new_ref("vortex.alprd")

encodings/bytebool/src/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ impl VTable for ByteBoolVTable {
5454
type VisitorVTable = Self;
5555
type ComputeVTable = NotSupported;
5656
type EncodeVTable = NotSupported;
57-
type OperatorVTable = NotSupported;
5857

5958
fn id(&self) -> ArrayId {
6059
ArrayId::new_ref("vortex.bytebool")

encodings/datetime-parts/src/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl VTable for DateTimePartsVTable {
8282
type VisitorVTable = Self;
8383
type ComputeVTable = NotSupported;
8484
type EncodeVTable = Self;
85-
type OperatorVTable = NotSupported;
8685

8786
fn id(&self) -> ArrayId {
8887
ArrayId::new_ref("vortex.datetimeparts")

encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl VTable for DecimalBytePartsVTable {
6969
type VisitorVTable = Self;
7070
type ComputeVTable = NotSupported;
7171
type EncodeVTable = NotSupported;
72-
type OperatorVTable = NotSupported;
7372

7473
fn id(&self) -> ArrayId {
7574
ArrayId::new_ref("vortex.decimal_byte_parts")

encodings/fastlanes/Cargo.toml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ vortex-dtype = { workspace = true }
3434
vortex-error = { workspace = true }
3535
vortex-mask = { workspace = true }
3636
vortex-scalar = { workspace = true }
37+
vortex-session = { workspace = true }
3738
vortex-utils = { workspace = true }
3839
vortex-vector = { workspace = true }
3940

@@ -67,28 +68,3 @@ required-features = ["test-harness"]
6768
name = "compute_between"
6869
harness = false
6970
required-features = ["test-harness"]
70-
71-
[[bench]]
72-
name = "pipeline_bitpacking"
73-
harness = false
74-
test = false
75-
76-
[[bench]]
77-
name = "pipeline_for"
78-
harness = false
79-
test = false
80-
81-
[[bench]]
82-
name = "pipeline_bitpacking_compare_scalar"
83-
harness = false
84-
test = false
85-
86-
[[bench]]
87-
name = "pipeline_rle"
88-
harness = false
89-
test = false
90-
91-
[[bench]]
92-
name = "pipeline_v2_bitpacking_basic"
93-
harness = false
94-
test = false

encodings/fastlanes/benches/pipeline_bitpacking.rs

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)