[ 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org