rkhachatryan commented on a change in pull request #11098: [FLINK-16060][task]
Implement working StreamMultipleInputProcessor
URL: https://github.com/apache/flink/pull/11098#discussion_r380678105
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
##########
@@ -312,6 +316,40 @@ public void
testOutputTypeConfigurationWithTwoInputTransformation() throws Excep
assertEquals(BasicTypeInfo.INT_TYPE_INFO,
outputTypeConfigurableOperation.getTypeInformation());
}
+ @Test
+ public void testMultipleInputTransformation() throws Exception {
+ StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
+ //TODO: referring to getNewNodeId() is hacky, but I'm not sure
if there is a better idea?
+ int startingNewNodeId = Transformation.getNewNodeId();
+
+ DataStream<Integer> source1 = env.fromElements(1, 10);
+ DataStream<Long> source2 = env.fromElements(2L, 11L);
+ DataStream<String> source3 = env.fromElements("42", "44");
+
+ MultipleInputTransformation<String> transform = new
MultipleInputTransformation<String>(
+ "My Operator",
+ new MultipleInputOperatorFactory(),
+ BasicTypeInfo.STRING_TYPE_INFO,
+ 3);
+
+ transform.addInput(source1.getTransformation());
+ transform.addInput(source2.getTransformation());
+ transform.addInput(source3.getTransformation());
+
+ env.addOperator(transform);
+ StreamGraph streamGraph = env.getStreamGraph();
+ assertEquals(4, streamGraph.getStreamNodes().size());
+
+ int id = startingNewNodeId;
+ assertEquals(1, streamGraph.getStreamEdges(id + 1, id +
4).size());
+ assertEquals(1, streamGraph.getStreamEdges(id + 2, id +
4).size());
+ assertEquals(1, streamGraph.getStreamEdges(id + 3, id +
4).size());
+ assertEquals(1, streamGraph.getStreamEdges(id + 1).size());
+ assertEquals(1, streamGraph.getStreamEdges(id + 2).size());
+ assertEquals(1, streamGraph.getStreamEdges(id + 3).size());
+ assertEquals(0, streamGraph.getStreamEdges(id + 4).size());
Review comment:
Why can't we use `Transformation#getId` here? E.g.
```
assertEquals(1, streamGraph.getStreamEdges(transform.getId(),
source1.getId()).size());
```
----------------------------------------------------------------
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