Eric Yang created SPARK-57298:
---------------------------------

             Summary: collect_set returns duplicate NaN values for float/double 
columns
                 Key: SPARK-57298
                 URL: https://issues.apache.org/jira/browse/SPARK-57298
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Eric Yang


`collect_set` is documented to return a set of distinct elements, and under 
Spark SQL semantics all NaN values are equal (and `-0.0 == 0.0`). However, 
`collect_set` over float/double columns returns duplicate `NaN` elements:
{code:java}
SELECT collect_set(v) FROM VALUES (double('NaN')), (double('NaN')) AS t(v);
-- actual:   [NaN, NaN]
-- expected: [NaN] {code}
This is inconsistent with array_distinct , count(DISTINCT), 
grouping/join/window keys, and the array set operations - all of which treat 
NaNs as equal.
 
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to