pepijnve commented on code in PR #17839:
URL: https://github.com/apache/datafusion/pull/17839#discussion_r2402612000
##########
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:
I was able to eliminate the clone calls. I don't know if there's a better
way to pull the values out of the `Vec` than `swap_remove`.
--
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]