pub fn build_compare(
    left: &dyn Array,
    right: &dyn Array
) -> Result<DynComparator>
Expand description

returns a comparison function that compares values at two different slots between two Array.

Example

use arrow2::array::{ord::build_compare, PrimitiveArray};

let array1 = PrimitiveArray::from_slice([1, 2]);
let array2 = PrimitiveArray::from_slice([3, 4]);

let cmp = build_compare(&array1, &array2)?;

// 1 (index 0 of array1) is smaller than 4 (index 1 of array2)
assert_eq!(std::cmp::Ordering::Less, (cmp)(0, 1));

Error

The arrays’ DataType must be equal and the types must have a natural order.