[
https://issues.apache.org/jira/browse/SPARK-29638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240498#comment-17240498
]
jiaan.geng edited comment on SPARK-29638 at 11/30/20, 6:18 AM:
---------------------------------------------------------------
I runed the sql below in PgSQL
{code:java}
SELECT a, b,
SUM(b) OVER(ORDER BY A ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
FROM (VALUES(1,1),(2,2),(3,(cast('NaN' as int))),(4,3),(5,4)) t(a,b)
> ERROR: invalid input syntax for type integer: "NaN"
LINE 3: FROM (VALUES(1,1),(2,2),(3,(cast('NaN' as int))),(4,3),(5,4)...
^
> Time: 0.011s
{code}
[~DylanGuedes] Could you tell me more ?
was (Author: beliefer):
{code:java}
SELECT a, b,
SUM(b) OVER(ORDER BY A ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
FROM (VALUES(1,1),(2,2),(3,(cast('NaN' as int))),(4,3),(5,4)) t(a,b)
> ERROR: invalid input syntax for type integer: "NaN"
LINE 3: FROM (VALUES(1,1),(2,2),(3,(cast('NaN' as int))),(4,3),(5,4)...
^
> Time: 0.011s
{code}
[~DylanGuedes] Could you tell me more ?
> Spark handles 'NaN' as 0 in sums
> --------------------------------
>
> Key: SPARK-29638
> URL: https://issues.apache.org/jira/browse/SPARK-29638
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Dylan Guedes
> Priority: Major
>
> Currently, Spark handles 'NaN' as 0 in window functions, such that 3+'NaN'=3.
> PgSQL, on the other hand, handles the entire result as 'NaN', as in 3+'NaN' =
> 'NaN'
> I experienced this with the query below:
> {code:sql}
> SELECT a, b,
> SUM(b) OVER(ORDER BY A ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
> FROM (VALUES(1,1),(2,2),(3,(cast('nan' as int))),(4,3),(5,4)) t(a,b);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]