Skip to content

Commit 4413310

Browse files
committed
Add test to confirm double casting behaviour
1 parent 285a576 commit 4413310

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • datafusion/sqllogictest/test_files/spark/math

‎datafusion/sqllogictest/test_files/spark/math/isnan.slt‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,16 @@ true
7070
false
7171
false
7272
false
73+
74+
# Spark's isnan accepts any numeric type by implicitly casting to double, so
75+
# integers, bigints, and decimals all return false (they can never be NaN).
76+
# This test guards against the signature being accidentally narrowed in a way
77+
# that would diverge from Spark.
78+
query BBBB
79+
SELECT
80+
isnan(1) AS int_lit,
81+
isnan(CAST(1 AS BIGINT)) AS bigint,
82+
isnan(CAST(1 AS DECIMAL(10, 2))) AS dec,
83+
isnan(CAST(NULL AS INT)) AS null_int;
84+
----
85+
false false false false

0 commit comments

Comments
 (0)