vortex_array/arrays/list/compute/
mod.rs

1mod filter;
2mod is_constant;
3mod mask;
4
5use vortex_error::VortexResult;
6
7use crate::arrays::{ListArray, ListVTable};
8use crate::compute::{
9    IsSortedKernel, IsSortedKernelAdapter, MinMaxKernel, MinMaxKernelAdapter, MinMaxResult,
10};
11use crate::register_kernel;
12
13impl MinMaxKernel for ListVTable {
14    fn min_max(&self, _array: &ListArray) -> VortexResult<Option<MinMaxResult>> {
15        // TODO(joe): Implement list min max
16        Ok(None)
17    }
18}
19
20register_kernel!(MinMaxKernelAdapter(ListVTable).lift());
21
22// TODO(ngates): why do we report the wrong thing?
23impl IsSortedKernel for ListVTable {
24    fn is_sorted(&self, _array: &ListArray) -> VortexResult<bool> {
25        Ok(false)
26    }
27
28    fn is_strict_sorted(&self, _array: &ListArray) -> VortexResult<bool> {
29        Ok(false)
30    }
31}
32
33register_kernel!(IsSortedKernelAdapter(ListVTable).lift());
34
35#[cfg(test)]
36mod test {
37    use crate::IntoArray;
38    use crate::arrays::{ListArray, PrimitiveArray};
39    use crate::compute::conformance::mask::test_mask;
40    use crate::validity::Validity;
41
42    #[test]
43    fn test_mask_list() {
44        let elements = PrimitiveArray::from_iter(0..35);
45        let offsets = PrimitiveArray::from_iter([0, 5, 11, 18, 26, 35]);
46        let validity = Validity::AllValid;
47        let array =
48            ListArray::try_new(elements.into_array(), offsets.into_array(), validity).unwrap();
49
50        test_mask(array.as_ref());
51    }
52}