vortex_array/arrays/bool/compute/
mod.rs

1use crate::arrays::{BoolArray, BoolEncoding};
2use crate::compute::{
3    BinaryBooleanFn, CastFn, FillForwardFn, FillNullFn, FilterKernelAdapter, InvertFn,
4    IsConstantFn, IsSortedFn, KernelRef, MaskFn, MinMaxFn, ScalarAtFn, SliceFn, SumFn, TakeFn,
5    ToArrowFn, UncompressedSizeFn,
6};
7use crate::vtable::ComputeVTable;
8use crate::{Array, ArrayComputeImpl};
9
10mod cast;
11mod fill_forward;
12mod fill_null;
13pub mod filter;
14mod flatten;
15mod invert;
16mod is_constant;
17mod is_sorted;
18mod mask;
19mod min_max;
20mod scalar_at;
21mod slice;
22mod sum;
23mod take;
24mod to_arrow;
25mod uncompressed_size;
26
27impl ArrayComputeImpl for BoolArray {
28    const FILTER: Option<KernelRef> = FilterKernelAdapter(BoolEncoding).some();
29}
30
31impl ComputeVTable for BoolEncoding {
32    fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<&dyn Array>> {
33        // We only implement this when other is a constant value, otherwise we fall back to the
34        // default implementation that canonicalizes to Arrow.
35        // TODO(ngates): implement this for constants.
36        // other.is_constant().then_some(self)
37        None
38    }
39
40    fn cast_fn(&self) -> Option<&dyn CastFn<&dyn Array>> {
41        Some(self)
42    }
43
44    fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<&dyn Array>> {
45        Some(self)
46    }
47
48    fn fill_null_fn(&self) -> Option<&dyn FillNullFn<&dyn Array>> {
49        Some(self)
50    }
51
52    fn invert_fn(&self) -> Option<&dyn InvertFn<&dyn Array>> {
53        Some(self)
54    }
55
56    fn is_constant_fn(&self) -> Option<&dyn IsConstantFn<&dyn Array>> {
57        Some(self)
58    }
59
60    fn is_sorted_fn(&self) -> Option<&dyn IsSortedFn<&dyn Array>> {
61        Some(self)
62    }
63
64    fn mask_fn(&self) -> Option<&dyn MaskFn<&dyn Array>> {
65        Some(self)
66    }
67
68    fn min_max_fn(&self) -> Option<&dyn MinMaxFn<&dyn Array>> {
69        Some(self)
70    }
71
72    fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<&dyn Array>> {
73        Some(self)
74    }
75
76    fn slice_fn(&self) -> Option<&dyn SliceFn<&dyn Array>> {
77        Some(self)
78    }
79
80    fn sum_fn(&self) -> Option<&dyn SumFn<&dyn Array>> {
81        Some(self)
82    }
83
84    fn take_fn(&self) -> Option<&dyn TakeFn<&dyn Array>> {
85        Some(self)
86    }
87
88    fn to_arrow_fn(&self) -> Option<&dyn ToArrowFn<&dyn Array>> {
89        Some(self)
90    }
91
92    fn uncompressed_size_fn(&self) -> Option<&dyn UncompressedSizeFn<&dyn Array>> {
93        Some(self)
94    }
95}