vortex_array/arrays/list/compute/
mod.rs

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