You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (JIRA)" <ji...@apache.org> on 2016/08/26 01:00:39 UTC

[jira] [Resolved] (SPARK-17212) TypeCoercion support widening conversion between DateType and TimestampType

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

Wenchen Fan resolved SPARK-17212.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.1.0

Issue resolved by pull request 14786
[https://github.com/apache/spark/pull/14786]

> TypeCoercion support widening conversion between DateType and TimestampType
> ---------------------------------------------------------------------------
>
>                 Key: SPARK-17212
>                 URL: https://issues.apache.org/jira/browse/SPARK-17212
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Hyukjin Kwon
>             Fix For: 2.1.0
>
>
> Currently, type-widening does not work between {{TimestampType}} and {{DateType}}.
> This applies to {{SetOperation}}, {{Union}}, {{In}}, {{CaseWhen}}, {{Greatest}}, {{Leatest}}, {{CreateArray}}, {{CreateMap}} and {{Coalesce}}.
> For a simple example, 
> {code}
> Seq(Tuple2(new Timestamp(0), new Date(0))).toDF("a", "b").selectExpr("greatest(a, b)").show()
> {code}
> {code}
> cannot resolve 'greatest(`a`, `b`)' due to data type mismatch: The expressions should all have the same type, got GREATEST(timestamp, date)
> {code}
> or Union as below:
> {code}
> val a = Seq(Tuple1(new Timestamp(0))).toDF()
> val b = Seq(Tuple1(new Date(0))).toDF()
> a.union(b).show()
> {code}
> {code}
> Union can only be performed on tables with the compatible column types. DateType <> TimestampType at the first column of the second table;
> {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