Skip to main content

vortex_runend/compute/
is_sorted.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use vortex_array::IntoArray as _;
5use vortex_array::compute::IsSortedKernel;
6use vortex_array::compute::IsSortedKernelAdapter;
7use vortex_array::compute::is_sorted;
8use vortex_array::compute::is_strict_sorted;
9use vortex_array::register_kernel;
10use vortex_error::VortexResult;
11
12use crate::RunEndArray;
13use crate::RunEndVTable;
14
15impl IsSortedKernel for RunEndVTable {
16    fn is_sorted(&self, array: &RunEndArray) -> VortexResult<Option<bool>> {
17        is_sorted(array.values())
18    }
19
20    fn is_strict_sorted(&self, array: &RunEndArray) -> VortexResult<Option<bool>> {
21        is_strict_sorted(&array.to_canonical()?.into_array())
22    }
23}
24
25register_kernel!(IsSortedKernelAdapter(RunEndVTable).lift());