gaoyunhaii commented on a change in pull request #13924:
URL: https://github.com/apache/flink/pull/13924#discussion_r601200831



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeResultPartition.java
##########
@@ -455,4 +458,28 @@ public int getNumberOfQueuedBuffers(int 
targetSubpartition) {
     PartitionedFile getResultFile() {
         return resultFile;
     }
+
+    @VisibleForTesting
+    SortMergeResultPartitionReader getPartitionReader() {
+        return partitionReader;
+    }
+
+    private int[] getRandomSubpartitionOrder(int numSubpartitions) {

Review comment:
       I think this is not in critical code path (one call for one 
ResultPartition only) and thus I do not think it would cause too much overhead. 
For int[], it could be changed to 
   
   ```
   List<Integer> list = IntStream.range(0, 
numSubpartitions).boxed().collect(Collectors.toList());
   Collections.shuffle(list);
   return list.stream().mapToInt(Integer::intValue).toArray();
   ```
   
   As a whole, I strongly do not recommend to write a `shuffle` method by 
ourself.




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


Reply via email to