MaxGekk commented on a change in pull request #28998:
URL: https://github.com/apache/spark/pull/28998#discussion_r451121973
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -1176,41 +1176,15 @@ case class DateAddInterval(
copy(timeZoneId = Option(timeZoneId))
}
-/**
- * This is a common function for databases supporting TIMESTAMP WITHOUT
TIMEZONE. This function
- * takes a timestamp which is timezone-agnostic, and interprets it as a
timestamp in UTC, and
- * renders that timestamp as a timestamp in the given time zone.
- *
- * However, timestamp in Spark represents number of microseconds from the Unix
epoch, which is not
- * timezone-agnostic. So in Spark this function just shift the timestamp value
from UTC timezone to
- * the given timezone.
- *
- * This function may return confusing result if the input is a string with
timezone, e.g.
- * '2018-03-13T06:18:23+00:00'. The reason is that, Spark firstly cast the
string to timestamp
- * according to the timezone in the string, and finally display the result by
converting the
- * timestamp to string according to the session local timezone.
- */
-// scalastyle:off line.size.limit
-@ExpressionDescription(
- usage = "_FUNC_(timestamp, timezone) - Given a timestamp like '2017-07-14
02:40:00.0', interprets it as a time in UTC, and renders that time as a
timestamp in the given time zone. For example, 'GMT+1' would yield '2017-07-14
03:40:00.0'.",
- examples = """
- Examples:
- > SELECT _FUNC_('2016-08-31', 'Asia/Seoul');
- 2016-08-31 09:00:00
- """,
- group = "datetime_funcs",
- since = "1.5.0")
-// scalastyle:on line.size.limit
-case class FromUTCTimestamp(left: Expression, right: Expression)
- extends BinaryExpression with ImplicitCastInputTypes with NullIntolerant {
+trait UTCTimestamp extends BinaryExpression with ImplicitCastInputTypes with
NullIntolerant {
Review comment:
Sure, I added `sealed` and matching by both implementations.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]