You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "liuxian (JIRA)" <ji...@apache.org> on 2017/05/22 09:53:04 UTC

[jira] [Updated] (SPARK-20834) TypeCoercion:In case 1,loss of precision is not acceptable

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

liuxian updated SPARK-20834:
----------------------------
    Description: 
spark-sql>select if(true, 123456789, cast(1.23 as float));
spark-sql>1.23456792E8
select if(true, 123456789012345678, cast(1.23 as double));
spark-sql>1.2345678901234568E17
For these two cases, the result is not we expected, it lost precision.

  was:
spark-sql>select if(true, 123456789, cast(1.23 as float));
spark-sql>1.23456792E8
select if(true, 123456789012345678, cast(1.23 as double));
spark-sql>1.2345678901234568E17
For these two cases, the result is not we expected, it lost precision.
The rules for  `IntegerType` -> 'FloatType',   `LongType` -> 'FloatType',   `LongType` ->'DoubleType' , i think these can improve


> TypeCoercion:In case 1,loss of precision is not acceptable
> ----------------------------------------------------------
>
>                 Key: SPARK-20834
>                 URL: https://issues.apache.org/jira/browse/SPARK-20834
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: liuxian
>
> spark-sql>select if(true, 123456789, cast(1.23 as float));
> spark-sql>1.23456792E8
> select if(true, 123456789012345678, cast(1.23 as double));
> spark-sql>1.2345678901234568E17
> For these two cases, the result is not we expected, it lost precision.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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