Skip to content

Commit 2b804ba

Browse files
authored
Merge pull request #35213: Remove WindowedValue.getPane() in preparation for making WindowedValue a user-facing interface
2 parents 27712a0 + 0e91b58 commit 2b804ba

88 files changed

Lines changed: 426 additions & 386 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/trigger_files/beam_PostCommit_Java_ValidatesRunner_Direct.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"https://github.com/apache/beam/pull/35213": "Eliminating getPane() in favor of getPaneInfo()",
23
"https://github.com/apache/beam/pull/35177": "Introducing WindowedValueReceiver to runners",
34
"comment": "Modify this file in a trivial way to cause this test suite to run",
45
"https://github.com/apache/beam/pull/31761": "noting that PR #31761 should run this test",

.github/trigger_files/beam_PostCommit_Java_ValidatesRunner_Flink.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"https://github.com/apache/beam/pull/35213": "Eliminating getPane() in favor of getPaneInfo()",
23
"https://github.com/apache/beam/pull/35177": "Introducing WindowedValueReceiver to runners",
34
"comment": "Modify this file in a trivial way to cause this test suite to run",
45
"https://github.com/apache/beam/pull/32440": "testing datastream optimizations",

.github/trigger_files/beam_PostCommit_Java_ValidatesRunner_Spark.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"https://github.com/apache/beam/pull/35213": "Eliminating getPane() in favor of getPaneInfo()",
23
"https://github.com/apache/beam/pull/35177": "Introducing WindowedValueReceiver to runners",
34
"comment": "Modify this file in a trivial way to cause this test suite to run",
45
"https://github.com/apache/beam/pull/31156": "noting that PR #31156 should run this test",

.github/trigger_files/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"https://github.com/apache/beam/pull/35213": "Eliminating getPane() in favor of getPaneInfo()",
23
"https://github.com/apache/beam/pull/35177": "Introducing WindowedValueReceiver to runners",
34
"comment": "Modify this file in a trivial way to cause this test suite to run",
45
"https://github.com/apache/beam/pull/31156": "noting that PR #31156 should run this test",

examples/java/src/test/java/org/apache/beam/examples/complete/game/LeaderBoardTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testTeamScoresOnTime() {
9999
.addElements(
100100
event(TestUser.RED_ONE, 1, Duration.standardMinutes(4)),
101101
event(TestUser.BLUE_ONE, 2, Duration.standardSeconds(270)))
102-
// The window should close and emit an ON_TIME pane
102+
// The window should close and emit an ON_TIME paneInfo
103103
.advanceWatermarkToInfinity();
104104

105105
PCollection<KV<String, Integer>> teamScores =
@@ -137,7 +137,8 @@ public void testTeamScoresSpeculative() {
137137
// Some additional time passes and we get a speculative pane for the red team
138138
.advanceProcessingTime(Duration.standardMinutes(12))
139139
.addElements(event(TestUser.BLUE_TWO, 3, Duration.standardSeconds(22)))
140-
// More time passes and a speculative pane containing a refined value for the blue pane
140+
// More time passes and a speculative pane containing a refined value for the blue
141+
// paneInfo
141142
// is
142143
// emitted
143144
.advanceProcessingTime(Duration.standardMinutes(10))
@@ -155,7 +156,7 @@ public void testTeamScoresSpeculative() {
155156
String blueTeam = TestUser.BLUE_ONE.getTeam();
156157
String redTeam = TestUser.RED_ONE.getTeam();
157158
IntervalWindow window = new IntervalWindow(baseTime, TEAM_WINDOW_DURATION);
158-
// The window contains speculative panes alongside the on-time pane
159+
// The window contains speculative panes alongside the on-time paneInfo
159160
PAssert.that(teamScores)
160161
.inWindow(window)
161162
.containsInAnyOrder(
@@ -190,7 +191,7 @@ public void testTeamScoresUnobservablyLate() {
190191
.advanceWatermarkTo(
191192
baseTime.plus(TEAM_WINDOW_DURATION).minus(Duration.standardMinutes(1)))
192193
// These events are late, but the window hasn't closed yet, so the elements are in the
193-
// on-time pane
194+
// on-time paneInfo
194195
.addElements(
195196
event(TestUser.RED_TWO, 2, Duration.ZERO),
196197
event(TestUser.RED_TWO, 5, Duration.standardMinutes(1)),
@@ -235,7 +236,7 @@ public void testTeamScoresObservablyLate() {
235236
event(TestUser.RED_ONE, 4, Duration.standardMinutes(2)),
236237
event(TestUser.BLUE_ONE, 3, Duration.standardMinutes(5)))
237238
.advanceWatermarkTo(firstWindowCloses.minus(Duration.standardMinutes(1)))
238-
// These events are late but should still appear in a late pane
239+
// These events are late but should still appear in a late paneInfo
239240
.addElements(
240241
event(TestUser.RED_TWO, 2, Duration.ZERO),
241242
event(TestUser.RED_TWO, 5, Duration.standardMinutes(1)),
@@ -244,7 +245,7 @@ public void testTeamScoresObservablyLate() {
244245
// has
245246
// not yet closed because the watermark has not advanced
246247
.advanceProcessingTime(Duration.standardMinutes(12))
247-
// These elements should appear in the final pane
248+
// These elements should appear in the final paneInfo
248249
.addElements(
249250
event(TestUser.RED_TWO, 9, Duration.standardMinutes(1)),
250251
event(TestUser.RED_TWO, 1, Duration.standardMinutes(3)))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public <K, InputT> Iterable<WindowedValue<InputT>> filter(
142142
} else {
143143
nonLateElements.add(
144144
WindowedValues.of(
145-
element.getValue(), element.getTimestamp(), window, element.getPane()));
145+
element.getValue(), element.getTimestamp(), window, element.getPaneInfo()));
146146
}
147147
}
148148
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public Instant timestamp() {
380380

381381
@Override
382382
public PaneInfo pane() {
383-
return element.getPane();
383+
return element.getPaneInfo();
384384
}
385385

386386
@Override
@@ -395,7 +395,7 @@ public void output(OutputT output) {
395395

396396
@Override
397397
public void outputWithTimestamp(OutputT value, Instant timestamp) {
398-
outputWindowedValue(value, timestamp, element.getWindows(), element.getPane());
398+
outputWindowedValue(value, timestamp, element.getWindows(), element.getPaneInfo());
399399
}
400400

401401
@Override
@@ -419,7 +419,7 @@ public <T> void output(TupleTag<T> tag, T value) {
419419
@Override
420420
public <T> void outputWithTimestamp(TupleTag<T> tag, T value, Instant timestamp) {
421421
outputReceiver.output(
422-
tag, WindowedValues.of(value, timestamp, element.getWindows(), element.getPane()));
422+
tag, WindowedValues.of(value, timestamp, element.getWindows(), element.getPaneInfo()));
423423
}
424424

425425
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public PaneInfoTracker(TimerInternals timerInternals) {
4848

4949
@VisibleForTesting
5050
static final StateTag<ValueState<PaneInfo>> PANE_INFO_TAG =
51-
StateTags.makeSystemTagInternal(StateTags.value("pane", PaneInfoCoder.INSTANCE));
51+
StateTags.makeSystemTagInternal(StateTags.value("paneInfo", PaneInfoCoder.INSTANCE));
5252

5353
public void clear(StateAccessor<?> state) {
5454
state.access(PANE_INFO_TAG).clear();

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ public ReduceFn<K, InputT, OutputT, W>.ProcessValueContext forValue(
103103
}
104104

105105
public ReduceFn<K, InputT, OutputT, W>.OnTriggerContext forTrigger(
106-
W window, PaneInfo pane, StateStyle style, OnTriggerCallbacks<OutputT> callbacks) {
107-
return new OnTriggerContextImpl(stateAccessor(window, style), pane, callbacks);
106+
W window, PaneInfo paneInfo, StateStyle style, OnTriggerCallbacks<OutputT> callbacks) {
107+
return new OnTriggerContextImpl(stateAccessor(window, style), paneInfo, callbacks);
108108
}
109109

110110
public ReduceFn<K, InputT, OutputT, W>.OnMergeContext forMerge(
@@ -402,15 +402,15 @@ public Timers timers() {
402402

403403
private class OnTriggerContextImpl extends ReduceFn<K, InputT, OutputT, W>.OnTriggerContext {
404404
private final StateAccessorImpl<K, W> state;
405-
private final PaneInfo pane;
405+
private final PaneInfo paneInfo;
406406
private final OnTriggerCallbacks<OutputT> callbacks;
407407
private final TimersImpl timers;
408408

409409
private OnTriggerContextImpl(
410-
StateAccessorImpl<K, W> state, PaneInfo pane, OnTriggerCallbacks<OutputT> callbacks) {
410+
StateAccessorImpl<K, W> state, PaneInfo paneInfo, OnTriggerCallbacks<OutputT> callbacks) {
411411
reduceFn.super();
412412
this.state = state;
413-
this.pane = pane;
413+
this.paneInfo = paneInfo;
414414
this.callbacks = callbacks;
415415
this.timers = new TimersImpl(state.namespace());
416416
}
@@ -437,7 +437,7 @@ public StateAccessor<K> state() {
437437

438438
@Override
439439
public PaneInfo paneInfo() {
440-
return pane;
440+
return paneInfo;
441441
}
442442

443443
@Override

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,28 +1037,28 @@ private void prefetchOnTrigger(
10371037
}
10381038

10391039
// Calculate the pane info.
1040-
final PaneInfo pane = paneInfoTracker.getNextPaneInfo(directContext, isFinished).read();
1040+
final PaneInfo paneInfo = paneInfoTracker.getNextPaneInfo(directContext, isFinished).read();
10411041

10421042
// Only emit a pane if it has data or empty panes are observable.
1043-
if (needToEmit(isEmpty, isFinished, pane.getTiming())) {
1043+
if (needToEmit(isEmpty, isFinished, paneInfo.getTiming())) {
10441044
// Run reduceFn.onTrigger method.
10451045
final List<W> windows = Collections.singletonList(directContext.window());
10461046
ReduceFn<K, InputT, OutputT, W>.OnTriggerContext renamedTriggerContext =
10471047
contextFactory.forTrigger(
10481048
directContext.window(),
1049-
pane,
1049+
paneInfo,
10501050
StateStyle.RENAMED,
10511051
toOutput -> {
10521052
// We're going to output panes, so commit the (now used) PaneInfo.
10531053
// This is unnecessary if the trigger isFinished since the saved
10541054
// state will be immediately deleted.
10551055
if (!isFinished) {
1056-
paneInfoTracker.storeCurrentPaneInfo(directContext, pane);
1056+
paneInfoTracker.storeCurrentPaneInfo(directContext, paneInfo);
10571057
}
10581058

10591059
// Output the actual value.
10601060
outputter.output(
1061-
WindowedValues.of(KV.of(key, toOutput), outputTimestamp, windows, pane));
1061+
WindowedValues.of(KV.of(key, toOutput), outputTimestamp, windows, paneInfo));
10621062
});
10631063

10641064
reduceFn.onTrigger(renamedTriggerContext);

0 commit comments

Comments
 (0)