Omega359 commented on code in PR #26467:
URL: https://github.com/apache/datafusion/pull/26467#discussion_r4340926657
##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -1155,6 +1164,37 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
)))
}
+ /// Plans `expr [NOT] RLIKE pattern` and `expr [NOT] REGEXP pattern` as a
call
+ /// to the `regexp_like` function, resolved through the function registry.
+ fn sql_rlike_to_expr(
+ &self,
+ negated: bool,
+ expr: SQLExpr,
+ pattern: SQLExpr,
+ schema: &DFSchema,
+ planner_context: &mut PlannerContext,
+ ) -> Result<Expr> {
+ let fun = self
+ .context_provider
+ .get_function_meta("regexp_like")
+ .ok_or_else(|| {
+ plan_datafusion_err!(
+ "RLIKE and REGEXP require the 'regexp_like' function,
which is not registered"
+ )
+ })?;
+ let expr = self.sql_expr_to_logical_expr(expr, schema,
planner_context)?;
+ let pattern = self.sql_expr_to_logical_expr(pattern, schema,
planner_context)?;
+ let regexp_like = match self.plan_scalar_udf(fun, vec![expr, pattern],
schema)? {
Review Comment:
This is a slight change of behaviour from existing special cases such as
TRIM, etc where this allows a downstream planner to override but existing ones
do not. I think this is a good thing but I do think we should file an issue to
update all the other special cases to use this new function.
--
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]