-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BEAM-210] Test that empty final panes are not produced. #211
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -500,8 +500,8 @@ public void testPaneInfoAllStatesAfterWatermark() throws Exception { | |
ReduceFnTester<Integer, Iterable<Integer>, IntervalWindow> tester = ReduceFnTester.nonCombining( | ||
WindowingStrategy.of(FixedWindows.of(Duration.millis(10))) | ||
.withTrigger(Repeatedly.<IntervalWindow>forever(AfterFirst.<IntervalWindow>of( | ||
AfterPane.<IntervalWindow>elementCountAtLeast(2), | ||
AfterWatermark.<IntervalWindow>pastEndOfWindow()))) | ||
AfterPane.elementCountAtLeast(2), | ||
AfterWatermark.pastEndOfWindow()))) | ||
.withMode(AccumulationMode.DISCARDING_FIRED_PANES) | ||
.withAllowedLateness(Duration.millis(100)) | ||
.withClosingBehavior(ClosingBehavior.FIRE_ALWAYS)); | ||
|
@@ -547,13 +547,39 @@ public void testPaneInfoAllStatesAfterWatermark() throws Exception { | |
WindowMatchers.isSingleWindowedValue(emptyIterable(), 9, 0, 10))); | ||
} | ||
|
||
@Test | ||
public void noEmptyPanes() throws Exception { | ||
ReduceFnTester<Integer, Iterable<Integer>, IntervalWindow> tester = ReduceFnTester.nonCombining( | ||
WindowingStrategy.of(FixedWindows.of(Duration.millis(10))) | ||
.withTrigger(Repeatedly.<IntervalWindow>forever(AfterFirst.<IntervalWindow>of( | ||
AfterPane.elementCountAtLeast(2), | ||
AfterWatermark.pastEndOfWindow()))) | ||
.withMode(AccumulationMode.ACCUMULATING_FIRED_PANES) | ||
.withAllowedLateness(Duration.millis(100)) | ||
.withClosingBehavior(ClosingBehavior.FIRE_IF_NON_EMPTY)); | ||
|
||
tester.advanceInputWatermark(new Instant(0)); | ||
tester.injectElements( | ||
TimestampedValue.of(1, new Instant(1)), | ||
TimestampedValue.of(2, new Instant(2))); | ||
tester.advanceInputWatermark(new Instant(20)); | ||
tester.advanceInputWatermark(new Instant(250)); | ||
|
||
List<WindowedValue<Iterable<Integer>>> output = tester.extractOutput(); | ||
assertThat(output, contains( | ||
// Trigger with 2 elements | ||
WindowMatchers.isSingleWindowedValue(containsInAnyOrder(1, 2), 1, 0, 10), | ||
// Trigger for the empty on time pane. | ||
WindowMatchers.isSingleWindowedValue(containsInAnyOrder(1, 2), 9, 0, 10))); | ||
} | ||
|
||
@Test | ||
public void testPaneInfoAllStatesAfterWatermarkAccumulating() throws Exception { | ||
ReduceFnTester<Integer, Iterable<Integer>, IntervalWindow> tester = ReduceFnTester.nonCombining( | ||
WindowingStrategy.of(FixedWindows.of(Duration.millis(10))) | ||
.withTrigger(Repeatedly.<IntervalWindow>forever(AfterFirst.<IntervalWindow>of( | ||
AfterPane.<IntervalWindow>elementCountAtLeast(2), | ||
AfterWatermark.<IntervalWindow>pastEndOfWindow()))) | ||
AfterPane.elementCountAtLeast(2), | ||
AfterWatermark.pastEndOfWindow()))) | ||
.withMode(AccumulationMode.ACCUMULATING_FIRED_PANES) | ||
.withAllowedLateness(Duration.millis(100)) | ||
.withClosingBehavior(ClosingBehavior.FIRE_ALWAYS)); | ||
|
@@ -604,8 +630,8 @@ public void testPaneInfoFinalAndOnTime() throws Exception { | |
ReduceFnTester<Integer, Iterable<Integer>, IntervalWindow> tester = ReduceFnTester.nonCombining( | ||
WindowingStrategy.of(FixedWindows.of(Duration.millis(10))) | ||
.withTrigger( | ||
Repeatedly.<IntervalWindow>forever(AfterPane.<IntervalWindow>elementCountAtLeast(2)) | ||
.orFinally(AfterWatermark.<IntervalWindow>pastEndOfWindow())) | ||
Repeatedly.<IntervalWindow>forever(AfterPane.elementCountAtLeast(2)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as you are cleaning up unused generic params, might as well get this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These weren't reported as unused parameter warnings. I suspect because the methods in question still accept a generic ( |
||
.orFinally(AfterWatermark.pastEndOfWindow())) | ||
.withMode(AccumulationMode.DISCARDING_FIRED_PANES) | ||
.withAllowedLateness(Duration.millis(100)) | ||
.withClosingBehavior(ClosingBehavior.FIRE_ALWAYS)); | ||
|
@@ -890,7 +916,7 @@ public void testDropDataMultipleWindowsFinishedTrigger() throws Exception { | |
ReduceFnTester<Integer, Integer, IntervalWindow> tester = ReduceFnTester.combining( | ||
WindowingStrategy.of( | ||
SlidingWindows.of(Duration.millis(100)).every(Duration.millis(30))) | ||
.withTrigger(AfterWatermark.<IntervalWindow>pastEndOfWindow()) | ||
.withTrigger(AfterWatermark.pastEndOfWindow()) | ||
.withAllowedLateness(Duration.millis(1000)), | ||
new Sum.SumIntegerFn().<String>asKeyedFn(), VarIntCoder.of()); | ||
|
||
|
@@ -1024,7 +1050,7 @@ public void testEmptyOnTimeFromOrFinally() throws Exception { | |
.<IntervalWindow>forever( | ||
AfterProcessingTime.<IntervalWindow>pastFirstElementInPane().plusDelayOf( | ||
new Duration(5))) | ||
.orFinally(AfterWatermark.<IntervalWindow>pastEndOfWindow()), | ||
.orFinally(AfterWatermark.pastEndOfWindow()), | ||
Repeatedly.<IntervalWindow>forever( | ||
AfterProcessingTime.<IntervalWindow>pastFirstElementInPane().plusDelayOf( | ||
new Duration(25)))), | ||
|
@@ -1074,7 +1100,7 @@ public void testProcessingTime() throws Exception { | |
.<IntervalWindow>forever( | ||
AfterProcessingTime.<IntervalWindow>pastFirstElementInPane().plusDelayOf( | ||
new Duration(5))) | ||
.orFinally(AfterWatermark.<IntervalWindow>pastEndOfWindow()), | ||
.orFinally(AfterWatermark.pastEndOfWindow()), | ||
Repeatedly.<IntervalWindow>forever( | ||
AfterProcessingTime.<IntervalWindow>pastFirstElementInPane().plusDelayOf( | ||
new Duration(25)))), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You said you couldn't repro the problem in the JIRA ticket, but this test seems to confirm exactly the WAI behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unable to repro the report of broken behavior. I was able to verify the WAI behavior.