(&self, array: T, negate: bool)
| 102 | /// If `negate` is true the result of the predicate will be negated |
| 103 | #[inline(never)] |
| 104 | pub(crate) fn evaluate_array<'i, T>(&self, array: T, negate: bool) -> BooleanArray |
| 105 | where |
| 106 | T: ArrayAccessor<Item = &'i str>, |
| 107 | { |
| 108 | match self { |
| 109 | Predicate::Eq(v) => BooleanArray::from_unary(array, |haystack| { |
| 110 | (haystack.len() == v.len() && haystack == *v) != negate |
| 111 | }), |
| 112 | Predicate::IEqAscii(v) => BooleanArray::from_unary(array, |haystack| { |
| 113 | haystack.eq_ignore_ascii_case(v) != negate |
| 114 | }), |
| 115 | Predicate::Contains(finder) => BooleanArray::from_unary(array, |haystack| { |
| 116 | finder.find(haystack.as_bytes()).is_some() != negate |
| 117 | }), |
| 118 | Predicate::StartsWith(v) => { |
| 119 | if let Some(string_view_array) = array.as_any().downcast_ref::<StringViewArray>() { |
| 120 | let nulls = string_view_array.logical_nulls(); |
| 121 | let values = BooleanBuffer::from( |
| 122 | string_view_array |
| 123 | .prefix_bytes_iter(v.len()) |
| 124 | .map(|haystack| { |
| 125 | equals_bytes(haystack, v.as_bytes(), equals_kernel) != negate |
| 126 | }) |
| 127 | .collect::<Vec<_>>(), |
| 128 | ); |
| 129 | BooleanArray::new(values, nulls) |
| 130 | } else { |
| 131 | BooleanArray::from_unary(array, |haystack| { |
| 132 | starts_with(haystack, v, equals_kernel) != negate |
| 133 | }) |
| 134 | } |
| 135 | } |
| 136 | Predicate::IStartsWithAscii(v) => { |
| 137 | if let Some(string_view_array) = array.as_any().downcast_ref::<StringViewArray>() { |
| 138 | let nulls = string_view_array.logical_nulls(); |
| 139 | let values = BooleanBuffer::from( |
| 140 | string_view_array |
| 141 | .prefix_bytes_iter(v.len()) |
| 142 | .map(|haystack| { |
| 143 | equals_bytes( |
| 144 | haystack, |
| 145 | v.as_bytes(), |
| 146 | equals_ignore_ascii_case_kernel, |
| 147 | ) != negate |
| 148 | }) |
| 149 | .collect::<Vec<_>>(), |
| 150 | ); |
| 151 | BooleanArray::new(values, nulls) |
| 152 | } else { |
| 153 | BooleanArray::from_unary(array, |haystack| { |
| 154 | starts_with(haystack, v, equals_ignore_ascii_case_kernel) != negate |
| 155 | }) |
| 156 | } |
| 157 | } |
| 158 | Predicate::EndsWith(v) => { |
| 159 | if let Some(string_view_array) = array.as_any().downcast_ref::<StringViewArray>() { |
| 160 | let nulls = string_view_array.logical_nulls(); |
| 161 | let values = BooleanBuffer::from( |
no test coverage detected