[ https://issues.apache.org/jira/browse/FLINK-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15011491#comment-15011491 ]
ASF GitHub Bot commented on FLINK-2897: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/1292#discussion_r45231684 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/operators/shipping/OutputEmitter.java --- @@ -143,16 +148,24 @@ public OutputEmitter(ShipStrategyType strategy, TypeComparator<T> comparator, Pa // -------------------------------------------------------------------------------------------- + private int[] forward() { + return this.channels; + } + private int[] robin(int numberOfChannels) { - if (this.channels == null || this.channels.length != 1) { - this.channels = new int[1]; + int nextChannel = this.nextChannelToSendTo; + + if (nextChannel >= numberOfChannels) { + if (nextChannel == numberOfChannels) { + nextChannel = 0; --- End diff -- Shouldn't this case be also covered by `nextChannel %= numberOfChannels`? > Use distinct initial indices for OutputEmitter round-robin > ---------------------------------------------------------- > > Key: FLINK-2897 > URL: https://issues.apache.org/jira/browse/FLINK-2897 > Project: Flink > Issue Type: Improvement > Components: Distributed Runtime > Affects Versions: 0.10.0 > Reporter: Greg Hogan > Assignee: Greg Hogan > > Currently, when performing a round-robin partitioning each task will > sequentially partition starting with partition "1". This is fine in the usual > case where the number of partitioned objects greatly exceeds the number of > channels. However, in the case where the number of objects is relatively few > (each, perhaps, requiring a large computation or access to an external > system) it would be much better to begin partitioning at distinct indices > (the task index). -- This message was sent by Atlassian JIRA (v6.3.4#6332)