cloud-fan commented on a change in pull request #27474: [SPARK-30752][SQL] Fix
`to_utc_timestamp` on daylight saving day
URL: https://github.com/apache/spark/pull/27474#discussion_r376220075
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -1382,14 +1382,14 @@ case class ToUTCTimestamp(left: Expression, right:
Expression)
|long ${ev.value} = 0;
""".stripMargin)
} else {
- val tzClass = classOf[TimeZone].getName
+ val tzClass = classOf[ZoneId].getName
val dtu = DateTimeUtils.getClass.getName.stripSuffix("$")
val escapedTz = StringEscapeUtils.escapeJava(tz.toString)
val tzTerm = ctx.addMutableState(tzClass, "tz",
- v => s"""$v = $dtu.getTimeZone("$escapedTz");""")
+ v => s"""$v = $dtu.getZoneId("$escapedTz");""")
val utcTerm = "tzUTC"
ctx.addImmutableStateIfNotExists(tzClass, utcTerm,
- v => s"""$v = $dtu.getTimeZone("UTC");""")
+ v => s"""$v = java.time.ZoneOffset.UTC;""")
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]