You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "stankiewicz (via GitHub)" <gi...@apache.org> on 2026/03/05 10:47:29 UTC

[PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

stankiewicz opened a new pull request, #37775:
URL: https://github.com/apache/beam/pull/37775

   This PR removes the JavaTimeDefaultTimeZone ErrorProne check from the disabledChecks list in src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy to enforce it globally.
   Additionally, it resolves all existing JavaTimeDefaultTimeZone warnings across the project. 
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/actions/workflows/python_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/actions/workflows/java_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/actions/workflows/go_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
   


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4150059074

   Reminder, please take a look at this pr: @kennknowles @Abacn 


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #37775:
URL: https://github.com/apache/beam/pull/37775#discussion_r2906224878


##########
sdks/java/io/influxdb/src/test/java/org/apache/beam/sdk/io/influxdb/GenerateData.java:
##########
@@ -40,13 +41,13 @@ static List<String> getMetric(String metric, int number) {
       m.addField("field2", random.nextInt(100));
       LocalDateTime time =
           LocalDateTime.of(
-              LocalDate.now(),
+              LocalDate.now(ZoneId.of("America/Los_Angeles")),
               LocalTime.of(
                   random.nextInt(24),
                   random.nextInt(60),
                   random.nextInt(60),
                   random.nextInt(999999999 + 1)));
-      ZonedDateTime zdt = time.atZone(ZoneId.of("America/Los_Angeles"));
+      ZonedDateTime zdt = time.atZone(ZoneOffset.UTC);

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   There seems to be a logic inconsistency here. The `LocalDateTime` `time` is constructed using a date from the `America/Los_Angeles` timezone (line 44), but then it's interpreted as being in UTC here. This is likely not the intended behavior.
   
   To maintain consistency, you should probably use the same timezone for `atZone` as you used for `LocalDate.now`. The original code `time.atZone(ZoneId.of("America/Los_Angeles"))` seems more correct in this context.
   
   ```suggestion
         ZonedDateTime zdt = time.atZone(ZoneId.of("America/Los_Angeles"));
   ```



-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4024155353

   might as well see if it has follow ups :-)


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4011916857

   Run Java PreCommit


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4024154350

   /gemini review


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4169792889

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @chamikaramj for label java.
   R: @liferoad for label build.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #37775:
URL: https://github.com/apache/beam/pull/37775#discussion_r2890344867


##########
sdks/java/io/influxdb/src/test/java/org/apache/beam/sdk/io/influxdb/GenerateData.java:
##########
@@ -40,7 +40,7 @@ static List<String> getMetric(String metric, int number) {
       m.addField("field2", random.nextInt(100));
       LocalDateTime time =
           LocalDateTime.of(
-              LocalDate.now(),
+              LocalDate.now(ZoneId.systemDefault()),

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The current date is being fetched using the system's default timezone, but then it's being combined with a random time and interpreted in the `America/Los_Angeles` timezone. This can lead to incorrect timestamps, especially around date boundaries. To ensure correctness, the date should be obtained directly in the `America/Los_Angeles` timezone.
   
   ```suggestion
                 LocalDate.now(ZoneId.of("America/Los_Angeles")),
   ```



##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProtoTest.java:
##########
@@ -253,9 +254,9 @@ public class BeamRowToStorageApiProtoTest {
           .withFieldValue("arrayValue", ImmutableList.of("one", "two", "red", "blue"))
           .withFieldValue("arrayNullValue", null)
           .withFieldValue("iterableValue", ImmutableList.of("blue", "red", "two", "one"))
-          .withFieldValue("sqlDateValue", LocalDate.now())
-          .withFieldValue("sqlTimeValue", LocalTime.now())
-          .withFieldValue("sqlDatetimeValue", LocalDateTime.now())
+          .withFieldValue("sqlDateValue", LocalDate.now(ZoneId.systemDefault()))
+          .withFieldValue("sqlTimeValue", LocalTime.now(ZoneId.systemDefault()))
+          .withFieldValue("sqlDatetimeValue", LocalDateTime.now(ZoneId.systemDefault()))

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Using `ZoneId.systemDefault()` to initialize a static test data field can lead to flaky tests that depend on the timezone of the execution environment. It's better to use a fixed timezone, like `ZoneId.of("UTC")`, to ensure deterministic test data.
   
   ```suggestion
             .withFieldValue("sqlDateValue", LocalDate.now(ZoneId.of("UTC")))
             .withFieldValue("sqlTimeValue", LocalTime.now(ZoneId.of("UTC")))
             .withFieldValue("sqlDatetimeValue", LocalDateTime.now(ZoneId.of("UTC")))
   ```



##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/impl/schema/BeamSqlRowCoderTest.java:
##########
@@ -70,9 +71,9 @@ public void encodeAndDecode() throws Exception {
                 1.1,
                 BigDecimal.ZERO,
                 "hello",
-                LocalTime.now(),
-                LocalDate.now(),
-                LocalDateTime.now(),
+                LocalTime.now(ZoneId.systemDefault()),
+                LocalDate.now(ZoneId.systemDefault()),
+                LocalDateTime.now(ZoneId.systemDefault()),

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky as they depend on the timezone of the machine running the test. For better test stability and reproducibility, it's recommended to use a fixed timezone, such as `ZoneId.of("UTC")`.
   
   ```suggestion
                   LocalTime.now(ZoneId.of("UTC")),
                   LocalDate.now(ZoneId.of("UTC")),
                   LocalDateTime.now(ZoneId.of("UTC")),
   ```



##########
sdks/java/io/influxdb/src/test/java/org/apache/beam/sdk/io/influxdb/GenerateData.java:
##########
@@ -64,7 +64,7 @@ static List<String> getMultipleMetric(List<String> metrics, int number) {
         m.addField("field2", random.nextInt(100));
         LocalDateTime time =
             LocalDateTime.of(
-                LocalDate.now(),
+                LocalDate.now(ZoneId.systemDefault()),

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Similar to the other instance in this file, the current date is being fetched using the system's default timezone and then interpreted in `America/Los_Angeles`. This can lead to incorrect data. Please fetch the date using the `America/Los_Angeles` timezone directly.
   
   ```suggestion
                   LocalDate.now(ZoneId.of("America/Los_Angeles")),
   ```



##########
sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java:
##########
@@ -59,7 +59,7 @@ public void testTzTimestamp() {
 
   @Test
   public void testUtcTimeOnly() {
-    LocalTime time = LocalTime.now();
+    LocalTime time = LocalTime.now(ZoneId.systemDefault());

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky as they depend on the timezone of the machine running the test. For better test stability and reproducibility, it's recommended to use a fixed timezone, such as `ZoneId.of("UTC")`, especially since the class under test is `UTCTimeOnly`.
   
   ```suggestion
       LocalTime time = LocalTime.now(ZoneId.of("UTC"));
   ```



##########
sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java:
##########
@@ -89,7 +89,7 @@ public void testUtcDateOnly() {
 
   @Test
   public void testLocalMktDate() {
-    LocalDate date = LocalDate.now();
+    LocalDate date = LocalDate.now(ZoneId.systemDefault());

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky. For better test stability, please use a fixed timezone like `ZoneId.of("UTC")`.
   
   ```suggestion
       LocalDate date = LocalDate.now(ZoneId.of("UTC"));
   ```



##########
sdks/java/io/azure/src/test/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystemTest.java:
##########
@@ -111,7 +111,8 @@ public void beforeClass() {
     when(mockedBlobClient.getBlockBlobClient()).thenReturn(mockedBlockBlob);
     when(mockedBlobClient.getProperties()).thenReturn(mockedProperties);
     when(mockedProperties.getBlobSize()).thenReturn(Long.valueOf(1));
-    when(mockedProperties.getLastModified()).thenReturn(OffsetDateTime.now());
+    when(mockedProperties.getLastModified())
+        .thenReturn(OffsetDateTime.now(java.time.ZoneId.systemDefault()));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky. For better test stability, please use a fixed timezone like UTC. You can use `java.time.ZoneOffset.UTC`.
   
   ```suggestion
       when(mockedProperties.getLastModified())
           .thenReturn(OffsetDateTime.now(java.time.ZoneOffset.UTC));
   ```



##########
sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java:
##########
@@ -79,7 +79,7 @@ public void testTzTimeOnly() {
 
   @Test
   public void testUtcDateOnly() {
-    LocalDate date = LocalDate.now();
+    LocalDate date = LocalDate.now(ZoneId.systemDefault());

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky. For better test stability, please use a fixed timezone like `ZoneId.of("UTC")`, especially given the class under test is `UTCDateOnly`.
   
   ```suggestion
       LocalDate date = LocalDate.now(ZoneId.of("UTC"));
   ```



##########
sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTestUtils.java:
##########
@@ -343,7 +343,7 @@ static long refreshIndexAndGetCurrentNumDocs(
   static List<String> createDocuments(long numDocs, InjectionMode injectionMode) {
 
     ArrayList<String> data = new ArrayList<>();
-    LocalDateTime baseDateTime = LocalDateTime.now();
+    LocalDateTime baseDateTime = LocalDateTime.now(java.time.ZoneId.systemDefault());

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `ZoneId.systemDefault()` can make tests flaky as they depend on the timezone of the machine running the test. For better test stability, please use a fixed timezone like UTC. You can use `java.time.ZoneOffset.UTC`.
   
   ```suggestion
       LocalDateTime baseDateTime = LocalDateTime.now(java.time.ZoneOffset.UTC);
   ```



-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4004172494

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
   
   This pull request aims to improve code quality and consistency by enforcing the `JavaTimeDefaultTimeZone` ErrorProne check. This ensures that developers explicitly handle time zones when creating `java.time` objects, preventing potential issues arising from implicit reliance on the system's default time zone. The changes involve enabling the check and updating existing code to comply with this new standard.
   
   ### Highlights
   
   * **ErrorProne Check Enabled**: The `JavaTimeDefaultTimeZone` ErrorProne check has been enabled globally by removing it from the disabled checks list in `BeamModulePlugin.groovy`.
   * **Time Zone Warnings Resolved**: All existing warnings related to `JavaTimeDefaultTimeZone` across the project have been resolved by explicitly specifying `ZoneId.systemDefault()` when obtaining current time/date instances.
   
   🧠 **New Feature in Public Preview:** You can now enable **Memory** to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
   
   <details>
   <summary><b>Changelog</b></summary>
   
   * **buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy**
       * Removed 'JavaTimeDefaultTimeZone' from the list of disabled ErrorProne checks.
   * **sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java**
       * Modified `LocalTime.now()` and `LocalDate.now()` calls to explicitly use `ZoneId.systemDefault()`.
   * **sdks/java/io/azure/src/test/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystemTest.java**
       * Updated `OffsetDateTime.now()` call to explicitly use `java.time.ZoneId.systemDefault()`.
   * **sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTestUtils.java**
       * Modified `LocalDateTime.now()` call to explicitly use `java.time.ZoneId.systemDefault()`.
   </details>
   
   <details>
   <summary><b>Activity</b></summary>
   
   * The pull request was opened by stankiewicz.
   * Initial code changes were submitted to enable the `JavaTimeDefaultTimeZone` ErrorProne check and resolve related warnings.
   * No review comments or further activity have been recorded yet.
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
   
   Feature | Command | Description
   --- | --- | ---
   Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
   Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
   Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
   Help | `/gemini help` | Displays a list of available commands.
   
   <b>Customization</b>
   
   To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   <b>You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the [Gemini Code Assist IDE Extension](https://cloud.google.com/products/gemini/code-assist).</b>
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4023142923

   assign set of reviewers


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4054230047

   Run Java PreCommit


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4004478026

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4022604951

   Run Java PreCommit


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4023148806

   Assigning reviewers:
   
   R: @kennknowles for label java.
   R: @Abacn for label build.
   
   
   Note: If you would like to opt out of this review, comment `assign to next reviewer`.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4006227365

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/37775?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 56.87%. Comparing base ([`5a6f763`](https://app.codecov.io/gh/apache/beam/commit/5a6f763da545a72416a4809d7d53e0927526233e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a744f94`](https://app.codecov.io/gh/apache/beam/commit/a744f942ace1dd1a248e7656e983e95aafb240ac?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 22 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #37775      +/-   ##
   ============================================
   + Coverage     54.75%   56.87%   +2.11%     
   - Complexity     1676     3417    +1741     
   ============================================
     Files          1064     1178     +114     
     Lines        166824   187492   +20668     
     Branches       1208     3590    +2382     
   ============================================
   + Hits          91338   106628   +15290     
   - Misses        73303    77472    +4169     
   - Partials       2183     3392    +1209     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/beam/pull/37775/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [java](https://app.codecov.io/gh/apache/beam/pull/37775/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.96% <ø> (+4.57%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/37775?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4098853321

   Run SQL PreCommit


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4054241179

   Run Java_GCP_IO_Direct PreCommit


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4236425608

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @kennknowles for label java.
   R: @damccorm for label build.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4005420883

   /gemini review


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #37775:
URL: https://github.com/apache/beam/pull/37775#discussion_r2905797427


##########
sdks/java/io/azure/src/test/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystemTest.java:
##########
@@ -111,7 +111,8 @@ public void beforeClass() {
     when(mockedBlobClient.getBlockBlobClient()).thenReturn(mockedBlockBlob);
     when(mockedBlobClient.getProperties()).thenReturn(mockedProperties);
     when(mockedProperties.getBlobSize()).thenReturn(Long.valueOf(1));
-    when(mockedProperties.getLastModified()).thenReturn(OffsetDateTime.now());
+    when(mockedProperties.getLastModified())
+        .thenReturn(OffsetDateTime.now(java.time.ZoneOffset.UTC));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To improve readability, please add an import for `java.time.ZoneOffset` and use `ZoneOffset.UTC` directly. This aligns with the Google Java Style Guide's preference for simple names over fully-qualified ones when unambiguous.
   
   ```suggestion
       when(mockedProperties.getLastModified())
           .thenReturn(OffsetDateTime.now(ZoneOffset.UTC));
   ```
   
   <details>
   <summary>References</summary>
   
   1. The Google Java Style Guide (section 6.2) recommends using the simple name of a class when it is unambiguous, rather than the fully-qualified name. Importing `ZoneOffset` and using its simple name improves code readability. <sup>([link](http://console.cloud.google.com/gemini-code-assist/agents-tools))</sup>
   </details>



##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/impl/schema/BeamSqlRowCoderTest.java:
##########
@@ -70,9 +71,9 @@ public void encodeAndDecode() throws Exception {
                 1.1,
                 BigDecimal.ZERO,
                 "hello",
-                LocalTime.now(),
-                LocalDate.now(),
-                LocalDateTime.now(),
+                LocalTime.now(ZoneId.of("UTC")),
+                LocalDate.now(ZoneId.of("UTC")),
+                LocalDateTime.now(ZoneId.of("UTC")),

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` instead of `ZoneId.of("UTC")`. This requires replacing the import for `java.time.ZoneId` with `java.time.ZoneOffset`.
   
   ```suggestion
                   LocalTime.now(ZoneOffset.UTC),
                   LocalDate.now(ZoneOffset.UTC),
                   LocalDateTime.now(ZoneOffset.UTC),
   ```



##########
sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java:
##########
@@ -59,7 +59,7 @@ public void testTzTimestamp() {
 
   @Test
   public void testUtcTimeOnly() {
-    LocalTime time = LocalTime.now();
+    LocalTime time = LocalTime.now(ZoneId.of("UTC"));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` instead of `ZoneId.of("UTC")`. This also applies to the other occurrences in this file (lines 82 and 92). This requires adding an import for `java.time.ZoneOffset`.
   
   ```suggestion
       LocalTime time = LocalTime.now(ZoneOffset.UTC);
   ```



##########
sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTestUtils.java:
##########
@@ -343,7 +343,7 @@ static long refreshIndexAndGetCurrentNumDocs(
   static List<String> createDocuments(long numDocs, InjectionMode injectionMode) {
 
     ArrayList<String> data = new ArrayList<>();
-    LocalDateTime baseDateTime = LocalDateTime.now();
+    LocalDateTime baseDateTime = LocalDateTime.now(java.time.ZoneOffset.UTC);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To improve readability, please add an import for `java.time.ZoneOffset` and use `ZoneOffset.UTC` directly. This aligns with the Google Java Style Guide's preference for simple names over fully-qualified ones when unambiguous.
   
   ```suggestion
       LocalDateTime baseDateTime = LocalDateTime.now(ZoneOffset.UTC);
   ```
   
   <details>
   <summary>References</summary>
   
   1. The Google Java Style Guide (section 6.2) recommends using the simple name of a class when it is unambiguous, rather than the fully-qualified name. Importing `ZoneOffset` and using its simple name improves code readability. <sup>([link](http://console.cloud.google.com/gemini-code-assist/agents-tools))</sup>
   </details>



##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProtoTest.java:
##########
@@ -253,9 +254,9 @@ public class BeamRowToStorageApiProtoTest {
           .withFieldValue("arrayValue", ImmutableList.of("one", "two", "red", "blue"))
           .withFieldValue("arrayNullValue", null)
           .withFieldValue("iterableValue", ImmutableList.of("blue", "red", "two", "one"))
-          .withFieldValue("sqlDateValue", LocalDate.now())
-          .withFieldValue("sqlTimeValue", LocalTime.now())
-          .withFieldValue("sqlDatetimeValue", LocalDateTime.now())
+          .withFieldValue("sqlDateValue", LocalDate.now(ZoneId.of("UTC")))
+          .withFieldValue("sqlTimeValue", LocalTime.now(ZoneId.of("UTC")))
+          .withFieldValue("sqlDatetimeValue", LocalDateTime.now(ZoneId.of("UTC")))

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` instead of `ZoneId.of("UTC")`. This requires replacing the import for `java.time.ZoneId` with `java.time.ZoneOffset`.
   
   ```suggestion
             .withFieldValue("sqlDateValue", LocalDate.now(ZoneOffset.UTC))
             .withFieldValue("sqlTimeValue", LocalTime.now(ZoneOffset.UTC))
             .withFieldValue("sqlDatetimeValue", LocalDateTime.now(ZoneOffset.UTC))
   ```



-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "stankiewicz (via GitHub)" <gi...@apache.org>.
stankiewicz commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4024635755

   /gemini review


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4214254819

   Reminder, please take a look at this pr: @chamikaramj @liferoad 


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

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


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] [ErrorProne] Enable JavaTimeDefaultTimeZone check [beam]

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #37775:
URL: https://github.com/apache/beam/pull/37775#issuecomment-4238778900

   Some new changes merged between checks ran in this PR and the HEAD, causing spotless check failures like
   
   ```
   /runner/_work/beam/beam/examples/java/iceberg/src/main/java/org/apache/beam/examples/iceberg/snippets/IcebergBeamSchemaAndRow.java:68: warning: [JavaTimeDefaultTimeZone] LocalTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
                       .put("time_field", LocalTime.now())
   ```


-- 
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: github-unsubscribe@beam.apache.org

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