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

Method evaluate

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

Evaluate this predicate against the given haystack

(&self, haystack: &str)

Source from the content-addressed store, hash-verified

83
84 /// Evaluate this predicate against the given haystack
85 pub(crate) fn evaluate(&self, haystack: &str) -> bool {
86 match self {
87 Predicate::Eq(v) => *v == haystack,
88 Predicate::IEqAscii(v) => haystack.eq_ignore_ascii_case(v),
89 Predicate::Contains(finder) => finder.find(haystack.as_bytes()).is_some(),
90 Predicate::StartsWith(v) => starts_with(haystack, v, equals_kernel),
91 Predicate::IStartsWithAscii(v) => {
92 starts_with(haystack, v, equals_ignore_ascii_case_kernel)
93 }
94 Predicate::EndsWith(v) => ends_with(haystack, v, equals_kernel),
95 Predicate::IEndsWithAscii(v) => ends_with(haystack, v, equals_ignore_ascii_case_kernel),
96 Predicate::Regex(v) => v.is_match(haystack),
97 }
98 }
99
100 /// Evaluate this predicate against the elements of `array`
101 ///

Callers 3

op_binaryFunction · 0.45
binary_predicateFunction · 0.45
op_binaryFunction · 0.45

Calls 4

findMethod · 0.80
starts_withFunction · 0.70
ends_withFunction · 0.70
as_bytesMethod · 0.45

Tested by

no test coverage detected