You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/01/25 03:10:52 UTC

[GitHub] [flink] TanYuxin-tyx commented on a change in pull request #18474: [FLINK-25786][network] Adjust the generation of subpartition data storage order for sort-shuffle from random shuffle to random shift

TanYuxin-tyx commented on a change in pull request #18474:
URL: https://github.com/apache/flink/pull/18474#discussion_r791322643



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeResultPartition.java
##########
@@ -492,10 +490,13 @@ public int getNumberOfQueuedBuffers(int targetSubpartition) {
     }
 
     private int[] getRandomSubpartitionOrder(int numSubpartitions) {
-        List<Integer> list =
-                IntStream.range(0, numSubpartitions).boxed().collect(Collectors.toList());
-        Collections.shuffle(list);
-        return list.stream().mapToInt(Integer::intValue).toArray();
+        int[] order = new int[numSubpartitions];
+        Random random = new Random();
+        int shift = random.nextInt(numSubpartitions);

Review comment:
       If `shift` is 0, the returned array may not be changed. 
   
   In addition, this patch may cause the actual traversal order not to change, but only the starting position to be modified. Is this expected?




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