Skip to content

Commit

Permalink
Make sqllogictests platform-independent for the sign of NaNs
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Sep 1, 2023
1 parent e74cb3c commit aa6bcf9
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions datafusion/sqllogictest/test_files/predicates.slt
Original file line number Diff line number Diff line change
Expand Up @@ -254,39 +254,45 @@ foo
fazzz

statement ok
CREATE TABLE IF NOT EXISTS test_float AS VALUES(1.2),(2.1),(NULL),('NaN'::double),('-NaN'::double);
CREATE TABLE IF NOT EXISTS test_float AS VALUES
('a', 1.2),
('b', 2.1),
('c', NULL),
('d', 'NaN'::double),
('e', '-NaN'::double)
;

# IN expr for float
query R
SELECT * FROM test_float WHERE column1 IN (0.0, -1.2)
query T
SELECT column1 FROM test_float WHERE column2 IN (0.0, -1.2)
----

query R
SELECT * FROM test_float WHERE column1 IN (0.0, 1.2)
query T
SELECT column1 FROM test_float WHERE column2 IN (0.0, 1.2)
----
1.2
a

query R
SELECT * FROM test_float WHERE column1 IN (2.1, 1.2)
query T
SELECT column1 FROM test_float WHERE column2 IN (2.1, 1.2)
----
1.2
2.1
a
b

query R
SELECT * FROM test_float WHERE column1 IN (0.0, 1.2, NULL)
query T
SELECT column1 FROM test_float WHERE column2 IN (0.0, 1.2, NULL)
----
1.2
a

query R
SELECT * FROM test_float WHERE column1 IN (0.0, -1.2, NULL)
query T
SELECT column1 FROM test_float WHERE column2 IN (0.0, -1.2, NULL)
----

query R
SELECT * FROM test_float WHERE column1 IN (0.0, 1.2, 'NaN'::double, '-NaN'::double)
query T
SELECT column1 FROM test_float WHERE column2 IN (0.0, 1.2, 'NaN'::double, '-NaN'::double)
----
1.2
NaN
NaN
a
d
e

###
# Test logical plan simplifies large OR chains
Expand Down

0 comments on commit aa6bcf9

Please sign in to comment.