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

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

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

Gengliang Wang commented on SPARK-28028:
----------------------------------------

I tried Hive with
 select cast(-1.5 as smallint);

It returns -1. Is there a standard for this?

> 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