This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 75ff69a  [SPARK-36037][TESTS][FOLLOWUP] Avoid wrong test results on 
daylight saving time
75ff69a is described below

commit 75ff69a9940776f0337a080b721d45d9f571c386
Author: Gengliang Wang <gengli...@apache.org>
AuthorDate: Thu Jul 15 11:40:51 2021 +0300

    [SPARK-36037][TESTS][FOLLOWUP] Avoid wrong test results on daylight saving 
time
    
    ### What changes were proposed in this pull request?
    
    Only use the zone ids that has no daylight saving for testing 
`localtimestamp`
    
    ### Why are the changes needed?
    
    https://github.com/apache/spark/pull/33346#discussion_r670135296 MaxGekk 
suggests that we should avoid wrong results if possible.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    ### How was this patch tested?
    
    Unit test
    
    Closes #33354 from gengliangwang/FIxDST.
    
    Authored-by: Gengliang Wang <gengli...@apache.org>
    Signed-off-by: Max Gekk <max.g...@gmail.com>
    (cherry picked from commit 564d3de7c62fa89c6db1e08e809400b339a704cd)
    Signed-off-by: Max Gekk <max.g...@gmail.com>
---
 .../apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala
index dbfe0af..eecaa93 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala
@@ -97,7 +97,8 @@ class DateExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
   }
 
   test("datetime function localtimestamp") {
-    outstandingTimezonesIds.foreach { zid =>
+    // Verify with multiple outstanding time zones which has no daylight 
saving time.
+    Seq("UTC", "Africa/Dakar", "Asia/Hong_Kong").foreach { zid =>
       val zoneId = DateTimeUtils.getZoneId(zid)
       val ct = LocalTimestamp(Some(zid)).eval(EmptyRow).asInstanceOf[Long]
       val t1 = DateTimeUtils.localDateTimeToMicros(LocalDateTime.now(zoneId))

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to