pnowojski closed pull request #6688: [FLINK-10321][network] Simplify the
condition of BroadcastPartitioner
URL: https://github.com/apache/flink/pull/6688
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitioner.java
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitioner.java
index 3d0e108bf28..c796813adc5 100644
---
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitioner.java
+++
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitioner.java
@@ -30,22 +30,18 @@
public class BroadcastPartitioner<T> extends StreamPartitioner<T> {
private static final long serialVersionUID = 1L;
- int[] returnArray;
- boolean set;
- int setNumber;
+ private int[] returnArray;
@Override
public int[] selectChannels(SerializationDelegate<StreamRecord<T>>
record,
int numberOfOutputChannels) {
- if (set && setNumber == numberOfOutputChannels) {
+ if (returnArray != null && returnArray.length ==
numberOfOutputChannels) {
return returnArray;
} else {
this.returnArray = new int[numberOfOutputChannels];
for (int i = 0; i < numberOfOutputChannels; i++) {
returnArray[i] = i;
}
- set = true;
- setNumber = numberOfOutputChannels;
return returnArray;
}
}
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services