cloud-fan opened a new pull request, #53934:
URL: https://github.com/apache/spark/pull/53934

   ### What changes were proposed in this pull request?
   
   Move the timezone and locale initialization from `beforeAll()` to the 
trait's constructor body in `SparkTestSuite`.
   
   ### Why are the changes needed?
   
   This is a follow-up fix to #53784 which introduced `SparkTestSuite`.
   
   The original PR moved timezone/locale initialization from the class body to 
`beforeAll()`. This causes test failures when running tests like `RowJsonSuite` 
with Maven, because tests that create timezone-sensitive objects (like 
`java.sql.Timestamp`) during test registration fail - the timezone isn't set 
until `beforeAll()` runs, which happens after class construction.
   
   For example, in `RowJsonSuite`:
   ```scala
   testJson(
     Timestamp.valueOf("2017-01-06 10:22:03.00"),  // Created during class 
construction
     TimestampType,
     JString("2017-01-06 10:22:03"))
   ```
   
   `Timestamp.valueOf()` interprets the string in the current default timezone. 
If the system timezone is not `America/Los_Angeles`, the Timestamp represents a 
different instant, causing test failures.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only
   
   ### How was this patch tested?
   
   ```
   build/mvn test -pl sql/catalyst 
-DwildcardSuites=org.apache.spark.sql.RowJsonSuite
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to