alamb commented on code in PR #8862:
URL: https://github.com/apache/arrow-datafusion/pull/8862#discussion_r1462434638
##########
datafusion/physical-expr/src/string_expressions.rs:
##########
@@ -461,17 +505,21 @@ pub fn split_part<T: OffsetSizeTrait>(args: &[ArrayRef])
-> Result<ArrayRef> {
/// Returns true if string starts with prefix.
/// starts_with('alphabet', 'alph') = 't'
pub fn starts_with<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
- let string_array = as_generic_string_array::<T>(&args[0])?;
- let prefix_array = as_generic_string_array::<T>(&args[1])?;
+ let left = as_generic_string_array::<T>(&args[0])?;
+ let right = as_generic_string_array::<T>(&args[1])?;
- let result = string_array
- .iter()
- .zip(prefix_array.iter())
- .map(|(string, prefix)| match (string, prefix) {
- (Some(string), Some(prefix)) => Some(string.starts_with(prefix)),
- _ => None,
- })
- .collect::<BooleanArray>();
+ let result = arrow::compute::kernels::comparison::starts_with(left,
right)?;
Review Comment:
👍
--
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]