Skip to content

Commit

Permalink
feat: apply scalar_regex_match optimize to similar_to case
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuliquan committed Nov 9, 2024
1 parent 8e92a1c commit 0e939ed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions datafusion/physical-expr/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ pub fn create_physical_expr(
create_physical_expr(expr, input_dfschema, execution_props)?;
let physical_pattern =
create_physical_expr(pattern, input_dfschema, execution_props)?;

if let Expr::Literal(
ScalarValue::Null
| ScalarValue::Utf8(_)
| ScalarValue::Utf8View(_)
| ScalarValue::LargeUtf8(_),
) = pattern.as_ref()
{
// handle literal regexp pattern case to `ScalarRegexMatchExpr`
return scalar_regex_match(
*negated,
*case_insensitive,
physical_expr,
physical_pattern,
input_schema,
);
}
similar_to(*negated, *case_insensitive, physical_expr, physical_pattern)
}
Expr::Case(case) => {
Expand Down

0 comments on commit 0e939ed

Please sign in to comment.