[ 
https://issues.apache.org/jira/browse/SPARK-33306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17224525#comment-17224525
 ] 

Apache Spark commented on SPARK-33306:
--------------------------------------

User 'MaxGekk' has created a pull request for this issue:
https://github.com/apache/spark/pull/30223

> TimezoneID is needed when there cast from Date to String
> --------------------------------------------------------
>
>                 Key: SPARK-33306
>                 URL: https://issues.apache.org/jira/browse/SPARK-33306
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0, 3.0.1, 3.1.0
>            Reporter: EdisonWang
>            Assignee: EdisonWang
>            Priority: Major
>             Fix For: 3.0.2, 3.1.0
>
>
> A simple way to reproduce this is 
> {code}
> spark-shell --conf spark.sql.legacy.typeCoercion.datetimeToString.enabled
> scala> sql("""
> select a.d1 from
>  (select to_date(concat('2000-01-0', id)) as d1 from range(1, 2)) a
>  join
>  (select concat('2000-01-0', id) as d2 from range(1, 2)) b
>  on a.d1 = b.d2
> """).show
> {code}
>  
> it will throw
> {code}
> java.util.NoSuchElementException: None.get
>  at scala.None$.get(Option.scala:529)
>  at scala.None$.get(Option.scala:527)
>  at 
> org.apache.spark.sql.catalyst.expressions.TimeZoneAwareExpression.zoneId(datetimeExpressions.scala:56)
>  at 
> org.apache.spark.sql.catalyst.expressions.TimeZoneAwareExpression.zoneId$(datetimeExpressions.scala:56)
>  at 
> org.apache.spark.sql.catalyst.expressions.CastBase.zoneId$lzycompute(Cast.scala:253)
>  at org.apache.spark.sql.catalyst.expressions.CastBase.zoneId(Cast.scala:253)
>  at 
> org.apache.spark.sql.catalyst.expressions.CastBase.dateFormatter$lzycompute(Cast.scala:287)
>  at 
> org.apache.spark.sql.catalyst.expressions.CastBase.dateFormatter(Cast.scala:287)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to