From 4c8bae986cb35797f309f2b977ee863f74d22358 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Wed, 28 Aug 2024 16:26:57 -0400 Subject: [PATCH 1/2] Fix rawtype warning in Watch and CoGroup --- .../beam_PostCommit_Java_Examples_Dataflow_ARM.json | 1 + .../beam_PostCommit_Java_Examples_Dataflow_ARM.yml | 6 ++++-- .../apache/beam/sdk/schemas/transforms/CoGroup.java | 7 +++---- .../java/org/apache/beam/sdk/transforms/Watch.java | 11 +++++------ 4 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 .github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json diff --git a/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json b/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml b/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml index 212272d2c053..c9328e36af6e 100644 --- a/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml +++ b/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml @@ -60,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - job_name: [beam_PostCommit_Java_Examples__Dataflow_ARM] + job_name: [beam_PostCommit_Java_Examples_Dataflow_ARM] job_phrase: [Run Java_Examples_Dataflow_ARM PostCommit] java_version: ['8','11','17','21'] if: | @@ -80,7 +80,9 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-environment-action with: - java-version: ${{ matrix.java_version }} + java-version: | + ${{ matrix.java_version != '11' && matrix.java_version }} + 11 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: GCloud Docker credential helper diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java index 60757a003396..93381034e133 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java @@ -204,11 +204,10 @@ *

Do note that cross-product joins while simpler and easier to program, can cause performance problems. */ @SuppressWarnings({ - "nullness", // TODO(https://github.com/apache/beam/issues/20497) - "rawtypes" + "nullness" // TODO(https://github.com/apache/beam/issues/20497) }) public class CoGroup { - private static final List NULL_LIST; + private static final List<@Nullable Row> NULL_LIST; static { NULL_LIST = Lists.newArrayList(); @@ -405,7 +404,7 @@ private static JoinInformation from( FieldAccessDescriptor resolved = fieldAccessDescriptor.resolve(schema); // Create a new tag for the output. - TupleTag randomTag = new TupleTag<>(); + TupleTag randomTag = new TupleTag<>(); String keyedTag = tag + "_" + randomTag; tagToKeyedTag.put(tagIndex, keyedTag); PCollection> keyedPCollection = diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Watch.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Watch.java index 3f9423610dfa..793fac048dff 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Watch.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Watch.java @@ -124,8 +124,7 @@ * href="https://beam.apache.org/documentation/runners/capability-matrix/">capability matrix. */ @SuppressWarnings({ - "nullness", // TODO(https://github.com/apache/beam/issues/20497) - "rawtypes" + "nullness" // TODO(https://github.com/apache/beam/issues/20497) }) public class Watch { private static final Logger LOG = LoggerFactory.getLogger(Watch.class); @@ -975,7 +974,7 @@ private HashCode hash128(OutputT value) { return Hashing.murmur3_128().hashObject(value, coderFunnel); } - private Growth.PollResult computeNeverSeenBeforeResults( + private Growth.PollResult computeNeverSeenBeforeResults( PollingGrowthState state, Growth.PollResult pollResult) { // Collect results to include as newly pending. Note that the poll result may in theory // contain multiple outputs mapping to the same output key - we need to ignore duplicates @@ -1036,7 +1035,7 @@ abstract static class GrowthState {} @VisibleForTesting abstract static class NonPollingGrowthState extends GrowthState { public static NonPollingGrowthState of(Growth.PollResult pending) { - return new AutoValue_Watch_NonPollingGrowthState(pending); + return new AutoValue_Watch_NonPollingGrowthState<>(pending); } /** @@ -1056,14 +1055,14 @@ public static NonPollingGrowthState of(Growth.PollResult extends GrowthState { public static PollingGrowthState of( TerminationStateT terminationState) { - return new AutoValue_Watch_PollingGrowthState(ImmutableMap.of(), null, terminationState); + return new AutoValue_Watch_PollingGrowthState<>(ImmutableMap.of(), null, terminationState); } public static PollingGrowthState of( ImmutableMap completed, Instant pollWatermark, TerminationStateT terminationState) { - return new AutoValue_Watch_PollingGrowthState(completed, pollWatermark, terminationState); + return new AutoValue_Watch_PollingGrowthState<>(completed, pollWatermark, terminationState); } // Hashes and timestamps of outputs that have already been output and should be omitted From f590a1bd54dd1f959bbe3c4bf4801be8f236266b Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Wed, 28 Aug 2024 22:32:48 -0400 Subject: [PATCH 2/2] fix java version matrix --- .../beam_PostCommit_Java_Examples_Dataflow_ARM.json | 1 - .../workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json diff --git a/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json b/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml b/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml index c9328e36af6e..9fd84daef63b 100644 --- a/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml +++ b/.github/workflows/beam_PostCommit_Java_Examples_Dataflow_ARM.yml @@ -81,7 +81,7 @@ jobs: uses: ./.github/actions/setup-environment-action with: java-version: | - ${{ matrix.java_version != '11' && matrix.java_version }} + ${{ matrix.java_version != '11' && matrix.java_version || '' }} 11 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2