apply_cmp

Function apply_cmp 

Source
pub fn apply_cmp<T>(
    lhs: &[T],
    rhs: &[T],
    mask: Option<&Bitmask>,
    op: ComparisonOperator,
) -> Result<BooleanArray<()>, KernelError>
where T: Numeric + Copy + Hash + Eq + PartialOrd + 'static,
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 comparison
  • rhs - Right-hand side numeric array for comparison
  • mask - Optional bitmask indicating valid elements in input arrays
  • op - 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 IN for membership testing
  • Range operations: BETWEEN for range inclusion testing
  • Null operations: IS NULL, IS NOT NULL for 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]