This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new c03e2604f0 Support `negate` expression in substrait (#13112)
c03e2604f0 is described below

commit c03e2604f03c23fdfd777ce5043c3d17621a6349
Author: Yasser Latreche <[email protected]>
AuthorDate: Tue Oct 29 07:36:59 2024 -0400

    Support `negate` expression in substrait (#13112)
---
 datafusion/substrait/src/logical_plan/consumer.rs | 9 +++++----
 datafusion/substrait/src/logical_plan/producer.rs | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/datafusion/substrait/src/logical_plan/consumer.rs 
b/datafusion/substrait/src/logical_plan/consumer.rs
index e0bb3b4e4f..43263196bb 100644
--- a/datafusion/substrait/src/logical_plan/consumer.rs
+++ b/datafusion/substrait/src/logical_plan/consumer.rs
@@ -2613,7 +2613,7 @@ impl BuiltinExprBuilder {
         match name {
             "not" | "like" | "ilike" | "is_null" | "is_not_null" | "is_true"
             | "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
-            | "is_not_unknown" | "negative" => Some(Self {
+            | "is_not_unknown" | "negative" | "negate" => Some(Self {
                 expr_name: name.to_string(),
             }),
             _ => None,
@@ -2634,8 +2634,9 @@ impl BuiltinExprBuilder {
             "ilike" => {
                 Self::build_like_expr(ctx, true, f, input_schema, 
extensions).await
             }
-            "not" | "negative" | "is_null" | "is_not_null" | "is_true" | 
"is_false"
-            | "is_not_true" | "is_not_false" | "is_unknown" | "is_not_unknown" 
=> {
+            "not" | "negative" | "negate" | "is_null" | "is_not_null" | 
"is_true"
+            | "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
+            | "is_not_unknown" => {
                 Self::build_unary_expr(ctx, &self.expr_name, f, input_schema, 
extensions)
                     .await
             }
@@ -2664,7 +2665,7 @@ impl BuiltinExprBuilder {
 
         let expr = match fn_name {
             "not" => Expr::Not(arg),
-            "negative" => Expr::Negative(arg),
+            "negative" | "negate" => Expr::Negative(arg),
             "is_null" => Expr::IsNull(arg),
             "is_not_null" => Expr::IsNotNull(arg),
             "is_true" => Expr::IsTrue(arg),
diff --git a/datafusion/substrait/src/logical_plan/producer.rs 
b/datafusion/substrait/src/logical_plan/producer.rs
index 7b51650672..17ed41f016 100644
--- a/datafusion/substrait/src/logical_plan/producer.rs
+++ b/datafusion/substrait/src/logical_plan/producer.rs
@@ -1344,7 +1344,7 @@ pub fn to_substrait_rex(
         ),
         Expr::Negative(arg) => to_substrait_unary_scalar_fn(
             ctx,
-            "negative",
+            "negate",
             arg,
             schema,
             col_ref_offset,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to