vortex_dict/compute/
is_sorted.rs

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