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

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 778e43cb1c72 [SPARK-55687][SQL][TEST] Fix ComputeCurrentTimeSuite - No 
duplicate literals on JDK 25
778e43cb1c72 is described below

commit 778e43cb1c729d0f3320a7008d2edc4e838003ce
Author: Cheng Pan <[email protected]>
AuthorDate: Wed Feb 25 22:12:51 2026 -0800

    [SPARK-55687][SQL][TEST] Fix ComputeCurrentTimeSuite - No duplicate 
literals on JDK 25
    
    ### What changes were proposed in this pull request?
    
    Fix a test issue, see details at inline comments.
    
    ### Why are the changes needed?
    
    Fix a test issue that happens only on JDK 25.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    ```
    $ export JAVA_HOME=/path/of/openjdk-25
    $ build/sbt "catalyst/testOnly *ComputeCurrentTimeSuite"
    ```
    
    before
    ```
    [info] - No duplicate literals *** FAILED *** (17 milliseconds)
    [info]   28 did not equal 27 (ComputeCurrentTimeSuite.scala:262)
    [info]   org.scalatest.exceptions.TestFailedException:
    [info]   at 
org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
    [info]   at 
org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
    [info]   at 
org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
    [info]   at 
org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
    [info]   at 
org.apache.spark.sql.catalyst.optimizer.ComputeCurrentTimeSuite.checkLiterals$1(ComputeCurrentTimeSuite.scala:262)
    [info]   at 
org.apache.spark.sql.catalyst.optimizer.ComputeCurrentTimeSuite.$anonfun$new$23(ComputeCurrentTimeSuite.scala:267)
    ...
    [info] Run completed in 1 second, 623 milliseconds.
    [info] Total number of tests run: 13
    [info] Suites: completed 1, aborted 0
    [info] Tests: succeeded 12, failed 1, canceled 0, ignored 0, pending 0
    [info] *** 1 TEST FAILED ***
    [error] Failed tests:
    [error]         
org.apache.spark.sql.catalyst.optimizer.ComputeCurrentTimeSuite
    [error] (catalyst / Test / testOnly) sbt.TestsFailedException: Tests 
unsuccessful
    [error] Total time: 29 s, completed Feb 25, 2026, 10:39:59 PM
    ```
    
    after
    ```
    ...
    [info] - No duplicate literals (13 milliseconds)
    [info] Run completed in 1 second, 742 milliseconds.
    [info] Total number of tests run: 13
    [info] Suites: completed 1, aborted 0
    [info] Tests: succeeded 13, failed 0, canceled 0, ignored 0, pending 0
    [info] All tests passed.
    [success] Total time: 16 s, completed Feb 25, 2026, 10:40:31 PM
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #54483 from pan3793/SPARK-55687.
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
index 3fa6459a93e2..c4f71ec62957 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
@@ -262,11 +262,15 @@ class ComputeCurrentTimeSuite extends PlanTest {
       assert(expected === uniqueLiteralObjectIds.size)
     }
 
-    val numTimezones = ZoneId.SHORT_IDS.size
+    // Use unique ZoneIds count instead of SHORT_IDS.size because some short 
zone IDs
+    // may map to the same ZoneId (e.g., in Java 25, MST and PNT both map to 
America/Phoenix)
+    val numUniqueZoneIds = ZoneId.SHORT_IDS.asScala.map { case (zoneId, _) =>
+      ZoneId.of(zoneId, ZoneId.SHORT_IDS)
+    }.toSet.size
     checkLiterals({ _: String => CurrentTimestamp() }, 1)
-    checkLiterals({ zoneId: String => LocalTimestamp(Some(zoneId)) }, 
numTimezones)
+    checkLiterals({ zoneId: String => LocalTimestamp(Some(zoneId)) }, 
numUniqueZoneIds)
     checkLiterals({ _: String => Now() }, 1)
-    checkLiterals({ zoneId: String => CurrentDate(Some(zoneId)) }, 
numTimezones)
+    checkLiterals({ zoneId: String => CurrentDate(Some(zoneId)) }, 
numUniqueZoneIds)
   }
 
   private def literals[T](plan: LogicalPlan): 
scala.collection.mutable.ArrayBuffer[T] = {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to