MCPcopy Create free account
hub / github.com/apache/arrow-rs / ilike

Method ilike

arrow-string/src/predicate.rs:68–82  ·  view source on GitHub ↗

Create a predicate for the given ilike pattern

(pattern: &'a str, is_ascii: bool)

Source from the content-addressed store, hash-verified

66
67 /// Create a predicate for the given ilike pattern
68 pub(crate) fn ilike(pattern: &'a str, is_ascii: bool) -> Result<Self, ArrowError> {
69 if is_ascii && pattern.is_ascii() {
70 if !contains_like_pattern(pattern) {
71 return Ok(Self::IEqAscii(pattern));
72 } else if pattern.ends_with('%')
73 && !pattern.ends_with("\\%")
74 && !contains_like_pattern(&pattern[..pattern.len() - 1])
75 {
76 return Ok(Self::IStartsWithAscii(&pattern[..pattern.len() - 1]));
77 } else if pattern.starts_with('%') && !contains_like_pattern(&pattern[1..]) {
78 return Ok(Self::IEndsWithAscii(&pattern[1..]));
79 }
80 }
81 Ok(Self::Regex(regex_like(pattern, true)?))
82 }
83
84 /// Evaluate this predicate against the given haystack
85 pub(crate) fn evaluate(&self, haystack: &str) -> bool {

Callers

nothing calls this directly

Calls 4

contains_like_patternFunction · 0.85
regex_likeFunction · 0.85
is_asciiMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected