srowen opened a new pull request, #44619:
URL: https://github.com/apache/spark/pull/44619

   ### What changes were proposed in this pull request?
   
   Simplify code and fix new use of DateTimeFormat.withZone introduced in 
https://github.com/apache/spark/pull/44613 ; need to use the new object copy 
this creates.
   
   ### Why are the changes needed?
   
   Describing on mailing list from Janda Martin:
   
   ```
   DateTimeFormatter is thread-safe and immutable according to JavaDoc so 
method DateTimeFormatter::withZone returns new instance when zone is changed.
   
   Following code has no effect:
     val oldTimezones = (batchTimeFormat.getZone, 
batchTimeFormatWithMilliseconds.getZone)
     if (timezone != null) {
         val zoneId = timezone.toZoneId
         batchTimeFormat.withZone(zoneId)
         batchTimeFormatWithMilliseconds.withZone(zoneId)
       }
   
   Suggested fix:
   introduce local variables for "batchTimeFormat" and 
"batchTimeFormatWithMilliseconds" and remove "oldTimezones" and "finally" block.
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Unlikely, the path in question is apparently test-only
   
   ### How was this patch tested?
   
   Existing tests
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No


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