hemanthumashankar0511 opened a new pull request, #6388:
URL: https://github.com/apache/hive/pull/6388

   What changes were proposed in this pull request?
   This PR stabilizes the static FORMATTER in TimestampTZUtil.java by 
explicitly setting its locale to Locale.US.
   
   Changes:
   
   Added import java.util.Locale;.
   
   Updated FORMATTER initialization to use builder.toFormatter(Locale.US) 
instead of the default toFormatter().
   
   Why are the changes needed?
   The changes are required to fix a DateTimeParseException observed in 
"Canary" and modern CI environments (JDK 17/21).
   
   Without an explicit locale, DateTimeFormatter falls back to the system's 
default locale. In certain environments specifically those using the CLDR 
(Unicode Common Locale Data Repository) provider—the default locale's rules for 
parsing timezone identifiers can lead to "greedy" matching. This causes the 
parser to match the "UTC" string and stop, leaving the offset (e.g., +08:00) as 
unparsed text, resulting in a failure at index 23.
   
   Hardcoding Locale.US ensures that the parsing logic is deterministic and 
consistent across all developer machines and build servers, regardless of their 
local system configuration.
   
   Does this PR introduce any user-facing change?
   No. This is an internal fix for parsing consistency. The behavior for users 
remains the same, but the reliability of parsing existing timestamp formats is 
improved across different server locales.
   
   How was this patch tested?
   The patch was verified using the following steps:
   
   Reproduction: Confirmed that 
org.apache.hadoop.hive.common.type.TestTimestampTZ fails when running with the 
CLDR provider enabled:
   mvn test -Dtest=TestTimestampTZ -DargLine="-Djava.locale.providers=CLDR"
   
   Verification: Confirmed that after adding Locale.US, the tests pass 
successfully under the same CLDR provider settings.
   
   Regression: Verified TestTimestampTZWritable (in serde) passes to ensure no 
serialization regressions.


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