You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "hemanthumashankar0511 (via GitHub)" <gi...@apache.org> on 2026/03/23 06:07:33 UTC

[PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6388:
URL: https://github.com/apache/hive/pull/6388#issuecomment-4115869655

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "soumyakanti3578 (via GitHub)" <gi...@apache.org>.
soumyakanti3578 commented on code in PR #6388:
URL: https://github.com/apache/hive/pull/6388#discussion_r2978442924


##########
common/src/java/org/apache/hadoop/hive/common/type/TimestampTZUtil.java:
##########
@@ -84,7 +85,7 @@ public class TimestampTZUtil {
     builder.optionalStart().appendLiteral(" ").optionalEnd();
     builder.optionalStart().appendZoneOrOffsetId().optionalEnd();
 
-    FORMATTER = builder.toFormatter();
+    FORMATTER = builder.toFormatter(Locale.US);

Review Comment:
   Please add a short comment here explaining why we have to hardcode the locale.
   



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "soumyakanti3578 (via GitHub)" <gi...@apache.org>.
soumyakanti3578 merged PR #6388:
URL: https://github.com/apache/hive/pull/6388


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6388:
URL: https://github.com/apache/hive/pull/6388#issuecomment-4109760773

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "hemanthumashankar0511 (via GitHub)" <gi...@apache.org>.
hemanthumashankar0511 commented on code in PR #6388:
URL: https://github.com/apache/hive/pull/6388#discussion_r2979108729


##########
common/src/java/org/apache/hadoop/hive/common/type/TimestampTZUtil.java:
##########
@@ -84,7 +85,7 @@ public class TimestampTZUtil {
     builder.optionalStart().appendLiteral(" ").optionalEnd();
     builder.optionalStart().appendZoneOrOffsetId().optionalEnd();
 
-    FORMATTER = builder.toFormatter();
+    FORMATTER = builder.toFormatter(Locale.US);

Review Comment:
   Sure!!



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "hemanthumashankar0511 (via GitHub)" <gi...@apache.org>.
hemanthumashankar0511 commented on PR #6388:
URL: https://github.com/apache/hive/pull/6388#issuecomment-4160701031

   @soumyakanti3578 Could u please merge this !!


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-29521: Unit tests TestTimestampTZ, TestTimestampTZWritable fail due to different JDK locale [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6388:
URL: https://github.com/apache/hive/pull/6388#issuecomment-4108530129

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6388&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6388&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6388&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6388)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org