zhuzhurk commented on code in PR #21854:
URL: https://github.com/apache/flink/pull/21854#discussion_r1097250111


##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java:
##########
@@ -299,6 +299,50 @@ public void testChainNodeSetParallelism() {
         assertThat(vertices.get(0).isParallelismConfigured()).isTrue();
     }
 
+    @Test
+    public void testChainedSourcesSetParallelism() {
+        StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+        MultipleInputTransformation<Long> transform =
+                new MultipleInputTransformation<>(
+                        "mit",
+                        new UnusedOperatorFactory(),
+                        Types.LONG,
+                        env.getParallelism(),
+                        false);
+        DataStreamSource<Long> source1 =
+                env.fromSource(
+                        new NumberSequenceSource(1, 2),
+                        WatermarkStrategy.noWatermarks(),
+                        "source1");
+        DataStreamSource<Long> source2 =
+                env.fromSource(
+                        new NumberSequenceSource(1, 2),
+                        WatermarkStrategy.noWatermarks(),
+                        "source2");
+        transform.addInput(source1.getTransformation());
+        transform.addInput(source2.getTransformation());
+        transform.setChainingStrategy(ChainingStrategy.HEAD_WITH_SOURCES);
+        source1.setParallelism(env.getParallelism());
+        env.addOperator(transform);
+
+        StreamGraph streamGraph = env.getStreamGraph();
+
+        // check the streamGraph parallleism configured

Review Comment:
   parallleism -> parallelism



##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java:
##########
@@ -596,6 +596,7 @@ && isChainableInput(sourceOutEdge, streamGraph)) {
                                                     chainedSources,
                                                     streamGraph));
                     chainInfo.addCoordinatorProvider(coord);
+                    
chainInfo.getAllChainedNodes().add(streamGraph.getStreamNode(sourceNodeId));

Review Comment:
   Modifying a collection returned by a getter is not recommended.
   
   I would propose to introduce a method `StreamNode 
OperatorChainInfo#recordChainedNode(int nodeId)` and reuse it in 
`OperatorChainInfo#addNodeToChain(int, String)`.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to