AHeise commented on a change in pull request #11507: [FLINK-16587] Add basic CheckpointBarrierHandler for unaligned checkpoint URL: https://github.com/apache/flink/pull/11507#discussion_r404301277
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/UnionInputGate.java ########## @@ -77,37 +77,34 @@ */ private final LinkedHashSet<InputGate> inputGatesWithData = new LinkedHashSet<>(); - /** The total number of input channels across all unioned input gates. */ - private final int totalNumberOfInputChannels; + /** Input channels across all unioned input gates. */ + private final InputChannel[] inputChannels; /** * A mapping from input gate to (logical) channel index offset. Valid channel indexes go from 0 * (inclusive) to the total number of input channels (exclusive). */ - private final Map<InputGate, Integer> inputGateToIndexOffsetMap; + private final int[] inputGateChannelIndexOffsets; public UnionInputGate(InputGate... inputGates) { this.inputGates = checkNotNull(inputGates); checkArgument(inputGates.length > 1, "Union input gate should union at least two input gates."); - this.inputGateToIndexOffsetMap = Maps.newHashMapWithExpectedSize(inputGates.length); this.inputGatesWithRemainingData = Sets.newHashSetWithExpectedSize(inputGates.length); + final int maxGateIndex = Arrays.stream(inputGates).mapToInt(InputGate::getGateIndex).max().orElse(0); Review comment: Changed it even more with an extra commit that introduces `IndexedInputGate`. Only this `InputGate` has an `getIndex` and union gate can only be composed by these gates (turning the runtime into a compile time check). ---------------------------------------------------------------- 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 With regards, Apache Git Services