Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
add timezoneId in ColumnarUnixTimestamp (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackylee-ch authored Jul 20, 2022
1 parent 697e0de commit e7f239a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object ColumnarBinaryExpression {
case s: DateDiff =>
new ColumnarDateDiff(left, right)
case a: UnixTimestamp =>
new ColumnarUnixTimestamp(left, right)
new ColumnarUnixTimestamp(left, right, a.timeZoneId, a.failOnError)
// To match GetTimestamp (a private class).
case _ if (original.isInstanceOf[ToTimestamp] && original.dataType == TimestampType) =>
// Convert a string to Timestamp. Default timezone is used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,12 @@ object ColumnarDateTimeExpressions {
* The input is the date/time for local timezone (can be configured in spark) and the result is
* the timestamp for UTC. So we need consider timezone difference.
* */
class ColumnarUnixTimestamp(left: Expression, right: Expression)
extends UnixTimestamp(left, right) with
class ColumnarUnixTimestamp(
left: Expression,
right: Expression,
timeZoneId: Option[String] = None,
failOnError: Boolean = SQLConf.get.ansiEnabled)
extends UnixTimestamp(left, right, timeZoneId, failOnError) with
ColumnarExpression {

val yearMonthDayFormat = "yyyy-MM-dd"
Expand Down

0 comments on commit e7f239a

Please sign in to comment.