xinlifoobar commented on code in PR #6231:
URL: https://github.com/apache/arrow-rs/pull/6231#discussion_r1721484574


##########
arrow-string/src/predicate.rs:
##########
@@ -117,12 +119,38 @@ impl<'a> Predicate<'a> {
             Predicate::Contains(finder) => BooleanArray::from_unary(array, 
|haystack| {
                 finder.find(haystack.as_bytes()).is_some() != negate
             }),
-            Predicate::StartsWith(v) => BooleanArray::from_unary(array, 
|haystack| {
-                starts_with(haystack, v, equals_kernel) != negate
-            }),
-            Predicate::IStartsWithAscii(v) => BooleanArray::from_unary(array, 
|haystack| {
-                starts_with(haystack, v, equals_ignore_ascii_case_kernel) != 
negate
-            }),
+            Predicate::StartsWith(v) => {
+                if let Some(string_view_array) = 
array.as_any().downcast_ref::<StringViewArray>() {
+                    // Need to construct a new array nevertheless
+                    BooleanArray::from(
+                        string_view_array

Review Comment:
   I move this to `StringViewArray`. Don't do it in `ByteViewArray` because the 
creation of **empty slice** is also a performance killer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to