2010YOUY01 commented on code in PR #12401:
URL: https://github.com/apache/datafusion/pull/12401#discussion_r1754027597
##########
datafusion/functions/src/unicode/strpos.rs:
##########
@@ -140,24 +138,43 @@ fn calculate_strpos<'a, V1, V2, T: ArrowPrimitiveType>(
substring_array: V2,
) -> Result<ArrayRef>
where
- V1: ArrayAccessor<Item = &'a str>,
- V2: ArrayAccessor<Item = &'a str>,
+ V1: StringArrayType<'a, Item = &'a str>,
+ V2: StringArrayType<'a, Item = &'a str>,
{
- let string_iter = ArrayIter::new(string_array);
- let substring_iter = ArrayIter::new(substring_array);
+ let ascii_only = string_array.is_ascii() && substring_array.is_ascii();
Review Comment:
```suggestion
let ascii_only = substring_array.is_ascii() && string_array.is_ascii() ;
```
I think we can check substring first, since it's cheaper in common cases and
we can then shortcircuit checking `string_array` in some case
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]