vortex_runend/compute/
is_constant.rs

1use vortex_array::compute::{
2    IsConstantKernel, IsConstantKernelAdapter, IsConstantOpts, is_constant_opts,
3};
4use vortex_array::stats::Stat;
5use vortex_array::{Array, register_kernel};
6use vortex_error::VortexResult;
7
8use crate::RunEndVTable;
9
10impl IsConstantKernel for RunEndVTable {
11    fn is_constant(
12        &self,
13        array: &Self::Array,
14        opts: &IsConstantOpts,
15    ) -> VortexResult<Option<bool>> {
16        // If there are known to be me 0 len runs then we can check if constant on the values.
17        debug_assert_eq!(
18            array
19                .ends()
20                .statistics()
21                .compute_as::<bool>(Stat::IsStrictSorted),
22            Some(true)
23        );
24        is_constant_opts(array.values(), opts)
25    }
26}
27
28register_kernel!(IsConstantKernelAdapter(RunEndVTable).lift());