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

[jira] [Updated] (SPARK-28028) Cast numeric to integral type need round

     [ https://issues.apache.org/jira/browse/SPARK-28028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yuming Wang updated SPARK-28028:
--------------------------------
    Description: 
For example
 Case 1:
{code:sql}
select cast(-1.5 as smallint);
{code}
Spark SQL returns {{-1}}, but PostgreSQL returns {{-2}}.

 

Case 2:
{code:sql}
SELECT smallint(float('32767.6'))
{code}
Spark SQL returns {{32767}}, but PostgreSQL throws {{ERROR: smallint out of range}}.

  was:
For example:
{code:sql}
select cast(-1.5 as smallint);
{code}
Spark SQL returns {{-1}}, but PostgreSQL returns {{-2}}.


> Cast numeric to integral type need round
> ----------------------------------------
>
>                 Key: SPARK-28028
>                 URL: https://issues.apache.org/jira/browse/SPARK-28028
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> For example
>  Case 1:
> {code:sql}
> select cast(-1.5 as smallint);
> {code}
> Spark SQL returns {{-1}}, but PostgreSQL returns {{-2}}.
>  
> Case 2:
> {code:sql}
> SELECT smallint(float('32767.6'))
> {code}
> Spark SQL returns {{32767}}, but PostgreSQL throws {{ERROR: smallint out of range}}.



--
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