Skip to content

Commit

Permalink
Remove MaybeCompare and arrow-compatible compare impls (#1418)
Browse files Browse the repository at this point in the history
* Removes MaybeCompare, in favor of returning
`Result<Option<ArrayData>>` as per #1409
* Removes compare implementations that Arrow already supports, ensures
to call them where we know it's the best option.
  • Loading branch information
gatesn authored Nov 21, 2024
1 parent 710977e commit 9226d70
Show file tree
Hide file tree
Showing 25 changed files with 704 additions and 949 deletions.
36 changes: 2 additions & 34 deletions bench-vortex/src/bin/notimplemented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use vortex::array::{
VarBinViewArray,
};
use vortex::bytebool::ByteBoolArray;
use vortex::compute::Operator;
use vortex::datetime_dtype::{TemporalMetadata, TimeUnit, TIME_ID};
use vortex::datetime_parts::DateTimePartsArray;
use vortex::dict::DictArray;
Expand All @@ -26,15 +25,6 @@ use vortex::validity::Validity;
use vortex::zigzag::ZigZagArray;
use vortex::{ArrayData, IntoArrayData};

const OPERATORS: [Operator; 6] = [
Operator::Lte,
Operator::Lt,
Operator::Gt,
Operator::Gte,
Operator::Eq,
Operator::NotEq,
];

fn fsst_array() -> ArrayData {
let input_array = varbin_array();
let compressor = fsst_train_compressor(&input_array).unwrap();
Expand Down Expand Up @@ -181,6 +171,7 @@ fn compute_funcs(encodings: &[ArrayData]) {
vec![
"Encoding",
"cast",
"compare",
"fill_forward",
"filter",
"scalar_at",
Expand All @@ -196,6 +187,7 @@ fn compute_funcs(encodings: &[ArrayData]) {
for arr in encodings {
let mut impls = vec![Cell::new(arr.encoding().id().as_ref())];
impls.push(bool_to_cell(arr.encoding().cast_fn().is_some()));
impls.push(bool_to_cell(arr.with_dyn(|a| a.compare().is_some())));
impls.push(bool_to_cell(arr.encoding().fill_forward_fn().is_some()));
impls.push(bool_to_cell(arr.encoding().filter_fn().is_some()));
impls.push(bool_to_cell(arr.encoding().scalar_at_fn().is_some()));
Expand All @@ -210,32 +202,8 @@ fn compute_funcs(encodings: &[ArrayData]) {
table.printstd();
}

fn compare_funcs(encodings: &[ArrayData]) {
for arr in encodings {
println!("\nArray {} compare functions", arr.encoding().id().as_ref());
let mut table = Table::new();
table.add_row(Row::new(
[Cell::new("Encoding")]
.into_iter()
.chain(OPERATORS.iter().map(|a| Cell::new(a.to_string().as_ref())))
.collect(),
));
for arr2 in encodings {
let mut impls = vec![Cell::new(arr2.encoding().id().as_ref())];
for op in OPERATORS {
impls.push(bool_to_cell(
arr.with_dyn(|a1| a1.compare(arr2, op).is_some()),
));
}
table.add_row(Row::new(impls));
}
table.printstd();
}
}

fn main() -> ExitCode {
let arrays = enc_impls();
compute_funcs(&arrays);
compare_funcs(&arrays);
ExitCode::SUCCESS
}
236 changes: 0 additions & 236 deletions encodings/alp/src/alp/compute.rs

This file was deleted.

Loading

0 comments on commit 9226d70

Please sign in to comment.