Function between

Source
pub fn between(
    arr: &dyn Array,
    lower: &dyn Array,
    upper: &dyn Array,
    options: &BetweenOptions,
) -> VortexResult<ArrayRef>
Expand description

Compute between (a <= x <= b), this can be implemented using compare and boolean and but this will likely have a lower runtime.

This semantics is equivalent to:

use vortex_array::{Array, ArrayRef};
use vortex_array::compute::{binary_boolean, compare, BetweenOptions, BinaryOperator, Operator};///
use vortex_error::VortexResult;

fn between(
   arr: &dyn Array,
   lower: &dyn Array,
   upper: &dyn Array,
   options: &BetweenOptions
) -> VortexResult<ArrayRef> {
    binary_boolean(
        &compare(lower, arr, options.lower_strict.to_operator())?,
        &compare(arr, upper,  options.upper_strict.to_operator())?,
        BinaryOperator::And
    )
}

The BetweenOptions { lower: StrictComparison, upper: StrictComparison } defines if the value is < (strict) or <= (non-strict).