You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2017/08/18 05:44:02 UTC

[jira] [Resolved] (SPARK-21739) timestamp partition would fail in v2.2.0

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

Xiao Li resolved SPARK-21739.
-----------------------------
       Resolution: Fixed
         Assignee: Feng Zhu
    Fix Version/s: 2.3.0
                   2.2.1

> timestamp partition would fail in v2.2.0
> ----------------------------------------
>
>                 Key: SPARK-21739
>                 URL: https://issues.apache.org/jira/browse/SPARK-21739
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: wangzhihao
>            Assignee: Feng Zhu
>            Priority: Critical
>             Fix For: 2.2.1, 2.3.0
>
>
> The spark v2.2.0 introduce TimeZoneAwareExpression, which causes bugs if we select data from a table with timestamp partitions.
> The steps to reproduce it:
> {code:java}
> spark.sql("create table test (foo string) parititioned by (ts timestamp)")
> spark.sql("insert into table test partition(ts = 1) values('hi')")
> spark.table("test").show()
> {code}
> The root cause is that TableReader.scala#230 try to cast the string to timestamp regardless if the timeZone exists.
> Here is the error stack trace
> {code}
> java.util.NoSuchElementException: None.get
>   at scala.None$.get(Option.scala:347)
>   at scala.None$.get(Option.scala:345)
>   at org.apache.spark.sql.catalyst.expressions.TimeZoneAwareExpression$class.timeZone(datetimeExpressions.scala:46)
>   at org.apache.spark.sql.catalyst.expressions.Cast.timeZone$lzycompute(Cast.scala:172)                                                                                         at org.apache.spark.sql.catalyst.expressions.Cast.timeZone(Cast.scala:172)
>   at org.apache.spark.sql.catalyst.expressions.Cast$$anonfun$castToTimestamp$1$$anonfun$apply$24.apply(Cast.scala:253)
>   at org.apache.spark.sql.catalyst.expressions.Cast$$anonfun$castToTimestamp$1$$anonfun$apply$24.apply(Cast.scala:253)
>   at org.apache.spark.sql.catalyst.expressions.Cast.org$apache$spark$sql$catalyst$expressions$Cast$$buildCast(Cast.scala:201)
>   at org.apache.spark.sql.catalyst.expressions.Cast$$anonfun$castToTimestamp$1.apply(Cast.scala:253)
>   at org.apache.spark.sql.catalyst.expressions.Cast.nullSafeEval(Cast.scala:533)
>   at org.apache.spark.sql.catalyst.expressions.UnaryExpression.eval(Expression.scala:327)
>   at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$5$$anonfun$fillPartitionKeys$1$1.apply(TableReader.scala:230)
>   at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$5$$anonfun$fillPartitionKeys$1$1.apply(TableReader.scala:228)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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