pub fn apply_cmp<T>(
lhs: &[T],
rhs: &[T],
mask: Option<&Bitmask>,
op: ComparisonOperator,
) -> Result<BooleanArray<()>, KernelError>Expand description
Applies comparison operations between numeric arrays with comprehensive operator support.
Performs element-wise comparison operations between two numeric arrays using the specified comparison operator. Supports the full range of SQL comparison semantics including set membership operations and null-aware comparisons.
§Parameters
lhs- Left-hand side numeric array for comparisonrhs- Right-hand side numeric array for comparisonmask- Optional bitmask indicating valid elements in input arraysop- Comparison operator defining the comparison semantics to apply
§Returns
Returns Result<BooleanArray<()>, KernelError> containing:
- Success: Boolean array with comparison results
- Error: KernelError if comparison operation fails
§Supported Operations
- Basic comparisons:
<,<=,>,>=,==,!= - Set operations:
IN,NOT INfor membership testing - Range operations:
BETWEENfor range inclusion testing - Null operations:
IS NULL,IS NOT NULLfor null checking
§Examples
ⓘ
use simd_kernels::kernels::binary::apply_cmp;
use simd_kernels::operators::ComparisonOperator;
let lhs = [1, 2, 3, 4];
let rhs = [2, 2, 2, 2];
let result = apply_cmp(&lhs, &rhs, None, ComparisonOperator::LessThan).unwrap();
// Result: [true, false, false, false]