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

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new c574269a0 Moved nullif out of unary (#3241)
c574269a0 is described below

commit c574269a0f713638958b1efcc41d399212533176
Author: comphead <[email protected]>
AuthorDate: Tue Aug 23 17:00:49 2022 -0700

    Moved nullif out of unary (#3241)
---
 datafusion/expr/src/expr_fn.rs     | 2 +-
 datafusion/proto/src/from_proto.rs | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/datafusion/expr/src/expr_fn.rs b/datafusion/expr/src/expr_fn.rs
index 9b51273a0..adae10e22 100644
--- a/datafusion/expr/src/expr_fn.rs
+++ b/datafusion/expr/src/expr_fn.rs
@@ -324,7 +324,7 @@ unary_scalar_expr!(Exp, exp, "base 2 logarithm");
 unary_scalar_expr!(Log2, log2, "base 10 logarithm");
 unary_scalar_expr!(Log10, log10, "base 10 logarithm");
 unary_scalar_expr!(Ln, ln, "natural logarithm");
-unary_scalar_expr!(NullIf, nullif, "The NULLIF function returns a null value 
if value1 equals value2; otherwise it returns value1. This can be used to 
perform the inverse operation of the COALESCE expression."); //TODO this is not 
a unary expression https://github.com/apache/arrow-datafusion/issues/3069
+scalar_expr!(NullIf, nullif, arg_1, arg_2);
 scalar_expr!(Power, power, base, exponent);
 scalar_expr!(Atan2, atan2, y, x);
 
diff --git a/datafusion/proto/src/from_proto.rs 
b/datafusion/proto/src/from_proto.rs
index ca22eb436..63d9fe2b7 100644
--- a/datafusion/proto/src/from_proto.rs
+++ b/datafusion/proto/src/from_proto.rs
@@ -1015,7 +1015,10 @@ pub fn parse_expr(
                 ScalarFunction::Sha384 => Ok(sha384(parse_expr(&args[0], 
registry)?)),
                 ScalarFunction::Sha512 => Ok(sha512(parse_expr(&args[0], 
registry)?)),
                 ScalarFunction::Md5 => Ok(md5(parse_expr(&args[0], 
registry)?)),
-                ScalarFunction::NullIf => Ok(nullif(parse_expr(&args[0], 
registry)?)),
+                ScalarFunction::NullIf => Ok(nullif(
+                    parse_expr(&args[0], registry)?,
+                    parse_expr(&args[1], registry)?,
+                )),
                 ScalarFunction::Digest => Ok(digest(
                     parse_expr(&args[0], registry)?,
                     parse_expr(&args[1], registry)?,

Reply via email to