vortex_array/arrays/list/compute/
mod.rs

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