From 0ae743f027c94c3b4413600f855522e7cf40b5b7 Mon Sep 17 00:00:00 2001 From: sgrebnov Date: Wed, 24 Jul 2024 13:58:25 -0700 Subject: [PATCH] Add LIKE expr support --- src/sql/sql_provider_datafusion/expr.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sql/sql_provider_datafusion/expr.rs b/src/sql/sql_provider_datafusion/expr.rs index 8d4f9eb..a65d445 100644 --- a/src/sql/sql_provider_datafusion/expr.rs +++ b/src/sql/sql_provider_datafusion/expr.rs @@ -103,6 +103,16 @@ pub fn to_sql_with_engine(expr: &Expr, engine: Option) -> Result expr: format!("{expr}"), }), }, + Expr::Like(like_expr) => { + let expr = to_sql_with_engine(&like_expr.expr, engine)?; + let pattern = to_sql_with_engine(&like_expr.pattern, engine)?; + let op_name = if like_expr.negated { + "NOT LIKE" + } else { + "LIKE" + }; + Ok(format!("{expr} {op_name} {pattern}")) + }, _ => Err(Error::UnsupportedFilterExpr { expr: format!("{expr}"), }),