alamb commented on code in PR #11753:
URL: https://github.com/apache/datafusion/pull/11753#discussion_r1702683446


##########
datafusion/functions/src/regex/regexplike.rs:
##########
@@ -75,13 +75,8 @@ impl ScalarUDFImpl for RegexpLikeFunc {
         use DataType::*;
 
         Ok(match &arg_types[0] {
-            LargeUtf8 | Utf8 => Boolean,
             Null => Null,
-            other => {
-                return plan_err!(
-                    "The regexp_like function can only accept strings. Got 
{other}"
-                );
-            }
+            _ => Boolean,

Review Comment:
   Without this change, regexp_like fails with an error about unsupported types 
if passed a StringView
   
   With this change it succeeds (though the StringView is cast to a String)
   
   @tshauck and I are going to organize a bunch of changes to get StringView 
working across functions as part of 
https://github.com/apache/datafusion/issues/11790



##########
datafusion/sqllogictest/test_files/string_view.slt:
##########
@@ -322,6 +322,378 @@ logical_plan
 03)----TableScan: test projection=[column1_utf8, column2_utf8, 
column1_utf8view]
 
 
+# Ensure string functions use native StringView implementation
+# and do not fall back to Utf8 or LargeUtf8
+# Should see no casts to Utf8 in the plans below
+
+## Ensure no casts for LIKE/ILIKE
+query TT
+EXPLAIN SELECT
+  column1_utf8view like 'foo' as "like",
+  column1_utf8view ilike 'foo' as "ilike"
+FROM test;
+----
+logical_plan
+01)Projection: test.column1_utf8view LIKE Utf8View("foo") AS like, 
test.column1_utf8view ILIKE Utf8View("foo") AS ilike
+02)--TableScan: test projection=[column1_utf8view]
+
+
+
+## Ensure no casts for ASCII
+## TODO file ticket

Review Comment:
   We plan to file tickets for these functions as follow ons -- see 
https://github.com/apache/datafusion/pull/11787#discussion_r1702294173 for 
details



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