zhijiangW commented on a change in pull request #7051: [FLINK-10820][network] 
Simplify the RebalancePartitioner implementation
URL: https://github.com/apache/flink/pull/7051#discussion_r232926075
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitioner.java
 ##########
 @@ -33,29 +33,18 @@
 public class RebalancePartitioner<T> extends StreamPartitioner<T> {
        private static final long serialVersionUID = 1L;
 
-       private final int[] returnArray = {Integer.MAX_VALUE - 1};
+       private final int[] returnArray = { -1 };
 
 Review comment:
   Yes, I also considered to use a boolean `isInitialized` before as you said. 
In order not to bring another extra variable, I relies on `-1` directly. I 
agree another boolean value seems more cleaner than current way.
   
   You are right that the current `ChannelSelector` is short of mechanism to 
initialization, and it may be necessary to add this logic in the interface. I 
will double check how many implementations are needing this logic or just 
`RebalancePartitioner`, especially for the batch implementations in 
`OutputEmitter`. Then I would consider whether to cover this refactor in this 
PR or in a separate PR next. :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to