You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/05/08 13:03:41 UTC

[arrow-datafusion] branch master updated: add unit tests of mathematical expressions with null (#2478)

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

alamb 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 f943b6a65 add unit tests of mathematical expressions with null (#2478)
f943b6a65 is described below

commit f943b6a65291c3de6403dde827cb411a050f4fa0
Author: DuRipeng <45...@qq.com>
AuthorDate: Sun May 8 21:03:35 2022 +0800

    add unit tests of mathematical expressions with null (#2478)
---
 datafusion/core/tests/sql/expr.rs | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/datafusion/core/tests/sql/expr.rs b/datafusion/core/tests/sql/expr.rs
index 1dffc2eb9..18db6bbf9 100644
--- a/datafusion/core/tests/sql/expr.rs
+++ b/datafusion/core/tests/sql/expr.rs
@@ -417,6 +417,31 @@ async fn test_boolean_expressions() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn test_mathematical_expressions_with_null() -> Result<()> {
+    test_expression!("sqrt(NULL)", "NULL");
+    test_expression!("sin(NULL)", "NULL");
+    test_expression!("cos(NULL)", "NULL");
+    test_expression!("tan(NULL)", "NULL");
+    test_expression!("asin(NULL)", "NULL");
+    test_expression!("acos(NULL)", "NULL");
+    test_expression!("atan(NULL)", "NULL");
+    test_expression!("floor(NULL)", "NULL");
+    test_expression!("ceil(NULL)", "NULL");
+    test_expression!("round(NULL)", "NULL");
+    test_expression!("trunc(NULL)", "NULL");
+    test_expression!("abs(NULL)", "NULL");
+    test_expression!("signum(NULL)", "NULL");
+    test_expression!("exp(NULL)", "NULL");
+    test_expression!("ln(NULL)", "NULL");
+    test_expression!("log2(NULL)", "NULL");
+    test_expression!("log10(NULL)", "NULL");
+    test_expression!("power(NULL, 2)", "NULL");
+    test_expression!("power(NULL, NULL)", "NULL");
+    test_expression!("power(2, NULL)", "NULL");
+    Ok(())
+}
+
 #[tokio::test]
 #[cfg_attr(not(feature = "crypto_expressions"), ignore)]
 async fn test_crypto_expressions() -> Result<()> {