pnowojski commented on a change in pull request #8731: [FLINK-11878][runtime]
Implement the runtime handling of BoundedOneInput and BoundedMultiInput
URL: https://github.com/apache/flink/pull/8731#discussion_r293723484
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java
##########
@@ -597,6 +603,54 @@ public void testQuiesceTimerServiceAfterOpClose() throws
Exception {
timeService.shutdownService();
}
+ @Test
+ public void testHandlingEndOfInput() throws Exception {
+ final OneInputStreamTaskTestHarness<String, String> testHarness
= new OneInputStreamTaskTestHarness<>(
+ OneInputStreamTask::new,
+ 2, 2,
+ BasicTypeInfo.STRING_TYPE_INFO,
BasicTypeInfo.STRING_TYPE_INFO);
+
+ testHarness
+ .setupOperatorChain(new OperatorID(), new
TestBoundedOneInputOperator("Operator0"))
+ .chain(
+ new OperatorID(),
+ new TestBoundedOneInputOperator("Operator1"),
+
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()))
+ .finish();
+
+ ConcurrentLinkedQueue<Object> expectedOutput = new
ConcurrentLinkedQueue<>();
+
+ testHarness.invoke();
+ testHarness.waitForTaskRunning();
+
+ TestBoundedOneInputOperator headOperator =
(TestBoundedOneInputOperator) testHarness.getTask().headOperator;
+
+ testHarness.processElement(new StreamRecord<>("Hello-0-0"), 0,
0);
+ testHarness.endInput(0, 0);
+ testHarness.processElement(new StreamRecord<>("Hello-0-1"), 0,
1);
+ testHarness.endInput(0, 1);
+
+ headOperator.waitOutputRecords(2);
+
+ testHarness.processElement(new StreamRecord<>("Hello-1-0"), 1,
0);
+ testHarness.processElement(new StreamRecord<>("Hello-1-1"), 1,
1);
Review comment:
Wouldn't it be better to reorder this to:
```
testHarness.processElement(new StreamRecord<>("Hello-1-0"), 1,
0);
testHarness.endInput(1, 0);
testHarness.processElement(new StreamRecord<>("Hello-1-1"), 1,
1);
testHarness.endInput(1, 1);
```
? As it is now, we are not sure after which `endInput()` call operators
received `endInput()` notification.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services