alamb commented on code in PR #17839:
URL: https://github.com/apache/datafusion/pull/17839#discussion_r2402470019
##########
datafusion/sqllogictest/test_files/string/string_view.slt:
##########
@@ -784,7 +784,7 @@ EXPLAIN SELECT
FROM test;
----
logical_plan
-01)Projection: regexp_like(test.column1_utf8view,
Utf8("^https?://(?:www\.)?([^/]+)/.*$")) AS k
+01)Projection: test.column1_utf8view ~
Utf8View("^https?://(?:www\.)?([^/]+)/.*$") AS k
Review Comment:
If `~` is faster than `regexp_like` can we simply change the implementation
to use the same underlying implementation of `~` (why only rewrite in some
cases?)
##########
datafusion/functions/src/regex/regexplike.rs:
##########
@@ -153,6 +156,53 @@ impl ScalarUDFImpl for RegexpLikeFunc {
}
}
+ fn simplify(
+ &self,
+ args: Vec<Expr>,
+ info: &dyn SimplifyInfo,
+ ) -> Result<ExprSimplifyResult> {
+ // Try to simplify regexp_like to ~ or ~* if possible since the
implementation of those operators
+ // is more optimised.
+ let Some((st, op, re)) = (match args.as_slice() {
+ [string, regexp] => {
+ Some((string.clone(), Operator::RegexMatch, regexp.clone()))
Review Comment:
it would be nice to avoid these `clone()` if possible
--
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]