Skip to content
Merged
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
8 changes: 4 additions & 4 deletions encodings/alp/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ impl vortex_array::compute::between::BetweenKernel for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::between(&self, array: &vortex_alp::ALPArray, lower: &dyn vortex_array::array::Array, upper: &dyn vortex_array::array::Array, options: &vortex_array::compute::between::BetweenOptions) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::compare::CompareKernel for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::compare(&self, lhs: &vortex_alp::ALPArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::mask::MaskKernel for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::mask(&self, array: &vortex_alp::ALPArray, filter_mask: &vortex_mask::Mask) -> vortex_error::VortexResult<vortex_array::array::ArrayRef>
Expand All @@ -268,6 +264,10 @@ impl vortex_array::compute::nan_count::NaNCountKernel for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::nan_count(&self, array: &vortex_alp::ALPArray) -> vortex_error::VortexResult<usize>

impl vortex_array::expr::exprs::binary::compare::CompareKernel for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::compare(lhs: &vortex_alp::ALPArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::expr::exprs::cast::kernel::CastReduce for vortex_alp::ALPVTable

pub fn vortex_alp::ALPVTable::cast(array: &vortex_alp::ALPArray, dtype: &vortex_dtype::dtype::DType) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
Expand Down
9 changes: 3 additions & 6 deletions encodings/alp/src/alp/compute/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use std::fmt::Debug;

use vortex_array::Array;
use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::arrays::ConstantArray;
use vortex_array::compute::CompareKernel;
use vortex_array::compute::CompareKernelAdapter;
use vortex_array::compute::Operator;
use vortex_array::compute::compare;
use vortex_array::register_kernel;
use vortex_array::expr::CompareKernel;
use vortex_dtype::NativePType;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
Expand All @@ -27,10 +26,10 @@ use crate::match_each_alp_float_ptype;

impl CompareKernel for ALPVTable {
fn compare(
&self,
lhs: &ALPArray,
rhs: &dyn Array,
operator: Operator,
_ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
if lhs.patches().is_some() {
// TODO(joe): support patches
Expand Down Expand Up @@ -66,8 +65,6 @@ impl CompareKernel for ALPVTable {
}
}

register_kernel!(CompareKernelAdapter(ALPVTable).lift());

/// We can compare a scalar to an ALPArray by encoding the scalar into the ALP domain and comparing
/// the encoded value to the encoded values in the ALPArray. There are fixups when the value doesn't
/// encode into the ALP domain.
Expand Down
2 changes: 2 additions & 0 deletions encodings/alp/src/alp/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ use vortex_array::arrays::FilterExecuteAdaptor;
use vortex_array::arrays::SliceExecuteAdaptor;
use vortex_array::arrays::TakeExecuteAdaptor;
use vortex_array::compute::CastReduceAdaptor;
use vortex_array::expr::CompareExecuteAdaptor;
use vortex_array::kernel::ParentKernelSet;
use vortex_array::optimizer::rules::ParentRuleSet;

use crate::ALPVTable;

pub(super) const PARENT_KERNELS: ParentKernelSet<ALPVTable> = ParentKernelSet::new(&[
ParentKernelSet::lift(&CompareExecuteAdaptor(ALPVTable)),
ParentKernelSet::lift(&FilterExecuteAdaptor(ALPVTable)),
ParentKernelSet::lift(&SliceExecuteAdaptor(ALPVTable)),
ParentKernelSet::lift(&TakeExecuteAdaptor(ALPVTable)),
Expand Down
8 changes: 4 additions & 4 deletions encodings/datetime-parts/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ impl vortex_array::arrays::slice::SliceReduce for vortex_datetime_parts::DateTim

pub fn vortex_datetime_parts::DateTimePartsVTable::slice(array: &Self::Array, range: core::ops::range::Range<usize>) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::compare::CompareKernel for vortex_datetime_parts::DateTimePartsVTable

pub fn vortex_datetime_parts::DateTimePartsVTable::compare(&self, lhs: &vortex_datetime_parts::DateTimePartsArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::is_constant::IsConstantKernel for vortex_datetime_parts::DateTimePartsVTable

pub fn vortex_datetime_parts::DateTimePartsVTable::is_constant(&self, array: &vortex_datetime_parts::DateTimePartsArray, opts: &vortex_array::compute::is_constant::IsConstantOpts) -> vortex_error::VortexResult<core::option::Option<bool>>
Expand All @@ -126,6 +122,10 @@ impl vortex_array::compute::mask::MaskKernel for vortex_datetime_parts::DateTime

pub fn vortex_datetime_parts::DateTimePartsVTable::mask(&self, array: &vortex_datetime_parts::DateTimePartsArray, mask_array: &vortex_mask::Mask) -> vortex_error::VortexResult<vortex_array::array::ArrayRef>

impl vortex_array::expr::exprs::binary::compare::CompareKernel for vortex_datetime_parts::DateTimePartsVTable

pub fn vortex_datetime_parts::DateTimePartsVTable::compare(lhs: &vortex_datetime_parts::DateTimePartsArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::expr::exprs::cast::kernel::CastReduce for vortex_datetime_parts::DateTimePartsVTable

pub fn vortex_datetime_parts::DateTimePartsVTable::cast(array: &vortex_datetime_parts::DateTimePartsArray, dtype: &vortex_dtype::dtype::DType) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
Expand Down
11 changes: 3 additions & 8 deletions encodings/datetime-parts/src/compute/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

use vortex_array::Array;
use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::arrays::ConstantArray;
use vortex_array::builtins::ArrayBuiltins;
use vortex_array::compute::CompareKernel;
use vortex_array::compute::CompareKernelAdapter;
use vortex_array::compute::Operator;
use vortex_array::compute::and_kleene;
use vortex_array::compute::compare;
use vortex_array::compute::or_kleene;
use vortex_array::register_kernel;
use vortex_array::expr::CompareKernel;
use vortex_dtype::DType;
use vortex_dtype::Nullability;
use vortex_dtype::datetime::Timestamp;
Expand All @@ -24,13 +23,11 @@ use crate::array::DateTimePartsVTable;
use crate::timestamp;

impl CompareKernel for DateTimePartsVTable {
/// Compares two arrays and returns a new boolean array with the result of the comparison.
/// Or, returns None if comparison is not supported.
fn compare(
&self,
lhs: &DateTimePartsArray,
rhs: &dyn Array,
operator: Operator,
_ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let Some(rhs_const) = rhs.as_constant() else {
return Ok(None);
Expand Down Expand Up @@ -71,8 +68,6 @@ impl CompareKernel for DateTimePartsVTable {
}
}

register_kernel!(CompareKernelAdapter(DateTimePartsVTable).lift());

fn compare_eq(
lhs: &DateTimePartsArray,
ts_parts: &timestamp::TimestampParts,
Expand Down
9 changes: 5 additions & 4 deletions encodings/datetime-parts/src/compute/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use vortex_array::arrays::TakeExecuteAdaptor;
use vortex_array::expr::CompareExecuteAdaptor;
use vortex_array::kernel::ParentKernelSet;

use crate::DateTimePartsVTable;

pub(crate) const PARENT_KERNELS: ParentKernelSet<DateTimePartsVTable> =
ParentKernelSet::new(&[ParentKernelSet::lift(&TakeExecuteAdaptor(
DateTimePartsVTable,
))]);
pub(crate) const PARENT_KERNELS: ParentKernelSet<DateTimePartsVTable> = ParentKernelSet::new(&[
ParentKernelSet::lift(&CompareExecuteAdaptor(DateTimePartsVTable)),
ParentKernelSet::lift(&TakeExecuteAdaptor(DateTimePartsVTable)),
]);
8 changes: 4 additions & 4 deletions encodings/decimal-byte-parts/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ impl vortex_array::arrays::slice::SliceReduce for vortex_decimal_byte_parts::Dec

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::slice(array: &vortex_decimal_byte_parts::DecimalBytePartsArray, range: core::ops::range::Range<usize>) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::compare::CompareKernel for vortex_decimal_byte_parts::DecimalBytePartsVTable

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::compare(&self, lhs: &Self::Array, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::is_constant::IsConstantKernel for vortex_decimal_byte_parts::DecimalBytePartsVTable

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::is_constant(&self, array: &vortex_decimal_byte_parts::DecimalBytePartsArray, opts: &vortex_array::compute::is_constant::IsConstantOpts) -> vortex_error::VortexResult<core::option::Option<bool>>
Expand All @@ -76,6 +72,10 @@ impl vortex_array::compute::mask::MaskKernel for vortex_decimal_byte_parts::Deci

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::mask(&self, array: &vortex_decimal_byte_parts::DecimalBytePartsArray, mask_array: &vortex_mask::Mask) -> vortex_error::VortexResult<vortex_array::array::ArrayRef>

impl vortex_array::expr::exprs::binary::compare::CompareKernel for vortex_decimal_byte_parts::DecimalBytePartsVTable

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::compare(lhs: &Self::Array, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::expr::exprs::cast::kernel::CastReduce for vortex_decimal_byte_parts::DecimalBytePartsVTable

pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::cast(array: &vortex_decimal_byte_parts::DecimalBytePartsArray, dtype: &vortex_dtype::dtype::DType) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use Sign::Negative;
use num_traits::NumCast;
use vortex_array::Array;
use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::arrays::ConstantArray;
use vortex_array::compute::CompareKernel;
use vortex_array::compute::CompareKernelAdapter;
use vortex_array::compute::Operator;
use vortex_array::compute::compare;
use vortex_array::register_kernel;
use vortex_array::expr::CompareKernel;
use vortex_dtype::IntegerPType;
use vortex_dtype::Nullability;
use vortex_dtype::PType;
Expand All @@ -28,10 +27,10 @@ use crate::decimal_byte_parts::compute::compare::Sign::Positive;

impl CompareKernel for DecimalBytePartsVTable {
fn compare(
&self,
lhs: &Self::Array,
rhs: &dyn Array,
operator: Operator,
_ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let Some(rhs_const) = rhs.as_constant() else {
return Ok(None);
Expand Down Expand Up @@ -132,8 +131,6 @@ where
})
}

register_kernel!(CompareKernelAdapter(DecimalBytePartsVTable).lift());

#[cfg(test)]
mod tests {
use vortex_array::Array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use vortex_array::arrays::TakeExecuteAdaptor;
use vortex_array::expr::CompareExecuteAdaptor;
use vortex_array::kernel::ParentKernelSet;

use crate::DecimalBytePartsVTable;

pub(crate) const PARENT_KERNELS: ParentKernelSet<DecimalBytePartsVTable> =
ParentKernelSet::new(&[ParentKernelSet::lift(&TakeExecuteAdaptor(
DecimalBytePartsVTable,
))]);
pub(crate) const PARENT_KERNELS: ParentKernelSet<DecimalBytePartsVTable> = ParentKernelSet::new(&[
ParentKernelSet::lift(&CompareExecuteAdaptor(DecimalBytePartsVTable)),
ParentKernelSet::lift(&TakeExecuteAdaptor(DecimalBytePartsVTable)),
]);
8 changes: 4 additions & 4 deletions encodings/fastlanes/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,6 @@ impl vortex_array::arrays::slice::SliceReduce for vortex_fastlanes::FoRVTable

pub fn vortex_fastlanes::FoRVTable::slice(array: &Self::Array, range: core::ops::range::Range<usize>) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::compare::CompareKernel for vortex_fastlanes::FoRVTable

pub fn vortex_fastlanes::FoRVTable::compare(&self, lhs: &vortex_fastlanes::FoRArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::is_constant::IsConstantKernel for vortex_fastlanes::FoRVTable

pub fn vortex_fastlanes::FoRVTable::is_constant(&self, array: &vortex_fastlanes::FoRArray, opts: &vortex_array::compute::is_constant::IsConstantOpts) -> vortex_error::VortexResult<core::option::Option<bool>>
Expand All @@ -478,6 +474,10 @@ pub fn vortex_fastlanes::FoRVTable::is_sorted(&self, array: &vortex_fastlanes::F

pub fn vortex_fastlanes::FoRVTable::is_strict_sorted(&self, array: &vortex_fastlanes::FoRArray) -> vortex_error::VortexResult<core::option::Option<bool>>

impl vortex_array::expr::exprs::binary::compare::CompareKernel for vortex_fastlanes::FoRVTable

pub fn vortex_fastlanes::FoRVTable::compare(lhs: &vortex_fastlanes::FoRArray, rhs: &dyn vortex_array::array::Array, operator: vortex_array::compute::compare::Operator, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::expr::exprs::cast::kernel::CastReduce for vortex_fastlanes::FoRVTable

pub fn vortex_fastlanes::FoRVTable::cast(array: &vortex_fastlanes::FoRArray, dtype: &vortex_dtype::dtype::DType) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
Expand Down
11 changes: 4 additions & 7 deletions encodings/fastlanes/src/for/compute/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use std::ops::Shr;
use num_traits::WrappingSub;
use vortex_array::Array;
use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::arrays::ConstantArray;
use vortex_array::compute::CompareKernel;
use vortex_array::compute::CompareKernelAdapter;
use vortex_array::compute::Operator;
use vortex_array::compute::compare;
use vortex_array::register_kernel;
use vortex_array::expr::CompareKernel;
use vortex_dtype::NativePType;
use vortex_dtype::Nullability;
use vortex_dtype::match_each_integer_ptype;
Expand All @@ -26,10 +25,10 @@ use crate::FoRVTable;

impl CompareKernel for FoRVTable {
fn compare(
&self,
lhs: &FoRArray,
rhs: &dyn Array,
operator: Operator,
_ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
if let Some(constant) = rhs.as_constant()
&& let Some(constant) = constant.as_primitive_opt()
Expand All @@ -39,7 +38,7 @@ impl CompareKernel for FoRVTable {
lhs,
constant
.typed_value::<T>()
.vortex_expect("null scalar handled in top-level"),
.vortex_expect("null scalar handled in adaptor"),
rhs.dtype().nullability(),
operator,
);
Expand All @@ -50,8 +49,6 @@ impl CompareKernel for FoRVTable {
}
}

register_kernel!(CompareKernelAdapter(FoRVTable).lift());

fn compare_constant<T>(
lhs: &FoRArray,
mut rhs: T,
Expand Down
7 changes: 5 additions & 2 deletions encodings/fastlanes/src/for/vtable/kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use vortex_array::arrays::TakeExecuteAdaptor;
use vortex_array::expr::CompareExecuteAdaptor;
use vortex_array::kernel::ParentKernelSet;

use crate::FoRVTable;

pub(crate) const PARENT_KERNELS: ParentKernelSet<FoRVTable> =
ParentKernelSet::new(&[ParentKernelSet::lift(&TakeExecuteAdaptor(FoRVTable))]);
pub(crate) const PARENT_KERNELS: ParentKernelSet<FoRVTable> = ParentKernelSet::new(&[
ParentKernelSet::lift(&CompareExecuteAdaptor(FoRVTable)),
ParentKernelSet::lift(&TakeExecuteAdaptor(FoRVTable)),
]);
47 changes: 34 additions & 13 deletions encodings/fsst/benches/fsst_compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use rand::Rng;
use rand::SeedableRng;
use rand::rngs::StdRng;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::RecursiveCanonical;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::ChunkedArray;
use vortex_array::arrays::ConstantArray;
Expand Down Expand Up @@ -87,9 +89,18 @@ fn pushdown_compare(bencher: Bencher, (string_count, avg_len, unique_chars): (us
let constant = ConstantArray::new(Scalar::from(&b"const"[..]), array.len());

bencher
.with_inputs(|| (&fsst_array, &constant))
.bench_refs(|(fsst_array, constant)| {
compare(fsst_array.as_ref(), constant.as_ref(), Operator::Eq).unwrap();
.with_inputs(|| {
(
&fsst_array,
&constant,
LEGACY_SESSION.create_execution_ctx(),
)
})
.bench_refs(|(fsst_array, constant, ctx)| {
compare(fsst_array.as_ref(), constant.as_ref(), Operator::Eq)
.unwrap()
.execute::<RecursiveCanonical>(ctx)
.unwrap();
})
}

Expand All @@ -104,14 +115,22 @@ fn canonicalize_compare(
let constant = ConstantArray::new(Scalar::from(&b"const"[..]), array.len());

bencher
.with_inputs(|| (&fsst_array, &constant))
.bench_refs(|(fsst_array, constant)| {
.with_inputs(|| {
(
&fsst_array,
&constant,
LEGACY_SESSION.create_execution_ctx(),
)
})
.bench_refs(|(fsst_array, constant, ctx)| {
compare(
fsst_array.to_canonical().unwrap().as_ref(),
constant.as_ref(),
Operator::Eq,
)
.unwrap()
.execute::<RecursiveCanonical>(ctx)
.unwrap();
});
}

Expand All @@ -135,14 +154,16 @@ fn chunked_canonicalize_into(
) {
let array = generate_chunked_test_data(chunk_size, string_count, avg_len, unique_chars);

bencher.with_inputs(|| &array).bench_refs(|array| {
let mut builder =
VarBinViewBuilder::with_capacity(DType::Binary(Nullability::NonNullable), array.len());
array
.append_to_builder(&mut builder, &mut SESSION.create_execution_ctx())
.unwrap();
builder.finish()
});
bencher
.with_inputs(|| (&array, SESSION.create_execution_ctx()))
.bench_refs(|(array, ctx)| {
let mut builder = VarBinViewBuilder::with_capacity(
DType::Binary(Nullability::NonNullable),
array.len(),
);
array.append_to_builder(&mut builder, ctx).unwrap();
builder.finish()
});
}

#[divan::bench(args = CHUNKED_BENCH_ARGS)]
Expand Down
Loading
Loading