/// recursively sort-merges multiple `slices` representing slices of sorted arrays according
/// to a comparison function between those arrays.
/// Note that `slices` is an array of arrays, `slices[i][j]`. The index `i` represents
/// the set of arrays `i` (schema-unaware version of a [`RecordBatch`]), while the index `j` represents
/// the array `j` within that set.
/// Note that this does not split to the smallest element as arrays: the smallest unit is a `slice`
recursively sort-merges multiple `slices` representing slices of sorted arrays according
to a comparison function between those arrays.
Note that `slices` is an array of arrays, `slices[i][j]`.
recursively sort - merges multiple ` slices ` representing slices of sorted arrays according to a comparison function between those arrays . Note that ` slices ` is an array of arrays ` slices [ i ] [ j ] ` .
fn recursive_merge_sort(slices: &[&[MergeSlice]], comparator: &Comparator) -> Vec<MergeSlice> {
    let n = slices.len();
    let m = n / 2;
    if n == 1 {
        // slices are assumed sort arrays
        return slices[0].to_vec();
    }
    if n == 2 {
        return merge_sort_slices(slices[0].iter(), slices[1].iter(), comparator)
            .collect::<Vec<_>>();
    }
    // split in 2 and sort
    let lhs = recursive_merge_sort(&slices[0..m], comparator);
    let rhs = recursive_merge_sort(&slices[m..n], comparator);
    // merge-sort the splits
    merge_sort_slices(lhs.iter(), rhs.iter(), comparator).collect::<Vec<_>>()
}
fn recursive_merge_sort ( slices : & [ & [ MergeSlice ] ] , comparator : & Comparator ) -> Vec < MergeSlice > { let n = slices . len ( ) ; let m = n / 2 ; if n == 1 { // slices are assumed sort arrays return slices [ 0 ] . to_vec ( ) ; } if n == 2 { return merge_sort_slices ( slices [ 0 ] . iter ( ) , slices [ 1 ] . iter ( ) , comparator ) . collect :: < Vec < _ > > ( ) ; } // split in 2 and sort let lhs = recursive_merge_sort ( & slices [ 0 .. m ] , comparator ) ; let rhs = recursive_merge_sort ( & slices [ m .. n ] , comparator ) ; // merge-sort the splits merge_sort_slices ( lhs . iter ( ) , rhs . iter ( ) , comparator ) . collect :: < Vec < _ > > ( ) }
recursively sort-merges multiple `slices` representing slices of sorted arrays according
to a comparison function between those arrays.
recursively sort - merges multiple ` slices ` representing slices of sorted arrays according to a comparison function between those arrays .
slices
&[&[MergeSlice]]
comparator
&Comparator