You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/10 17:47:41 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #32869: [SPARK-35716][SQL] Support casting of timestamp without time zone to date type
cloud-fan commented on a change in pull request #32869:
URL: https://github.com/apache/spark/pull/32869#discussion_r649399569
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -1204,6 +1207,11 @@ abstract class CastBase extends UnaryExpression with TimeZoneAwareExpression wit
(c, evPrim, evNull) =>
code"""$evPrim =
org.apache.spark.sql.catalyst.util.DateTimeUtils.microsToDays($c, $zid);"""
+ case TimestampWithoutTZType =>
+ (c, evPrim, evNull) =>
+ // scalastyle:off line.size.limit
+ code"$evPrim = org.apache.spark.sql.catalyst.util.DateTimeUtils.microsToDays($c, java.time.ZoneOffset.UTC);"
Review comment:
nit: we can add a `protected def dtUtilCls = classOf[DateTimeUtils].getClass.getName` in `CaseBase`, to shorten the code here and other places.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org