vortex_runend/compute/
mod.rs

1mod binary_numeric;
2mod compare;
3mod fill_null;
4pub(crate) mod filter;
5mod invert;
6mod is_sorted;
7mod min_max;
8mod scalar_at;
9mod slice;
10pub(crate) mod take;
11mod take_from;
12
13use vortex_array::Array;
14use vortex_array::compute::{
15    FillNullFn, IsSortedFn, MinMaxFn, ScalarAtFn, SliceFn, TakeFn, TakeFromFn,
16};
17use vortex_array::vtable::ComputeVTable;
18
19use crate::RunEndEncoding;
20
21impl ComputeVTable for RunEndEncoding {
22    fn fill_null_fn(&self) -> Option<&dyn FillNullFn<&dyn Array>> {
23        Some(self)
24    }
25
26    fn is_sorted_fn(&self) -> Option<&dyn IsSortedFn<&dyn Array>> {
27        Some(self)
28    }
29
30    fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<&dyn Array>> {
31        Some(self)
32    }
33
34    fn slice_fn(&self) -> Option<&dyn SliceFn<&dyn Array>> {
35        Some(self)
36    }
37
38    fn take_fn(&self) -> Option<&dyn TakeFn<&dyn Array>> {
39        Some(self)
40    }
41
42    fn take_from_fn(&self) -> Option<&dyn TakeFromFn<&dyn Array>> {
43        Some(self)
44    }
45
46    fn min_max_fn(&self) -> Option<&dyn MinMaxFn<&dyn Array>> {
47        Some(self)
48    }
49}
50
51#[cfg(test)]
52mod test {
53    use vortex_array::Array;
54    use vortex_array::arrays::PrimitiveArray;
55    use vortex_array::compute::conformance::binary_numeric::test_numeric;
56
57    use crate::RunEndArray;
58
59    fn ree_array() -> RunEndArray {
60        RunEndArray::encode(
61            PrimitiveArray::from_iter([1, 1, 1, 4, 4, 4, 2, 2, 5, 5, 5, 5]).into_array(),
62        )
63        .unwrap()
64    }
65
66    #[test]
67    fn test_runend_binary_numeric() {
68        let array = ree_array().into_array();
69        test_numeric::<i32>(array)
70    }
71}