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

[GitHub] [arrow-datafusion] izveigor opened a new pull request, #5887: feat: extra sqllogictests for scalar functions

izveigor opened a new pull request, #5887:
URL: https://github.com/apache/arrow-datafusion/pull/5887

   # Which issue does this PR close?
   
   Part on https://github.com/apache/arrow-datafusion/issues/5838
   Follow on to https://github.com/apache/arrow-datafusion/pull/5884
   
   # Rationale for this change
   These tests cover a lot of scalar functions.
   
   # What changes are included in this PR?
   Tests of the following mathematical scalar functions:
   - abs
   - acos
   - asin
   - atan
   - atan2
   - ceil
   - cos
   - exp
   - floor
   - ln
   - log10
   - log2
   - power
   - round
   - signum
   - sin
   - sqrt
   - cbrt
   - tan
   
   # Are these changes tested?
   Yes
   
   # Are there any user-facing changes?
   No


-- 
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


[GitHub] [arrow-datafusion] alamb merged pull request #5887: feat: extra sqllogictests for scalar functions

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #5887:
URL: https://github.com/apache/arrow-datafusion/pull/5887


-- 
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #5887:
URL: https://github.com/apache/arrow-datafusion/pull/5887#issuecomment-1502053483

   I think this one should be ready to go no after rebasing


-- 
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


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

Posted by "izveigor (via GitHub)" <gi...@apache.org>.
izveigor commented on code in PR #5887:
URL: https://github.com/apache/arrow-datafusion/pull/5887#discussion_r1158847836


##########
datafusion/core/tests/sqllogictests/test_files/scalar.slt:
##########
@@ -31,6 +31,114 @@ CREATE TABLE t1(
   (3, 10000, 978, 2048)
 ;
 
+# abs scalar function
+query RR rowsort
+select abs(64), abs(0), abs(-64)
+---
+64 0 64
+
+# acos scalar function
+query RR rowsort
+select acos(0), acos(0.5), acos(1)
+---
+1.5707963 1.0471976 0
+
+# asin scalar function
+query RR rowsort
+select asin(0), asin(0.5), asin(1)
+---
+0 1.0471976 1.5707963
+
+# atan scalar function
+query RR rowsort
+select atan(0), atan(1.7320508), atan(1)
+---
+0 1.0471976 0.7853982
+
+# atan2 scalar function
+query RR rowsort
+select atan2(0, 1), atan2(1, 2), atan2(2, 2)
+---
+1 1.0471976 1.5707963
+
+# atan2 scalar nulls
+query RR rowsort
+select atan2(null, 64) a, atan2(null) b
+----
+NULL NULL
+
+# atan2 scalar nulls 1
+query RR rowsort
+select atan2(2, null), atan2(null) b
+----
+NULL NULL
+
+# atan2 scalar nulls 2
+query RR rowsort
+select atan2(null, null), atan2(null) b
+----
+NULL NULL
+
+# ceil scalar function
+query RR rowsort
+select ceil(1.6), ceil(1.5), ceil(1.4)
+---
+1 1 1
+
+# ceil scalar nulls
+query RR rowsort
+select ceil(null)
+----
+NULL
+
+# cos scalar function
+query RR rowsort
+select cos(0), cos(1.0471976), cos(1,5707963)

Review Comment:
   I think the best option is using Pi constant: cos(0), cos(pi() / 3), cos(pi() / 2)



-- 
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