spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (SPARK-9264) When dealing with Union/Intersect/Except, we cast FloatType/DoubleType to the wrong DecimalType
Date Thu, 23 Jul 2015 15:47:05 GMT

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

Apache Spark reassigned SPARK-9264:
-----------------------------------

    Assignee: Davies Liu  (was: Apache Spark)

> When dealing with Union/Intersect/Except, we cast FloatType/DoubleType to the wrong DecimalType
> -----------------------------------------------------------------------------------------------
>
>                 Key: SPARK-9264
>                 URL: https://issues.apache.org/jira/browse/SPARK-9264
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 1.4.0
>            Reporter: Yin Huai
>            Assignee: Davies Liu
>            Priority: Blocker
>
> The problem is https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala#L361-L362.
When we union/intersect/except, for a column, if the data type of it in one table is a fixed
precision decimal type and that in another table is a FloatType/DoubleType, we cast FloatType
to Decimal(7, 7) and cast DoubleType to Decimal(15, 15), respectively. It is wrong.
> I tried the following in 1.4
> {code}
> sqlContext.sql("select a from (select cast(200.101 as double) as a union all select cast(200.101
as decimal(6,3)) as a) tmp").show
> {code}
> I got 
> {code}
> +-------------------+
> |                  a|
> +-------------------+
> |               null|
> |200.101000000000000|
> +-------------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message