vortex_dict/compute/
is_sorted.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use vortex_array::compute::{IsSortedKernel, IsSortedKernelAdapter, is_sorted, is_strict_sorted};
5use vortex_array::register_kernel;
6use vortex_error::VortexResult;
7
8use crate::{DictArray, DictVTable};
9
10impl IsSortedKernel for DictVTable {
11    fn is_sorted(&self, array: &DictArray) -> VortexResult<bool> {
12        // TODO(ngates): we should change these kernels to return Option<bool> to allow for "unknown"
13        let is_sorted = is_sorted(array.values())? && is_sorted(array.codes())?;
14        Ok(is_sorted)
15    }
16
17    fn is_strict_sorted(&self, array: &DictArray) -> VortexResult<bool> {
18        let is_sorted = is_strict_sorted(array.values())? && is_strict_sorted(array.codes())?;
19        Ok(is_sorted)
20    }
21}
22
23register_kernel!(IsSortedKernelAdapter(DictVTable).lift());