Jefffrey commented on code in PR #20354:
URL: https://github.com/apache/datafusion/pull/20354#discussion_r2807110950


##########
datafusion/functions/src/regex/regexplike.rs:
##########
@@ -130,6 +133,13 @@ impl ScalarUDFImpl for RegexpLikeFunc {
         args: datafusion_expr::ScalarFunctionArgs,
     ) -> Result<ColumnarValue> {
         let args = &args.args;
+        let is_scalar = args
+            .iter()
+            .all(|arg| matches!(arg, ColumnarValue::Scalar(_)));
+
+        if is_scalar {

Review Comment:
   I think we should think in terms of how people may use this function; while 
this is a fast path for pure scalar inputs, it could be likely that users would 
have the first argument as an array but the 2nd/3rd arguments as scalar inputs, 
so would be worth considering a fast path for that too?



##########
datafusion/functions/src/regex/regexplike.rs:
##########
@@ -138,21 +148,13 @@ impl ScalarUDFImpl for RegexpLikeFunc {
                 ColumnarValue::Array(a) => Some(a.len()),
             });
 
-        let is_scalar = len.is_none();

Review Comment:
   We should take the chance here to do further refactors; for example we can 
use `ColumnarValue::values_to_arrays` here



-- 
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]

Reply via email to