(
op: Op,
l: impl Iterator<Item = Option<&'a str>>,
r: impl Iterator<Item = Option<&'a str>>,
)
| 383 | |
| 384 | #[inline(never)] |
| 385 | fn op_binary<'a>( |
| 386 | op: Op, |
| 387 | l: impl Iterator<Item = Option<&'a str>>, |
| 388 | r: impl Iterator<Item = Option<&'a str>>, |
| 389 | ) -> Result<BooleanArray, ArrowError> { |
| 390 | match op { |
| 391 | Op::Like(neg) => binary_predicate(l, r, neg, Predicate::like), |
| 392 | Op::ILike(neg) => binary_predicate(l, r, neg, |s| Predicate::ilike(s, false)), |
| 393 | Op::Contains => Ok(l.zip(r).map(|(l, r)| Some(str_contains(l?, r?))).collect()), |
| 394 | Op::EqIgnoreAsciiCase => Ok(l |
| 395 | .zip(r) |
| 396 | .map(|(l, r)| Some(Predicate::IEqAscii(l?).evaluate(r?))) |
| 397 | .collect()), |
| 398 | Op::StartsWith => Ok(l |
| 399 | .zip(r) |
| 400 | .map(|(l, r)| Some(Predicate::StartsWith(r?).evaluate(l?))) |
| 401 | .collect()), |
| 402 | Op::EndsWith => Ok(l |
| 403 | .zip(r) |
| 404 | .map(|(l, r)| Some(Predicate::EndsWith(r?).evaluate(l?))) |
| 405 | .collect()), |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | fn str_contains(haystack: &str, needle: &str) -> bool { |
| 410 | memchr::memmem::find(haystack.as_bytes(), needle.as_bytes()).is_some() |
no test coverage detected