vortex_dict/compute/
is_sorted.rs1use 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<Option<bool>> {
12 if Some((true, true)) == is_sorted(array.values())?.zip(is_sorted(array.codes())?) {
13 return Ok(Some(true));
14 }
15 Ok(None)
16 }
17
18 fn is_strict_sorted(&self, array: &DictArray) -> VortexResult<Option<bool>> {
19 if Some((true, true))
20 == is_strict_sorted(array.values())?.zip(is_strict_sorted(array.codes())?)
21 {
22 return Ok(Some(true));
23 }
24 Ok(None)
25 }
26}
27
28register_kernel!(IsSortedKernelAdapter(DictVTable).lift());