pub fn merge_sort(
    lhs: &dyn Array,
    rhs: &dyn Array,
    options: &SortOptions,
    limit: Option<usize>
) -> Result<Box<dyn Array>>
Available on crate feature compute_merge_sort only.
Expand description

Combines two sorted Arrays of the same crate::datatypes::DataType into a single sorted array. If the arrays are not sorted (which this function does not check), the result is wrong.

Error

This function errors when:

Example

use arrow2::array::Int32Array;
use arrow2::compute::merge_sort::{merge_sort, SortOptions};
let a = Int32Array::from_slice(&[2, 4, 6]);
let b = Int32Array::from_slice(&[0, 1, 3]);
let sorted = merge_sort(&a, &b, &SortOptions::default(), None)?;
let expected = Int32Array::from_slice(&[0, 1, 2, 3, 4, 6]);
assert_eq!(expected, sorted.as_ref());