You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "huwh (via GitHub)" <gi...@apache.org> on 2023/04/26 02:49:10 UTC

[GitHub] [flink] huwh commented on a diff in pull request #22438: [FLINK-31632] Add method setMaxParallelism to DataStreamSink.

huwh commented on code in PR #22438:
URL: https://github.com/apache/flink/pull/22438#discussion_r1177277341


##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java:
##########
@@ -283,6 +283,25 @@ public void testTransformationSetParallelism() {
         assertThat(vertices.get(2).isParallelismConfigured()).isTrue();
     }
 
+    @Test
+    public void testTransformationSetMaxParallelism() {

Review Comment:
   All test methods in junit5 should be package-private.
   ```java
   void testTransformationSetMaxParallelism() 
   ``` 
   
   



##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java:
##########
@@ -283,6 +283,25 @@ public void testTransformationSetParallelism() {
         assertThat(vertices.get(2).isParallelismConfigured()).isTrue();
     }
 
+    @Test
+    public void testTransformationSetMaxParallelism() {
+        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+        /* The max parallelism of the environment (that is inherited by the source)
+        and the parallelism of the map operator needs to be different for this test */
+        env.setMaxParallelism(4);
+        env.fromSequence(1L, 3L).map(i -> i).setMaxParallelism(10).print().setMaxParallelism(20);

Review Comment:
   It's better to introduce variables for each DataStream/DataStreamSink and then get StreamNode by their ID.
   
   ```java
   DataStreamSource<Long> source = env.fromSequence(1L, 3L);
   assertThat(streamGraph.getStreamNode(source.getId()).getMaxParallelism()).isEqualTo(4);
   ``` 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org