Skip to content

Commit

Permalink
add greatest slt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton committed Nov 16, 2024
1 parent 4df3c39 commit 1c51c87
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions datafusion/sqllogictest/test_files/functions.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,6 @@ select contains('', '');
true

# test for greatest

statement ok
CREATE TABLE t1 (a int, b int, c int) as VALUES
(4, NULL, NULL),
Expand All @@ -1364,11 +1363,9 @@ SELECT greatest(a, b, c) FROM t1
NULL
3


statement ok
drop table t1


query I
SELECT greatest(1)
----
Expand Down Expand Up @@ -1497,3 +1494,49 @@ SELECT greatest(NULL, NULL, NULL, a, -1) FROM foo

statement ok
drop table foo

query R
select greatest(arrow_cast('NAN','Float64'), arrow_cast('NAN','Float64'))
----
NaN

query R
select greatest(arrow_cast('NAN','Float64'), arrow_cast('NAN','Float32'))
----
NaN

query R
select greatest(arrow_cast('NAN','Float64'), '+Inf'::Double)
----
NaN

query R
select greatest(arrow_cast('NAN','Float64'), NULL)
----
NaN

query R
select greatest(NULL, '+Inf'::Double)
----
Infinity

query R
select greatest(NULL, '-Inf'::Double)
----
-Infinity

statement ok
CREATE TABLE t1 (a double, b double, c double) as VALUES
(1, arrow_cast('NAN', 'Float64'), '+Inf'::Double),
(NULL, arrow_cast('NAN','Float64'), '+Inf'::Double),
(1, '+Inf'::Double, NULL);

query R
SELECT greatest(a, b, c) FROM t1
----
NaN
NaN
Infinity

statement ok
drop table t1

0 comments on commit 1c51c87

Please sign in to comment.