(
op: Op,
l: impl Iterator<Item = Option<&'a [u8]>>,
r: impl Iterator<Item = Option<&'a [u8]>>,
)
| 141 | |
| 142 | #[inline(never)] |
| 143 | fn op_binary<'a>( |
| 144 | op: Op, |
| 145 | l: impl Iterator<Item = Option<&'a [u8]>>, |
| 146 | r: impl Iterator<Item = Option<&'a [u8]>>, |
| 147 | ) -> Result<BooleanArray, ArrowError> { |
| 148 | match op { |
| 149 | Op::Contains => Ok(l |
| 150 | .zip(r) |
| 151 | .map(|(l, r)| Some(bytes_contains(l?, r?))) |
| 152 | .collect()), |
| 153 | Op::StartsWith => Ok(l |
| 154 | .zip(r) |
| 155 | .map(|(l, r)| Some(BinaryPredicate::StartsWith(r?).evaluate(l?))) |
| 156 | .collect()), |
| 157 | Op::EndsWith => Ok(l |
| 158 | .zip(r) |
| 159 | .map(|(l, r)| Some(BinaryPredicate::EndsWith(r?).evaluate(l?))) |
| 160 | .collect()), |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | fn bytes_contains(haystack: &[u8], needle: &[u8]) -> bool { |
| 165 | memchr::memmem::find(haystack, needle).is_some() |
no test coverage detected