Dongjoon Hyun created SPARK-14051:
-------------------------------------
Summary: Implement `Double.NaN==Float.NaN` in `row.equals` for
consistency
Key: SPARK-14051
URL: https://issues.apache.org/jira/browse/SPARK-14051
Project: Spark
Issue Type: Bug
Components: SQL
Reporter: Dongjoon Hyun
Priority: Minor
Since SPARK-9079 and SPARK-9145, `NaN = NaN` returns true and works well. The
only exception case is direct comparison between `Row(Float.NaN)` and
`Row(Double.NaN)`. The following is the example: the last expression should be
true for consistency.
{code}
scala>
Seq((1d,1f),(Double.NaN,Float.NaN)).toDF("a","b").registerTempTable("tmp")
scala> sql("select a,b,a=b from tmp").collect()
res1: Array[org.apache.spark.sql.Row] = Array([1.0,1.0,true], [NaN,NaN,true])
scala> val row_a = sql("select a from tmp").collect()
row_a: Array[org.apache.spark.sql.Row] = Array([1.0], [NaN])
scala> val row_b = sql("select b from tmp").collect()
row_b: Array[org.apache.spark.sql.Row] = Array([1.0], [NaN])
scala> row_a(0) == row_b(0)
res2: Boolean = true
scala> row_a(1) == row_b(1)
res3: Boolean = false
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]