Skip to content

Commit 2a06694

Browse files
authored
Merge pull request #35029: Fix nullness errors in SimpleDoFnRunner and DoFnInvoker
2 parents 534e1cb + be65cfe commit 2a06694

11 files changed

Lines changed: 311 additions & 59 deletions

File tree

runners/core-java/src/main/java/org/apache/beam/runners/core/LateDataUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.beam.sdk.values.WindowingStrategy;
2626
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.FluentIterable;
2727
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterables;
28+
import org.checkerframework.dataflow.qual.Pure;
2829
import org.joda.time.Duration;
2930
import org.joda.time.Instant;
3031

@@ -41,6 +42,7 @@ private LateDataUtils() {}
4142
* Return when {@code window} should be garbage collected. If the window's expiration time is on
4243
* or after the end of the global window, it will be truncated to the end of the global window.
4344
*/
45+
@Pure
4446
public static Instant garbageCollectionTime(
4547
BoundedWindow window, WindowingStrategy windowingStrategy) {
4648
return garbageCollectionTime(window, windowingStrategy.getAllowedLateness());
@@ -50,6 +52,7 @@ public static Instant garbageCollectionTime(
5052
* Return when {@code window} should be garbage collected. If the window's expiration time is on
5153
* or after the end of the global window, it will be truncated to the end of the global window.
5254
*/
55+
@Pure
5356
public static Instant garbageCollectionTime(BoundedWindow window, Duration allowedLateness) {
5457

5558
// If the end of the window + allowed lateness is beyond the "end of time" aka the end of the

runners/core-java/src/main/java/org/apache/beam/runners/core/OutputAndTimeBoundedSplittableProcessElementInvoker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ public PaneInfo pane() {
387387
}
388388

389389
@Override
390-
public String currentRecordId() {
390+
public @Nullable String currentRecordId() {
391391
return element.getRecordId();
392392
}
393393

394394
@Override
395-
public Long currentRecordOffset() {
395+
public @Nullable Long currentRecordOffset() {
396396
return element.getRecordOffset();
397397
}
398398

runners/core-java/src/main/java/org/apache/beam/runners/core/SideInputReader.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,22 @@
1919

2020
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
2121
import org.apache.beam.sdk.values.PCollectionView;
22-
import org.checkerframework.checker.nullness.qual.Nullable;
22+
import org.checkerframework.dataflow.qual.Pure;
2323

2424
/**
2525
* The interface to objects that provide side inputs. Particular implementations may read a side
2626
* input directly or use appropriate sorts of caching, etc.
2727
*/
2828
public interface SideInputReader {
29-
/**
30-
* Returns the value of the given {@link PCollectionView} for the given {@link BoundedWindow}.
31-
*
32-
* <p>It is valid for a side input to be {@code null}. It is <i>not</i> valid for this to return
33-
* {@code null} for any other reason.
34-
*/
35-
@Nullable
29+
/** Returns the value of the given {@link PCollectionView} for the given {@link BoundedWindow}. */
30+
@Pure
3631
<T> T get(PCollectionView<T> view, BoundedWindow window);
3732

3833
/** Returns true if the given {@link PCollectionView} is valid for this reader. */
34+
@Pure
3935
<T> boolean contains(PCollectionView<T> view);
4036

4137
/** Returns true if there are no side inputs in this reader. */
38+
@Pure
4239
boolean isEmpty();
4340
}

0 commit comments

Comments
 (0)