You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2019/05/20 02:54:00 UTC

[jira] [Comment Edited] (SPARK-27768) Infinity, -Infinity, NaN should be recognized in a case insensitive manner

    [ https://issues.apache.org/jira/browse/SPARK-27768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843595#comment-16843595 ] 

Dongjoon Hyun edited comment on SPARK-27768 at 5/20/19 2:53 AM:
----------------------------------------------------------------

FYI, Spark behavior is compatible with Hive (1.2.1 ~ 2.3.4).
{code}
hive> select CAST('infinity' AS DOUBLE), CAST('Infinity' AS DOUBLE);
OK
NULL	Infinity
{code}


was (Author: dongjoon):
FYI, Spark behavior is compatible with Hive.
{code}
hive> select CAST('infinity' AS DOUBLE), CAST('Infinity' AS DOUBLE);
OK
NULL	Infinity
{code}

> Infinity, -Infinity, NaN should be recognized in a case insensitive manner
> --------------------------------------------------------------------------
>
>                 Key: SPARK-27768
>                 URL: https://issues.apache.org/jira/browse/SPARK-27768
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Xiao Li
>            Priority: Major
>
> When the inputs contain the constant 'infinity', Spark SQL does not generate the expected results.
> {code:java}
> SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
> FROM (VALUES ('1'), (CAST('infinity' AS DOUBLE))) v(x);
> SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
> FROM (VALUES ('infinity'), ('1')) v(x);
> SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
> FROM (VALUES ('infinity'), ('infinity')) v(x);
> SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
> FROM (VALUES ('-infinity'), ('infinity')) v(x);{code}
>  The root cause: Spark SQL does not recognize the special constants in a case insensitive way. In PostgreSQL, they are recognized in a case insensitive way. 
> Link: https://www.postgresql.org/docs/9.3/datatype-numeric.html 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org