[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 <gengliang@apache.org>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
(cherry picked from commit 564d3de7c6)
Signed-off-by: Max Gekk <max.gekk@gmail.com>
This commit is contained in:
Gengliang Wang 2021-07-15 11:40:51 +03:00 committed by Max Gekk
parent 384bee3663
commit 75ff69a994

View file

@ -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))