Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vortex-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rstest_reuse = { workspace = true, optional = true }
rustc-hash = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
simdutf8 = { workspace = true }
static_assertions = { workspace = true }
tabled = { workspace = true, optional = true, default-features = false, features = [
"std",
] }
Expand All @@ -68,7 +69,6 @@ vortex-proto = { workspace = true, features = ["expr"] }
vortex-scalar = { workspace = true }
vortex-session = { workspace = true }
vortex-utils = { workspace = true, features = ["dyn-traits"] }
vortex-vector = { workspace = true }

[features]
arbitrary = [
Expand Down
40 changes: 1 addition & 39 deletions vortex-array/benches/take_primitive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! Benchmarks comparing [`PVector`] take vs [`DictArray`] canonicalization.
//! Benchmarks for [`DictArray`] canonicalization.
//!
//! Both are tracked by number of indices/codes for fair comparison.

Expand All @@ -15,10 +15,6 @@ use rand_distr::Zipf;
use vortex_array::IntoArray;
use vortex_array::arrays::DictArray;
use vortex_array::arrays::PrimitiveArray;
use vortex_buffer::Buffer;
use vortex_compute::take::Take;
use vortex_mask::Mask;
use vortex_vector::primitive::PVector;

fn main() {
divan::main();
Expand All @@ -30,40 +26,6 @@ const NUM_INDICES: &[usize] = &[1_000, 10_000, 100_000];
/// Size of the source vector / dictionary values.
const VECTOR_SIZE: &[usize] = &[16, 256, 2048, 8192];

// --- PVector take benchmarks ---

#[divan::bench(args = NUM_INDICES, consts = VECTOR_SIZE, sample_count = 100_000)]
fn pvector_take_uniform<const VECTOR_SIZE: usize>(bencher: Bencher, num_indices: usize) {
let data: Buffer<u32> = (0..VECTOR_SIZE as u32).collect();
let pvector = PVector::new(data, Mask::AllTrue(VECTOR_SIZE));

let rng = StdRng::seed_from_u64(0);
let range = Uniform::new(0u32, VECTOR_SIZE as u32).unwrap();
let indices: Vec<u32> = rng.sample_iter(range).take(num_indices).collect();

bencher
.with_inputs(|| (&pvector, indices.as_slice()))
.bench_refs(|(pv, idx)| pv.take(*idx));
}

#[divan::bench(args = NUM_INDICES, consts = VECTOR_SIZE, sample_count = 100_000)]
fn pvector_take_zipfian<const VECTOR_SIZE: usize>(bencher: Bencher, num_indices: usize) {
let data: Buffer<u32> = (0..VECTOR_SIZE as u32).collect();
let pvector = PVector::new(data, Mask::AllTrue(VECTOR_SIZE));

let rng = StdRng::seed_from_u64(0);
let zipf = Zipf::new(VECTOR_SIZE as f64, 1.0).unwrap();
let indices: Vec<u32> = rng
.sample_iter(&zipf)
.take(num_indices)
.map(|i: f64| (i as u32 - 1).min(VECTOR_SIZE as u32 - 1))
.collect();

bencher
.with_inputs(|| (&pvector, indices.as_slice()))
.bench_refs(|(pv, idx)| pv.take(*idx));
}

// --- DictArray canonicalization benchmarks ---

#[divan::bench(args = NUM_INDICES, consts = VECTOR_SIZE, sample_count = 100_000)]
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/arrays/constant/vtable/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use vortex_scalar::ListScalar;
use vortex_scalar::Scalar;
use vortex_scalar::StructScalar;
use vortex_scalar::Utf8Scalar;
use vortex_vector::binaryview::BinaryView;

use crate::Canonical;
use crate::IntoArray;
Expand All @@ -34,6 +33,7 @@ use crate::arrays::ListViewArray;
use crate::arrays::NullArray;
use crate::arrays::StructArray;
use crate::arrays::VarBinViewArray;
use crate::arrays::build_views::BinaryView;
use crate::arrays::constant::ConstantArray;
use crate::arrays::primitive::PrimitiveArray;
use crate::builders::builder_with_capacity;
Expand Down
6 changes: 2 additions & 4 deletions vortex-array/src/arrays/list/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ fn compute_filtered_elements_and_offsets<O: IntegerPType>(
}

/// Construct an element mask from contiguous list offsets and a selection mask.
pub fn element_mask_from_offsets<O: IntegerPType>(
offsets: &[O],
selection: &Arc<MaskValues>,
) -> Mask {
#[allow(dead_code)]
fn element_mask_from_offsets<O: IntegerPType>(offsets: &[O], selection: &Arc<MaskValues>) -> Mask {
let first_offset = offsets.first().map_or(0, |first_offset| first_offset.as_());
let last_offset = offsets.last().map_or(0, |last_offset| last_offset.as_());
let len = last_offset - first_offset;
Expand Down
2 changes: 0 additions & 2 deletions vortex-array/src/arrays/list/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ mod mask;
mod min_max;
mod take;

pub(super) use filter::element_mask_from_offsets;

#[cfg(test)]
mod tests {
use rstest::rstest;
Expand Down
136 changes: 0 additions & 136 deletions vortex-array/src/arrays/list/vtable/kernel/filter.rs

This file was deleted.

6 changes: 1 addition & 5 deletions vortex-array/src/arrays/list/vtable/kernel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

mod filter;

use crate::arrays::ListVTable;
use crate::arrays::list::vtable::kernel::filter::ListFilterKernel;
use crate::kernel::ParentKernelSet;

pub(super) const PARENT_KERNELS: ParentKernelSet<ListVTable> =
ParentKernelSet::new(&[ParentKernelSet::lift(&ListFilterKernel)]);
pub(super) const PARENT_KERNELS: ParentKernelSet<ListVTable> = ParentKernelSet::new(&[]);
2 changes: 2 additions & 0 deletions vortex-array/src/arrays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ pub use scalar_fn::*;
pub use slice::*;
pub use struct_::*;
pub use varbin::*;
pub use varbinview::build_views;
pub use varbinview::compact;
pub use varbinview::*;
Loading
Loading