Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/16308#discussion_r97330451 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DateFunctionsSuite.scala --- @@ -69,11 +70,28 @@ class DateFunctionsSuite extends QueryTest with SharedSQLContext { checkAnswer( df.select("t").filter($"t" <= "2014-06-01"), Row(Timestamp.valueOf("2014-01-01 00:00:00")) :: Nil) + } + test("timestamp comparison with timestamp strings with session local timezone") { + val df = Seq( + (1, Timestamp.valueOf("2015-12-31 16:00:00")), + (2, Timestamp.valueOf("2016-01-01 00:00:00"))).toDF("i", "t") checkAnswer( - df.select("t").filter($"t" >= "2014-06-01"), - Row(Timestamp.valueOf("2015-01-01 00:00:00")) :: Nil) + df.select("t").filter($"t" <= "2016-01-01 00:00:00"), + Seq( + Row(Timestamp.valueOf("2015-12-31 16:00:00")), + Row(Timestamp.valueOf("2016-01-01 00:00:00")))) + + withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "GMT") { + + // $"t" string in GMT would be as follows respectively: + // "2016-01-01 00:00:00" + // "2016-01-01 08:00:00" + checkAnswer( + df.select("t").filter($"t" <= "2016-01-01 00:00:00"), + Row(Timestamp.valueOf("2015-12-31 16:00:00"))) --- End diff -- this shows that it will be very confusing if the session local timezone is different from JVM default timezone in driver...
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org