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/12/27 10:13:19 UTC
[GitHub] [spark] MaxGekk commented on pull request #34896: [SPARK-37568][SQL] Support 2-arguments by the convert_timezone() function
MaxGekk commented on pull request #34896:
URL: https://github.com/apache/spark/pull/34896#issuecomment-1001489660
@yoda-mon
1. Extend `TimeZoneAwareExpression` and add one more arg `timeZoneId` to the case class
```scala
case class ConvertTimezone(
sourceTz: Expression,
targetTz: Expression,
sourceTs: Expression,
timeZoneId: Option[String] = None)
extends TernaryExpression
with ImplicitCastInputTypes
with NullIntolerant
with TimeZoneAwareExpression {
```
2. Override `withTimeZone()`
```scala
override def withTimeZone(timeZoneId: String): TimeZoneAwareExpression = {
copy(timeZoneId = Option(timeZoneId))
}
```
3. Add 2 constructors that take 2 and 3 arguments
```scala
def this(sourceTz: Expression, targetTz: Expression, sourceTs: Expression) =
this(sourceTz, targetTz, sourceTs, None)
def this(targetTz: Expression, sourceTs: Expression) =
this(Literal("UTC", StringType), targetTz, sourceTs)
```
The source time zone in the second constructor doesn't matter since you are not going to use it.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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