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


##########
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:
   since this code only calls `prefix_iter` when you know it is a StringView 
array I wonder if the prefix_iter needs to be part of StringArrayType 🤔 
   
   
   Also, you could potentially special case when the prefix length was <=4 (so 
the loop simply went and looked at the inline prefix in the view, and never 
even bothered to look anyhere else). 
   
   that might be overly optimized though



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to