Jiayi-Liao commented on a change in pull request #12243: URL: https://github.com/apache/flink/pull/12243#discussion_r427381013
########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputProcessorUtil.java ########## @@ -79,11 +80,26 @@ public static CheckpointedInputGate createCheckpointedInputGate( unionedInputGates[i] = InputGateUtil.createInputGate(inputGates[i].toArray(new IndexedInputGate[0])); } + IntStream numberOfInputChannelsPerGate = + Arrays + .stream(inputGates) + .flatMap(collection -> collection.stream()) + .sorted(Comparator.comparingInt(IndexedInputGate::getGateIndex)) + .mapToInt(InputGate::getNumberOfInputChannels); + Map<InputGate, Integer> inputGateToChannelIndexOffset = generateInputGateToChannelIndexOffsetMap(unionedInputGates); + // Note that numberOfInputChannelsPerGate and inputGateToChannelIndexOffset have a bit different Review comment: Yes... It took me a while to understand their usage. Why don't we make them consistent by easily sorting the `inputGates` before doing anything here (there's no risk if I understand correctly), so that it won't bother us in the future. ---------------------------------------------------------------- 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: us...@infra.apache.org