Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Nov 21, 2020
1 parent 73f71c5 commit b591ff7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ trait TimestampFormatterHelper extends TimeZoneAwareExpression {
}

@ExpressionDescription(
usage = "_FUNC_() - Returns the current timezone.",
usage = "_FUNC_() - Returns the current session local timezone.",
examples = """
Examples:
> SELECT _FUNC_();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1950,8 +1950,10 @@ class DatasetSuite extends QueryTest

test("SPARK-33469: Add current_timezone function") {
val df = Seq(1).toDF("c")
val timezone = df.selectExpr("current_timezone()").collect().head.getString(0)
assert(timezone == SQLConf.get.sessionLocalTimeZone)
withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "Asia/Shanghai") {
val timezone = df.selectExpr("current_timezone()").collect().head.getString(0)
assert(timezone == "Asia/Shanghai")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class ExpressionInfoSuite extends SparkFunSuite with SharedSparkSession {
"org.apache.spark.sql.catalyst.expressions.UnixTimestamp",
"org.apache.spark.sql.catalyst.expressions.CurrentDate",
"org.apache.spark.sql.catalyst.expressions.CurrentTimestamp",
"org.apache.spark.sql.catalyst.expressions.Now",
"org.apache.spark.sql.catalyst.expressions.CurrentTimeZone",
"org.apache.spark.sql.catalyst.expressions.Now",
// Random output without a seed
"org.apache.spark.sql.catalyst.expressions.Rand",
"org.apache.spark.sql.catalyst.expressions.Randn",
Expand Down

0 comments on commit b591ff7

Please sign in to comment.