(&self, array: T, negate: bool)
| 47 | /// If `negate` is true the result of the predicate will be negated |
| 48 | #[inline(never)] |
| 49 | pub fn evaluate_array<'i, T>(&self, array: T, negate: bool) -> BooleanArray |
| 50 | where |
| 51 | T: ArrayAccessor<Item = &'i [u8]>, |
| 52 | { |
| 53 | match self { |
| 54 | Self::Contains(finder) => BooleanArray::from_unary(array, |haystack| { |
| 55 | finder.find(haystack).is_some() != negate |
| 56 | }), |
| 57 | Self::StartsWith(v) => { |
| 58 | if let Some(view_array) = array.as_any().downcast_ref::<BinaryViewArray>() { |
| 59 | let nulls = view_array.logical_nulls(); |
| 60 | let values = BooleanBuffer::from( |
| 61 | view_array |
| 62 | .prefix_bytes_iter(v.len()) |
| 63 | .map(|haystack| equals_bytes(haystack, v, equals_kernel) != negate) |
| 64 | .collect::<Vec<_>>(), |
| 65 | ); |
| 66 | BooleanArray::new(values, nulls) |
| 67 | } else { |
| 68 | BooleanArray::from_unary(array, |haystack| { |
| 69 | starts_with(haystack, v, equals_kernel) != negate |
| 70 | }) |
| 71 | } |
| 72 | } |
| 73 | Self::EndsWith(v) => { |
| 74 | if let Some(view_array) = array.as_any().downcast_ref::<BinaryViewArray>() { |
| 75 | let nulls = view_array.logical_nulls(); |
| 76 | let values = BooleanBuffer::from( |
| 77 | view_array |
| 78 | .suffix_bytes_iter(v.len()) |
| 79 | .map(|haystack| equals_bytes(haystack, v, equals_kernel) != negate) |
| 80 | .collect::<Vec<_>>(), |
| 81 | ); |
| 82 | BooleanArray::new(values, nulls) |
| 83 | } else { |
| 84 | BooleanArray::from_unary(array, |haystack| { |
| 85 | ends_with(haystack, v, equals_kernel) != negate |
| 86 | }) |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | fn equals_bytes(lhs: &[u8], rhs: &[u8], byte_eq_kernel: impl Fn((&u8, &u8)) -> bool) -> bool { |
nothing calls this directly
no test coverage detected