You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/13 18:06:40 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5887: feat: extra sqllogictests for scalar functions

alamb commented on code in PR #5887:
URL: https://github.com/apache/arrow-datafusion/pull/5887#discussion_r1165869486


##########
datafusion/core/tests/sqllogictests/test_files/scalar.slt:
##########
@@ -31,11 +31,208 @@ CREATE TABLE t1(
   (3, 10000, 978, 2048)
 ;
 
-# pi scalar function
+# abs scalar function
 query RRR rowsort
-select pi(), pi() / 2, pi() / 3;
+select abs(64), abs(0), abs(-64);
 ----
-3.14159265359 1.570796326795 1.047197551197
+64 0 64
+
+# abs scalar nulls
+query R rowsort
+select abs(null);
+----
+NULL
+
+# acos scalar function
+query RRR rowsort
+select acos(0), acos(0.5), acos(1);
+----
+1.570796326795 1.047197551197 0
+
+# acos scalar nulls
+query R rowsort
+select acos(null);
+----
+NULL
+
+# acosh scalar function
+# cosh(x) = (exp(x) + exp(-x)) / 2
+query RRR rowsort
+select acosh((exp(1) + exp(-1)) / 2), acosh((exp(2) + exp(-2)) / 2), acosh((exp(3) + exp(-3)) / 2);
+----
+1 2 3
+
+# acosh scalar nulls
+query R rowsort
+select acosh(null);
+----
+NULL
+
+# asin scalar function
+query RRR rowsort
+select asin(0), asin(0.5), asin(1);
+----
+0 0.523598775598 1.570796326795
+
+# asin scalar nulls
+query R rowsort
+select asin(null);
+----
+NULL
+
+# asinh scalar function
+# sinh(x) = (exp(x) - exp(-x)) / 2
+query RRR rowsort
+select asinh((exp(1) - exp(-1)) / 2), asinh((exp(2) - exp(-2)) / 2), asinh((exp(3) - exp(-3)) / 2);
+----
+1 2 3
+
+# asinh scalar nulls
+query R rowsort
+select asinh(null);
+----
+NULL
+
+# atan scalar function
+query RRR rowsort
+select atan(0), atan(cbrt(3)), atan(1);
+----
+0 0.964539792856 0.785398163397
+
+# atan scalar nulls
+query R rowsort
+select atan(null);
+----
+NULL
+
+# atanh scalar function
+# tanh(x) = (exp(2x) - 1) / (exp(2x) + 1)
+query RRR rowsort
+select atanh((exp(2) - 1) / (exp(2) + 1)), atanh((exp(4) - 1) / (exp(4) + 1)), atanh((exp(6) - 1) / (exp(6) + 1));
+----
+1 2 3
+
+# atanh scalar nulls
+query R rowsort
+select atanh(null);
+----
+NULL
+
+# atan2 scalar function
+query RRR rowsort
+select atan2(0, 1), atan2(1, 2), atan2(2, 2);
+----
+0 0.4636476 0.7853982
+
+# atan2 scalar nulls
+query R rowsort
+select atan2(null, 64);
+----
+NULL
+
+# atan2 scalar nulls 1
+query R rowsort
+select atan2(2, null);
+----
+NULL
+
+# atan2 scalar nulls 2
+query R rowsort
+select atan2(null, null);
+----
+NULL
+
+# cbrt scalar function
+query RRR rowsort
+select cbrt(0), cbrt(8), cbrt(27);
+----
+0 2 3
+
+# cbrt scalar nulls
+query R rowsort
+select cbrt(null);
+----
+NULL
+
+# ceil scalar function
+query RRR rowsort
+select ceil(1.6), ceil(1.5), ceil(1.4);
+----
+2 2 2
+
+# ceil scalar nulls
+query R rowsort
+select ceil(null);
+----
+NULL
+
+# cos scalar function
+query RRR rowsort
+select cos(0), cos(pi() / 3), cos(pi() / 2);

Review Comment:
   nice



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org