You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2019/11/08 09:55:14 UTC
[flink] 01/02: [FLINK-14646] Add non-null checks to
KeyGroupRangeAssignment
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch release-1.9
in repository https://gitbox.apache.org/repos/asf/flink.git
commit b3def1879370a24900db31eeef6266fa1031851b
Author: Jiayi <bu...@163.com>
AuthorDate: Fri Nov 8 00:54:56 2019 +0800
[FLINK-14646] Add non-null checks to KeyGroupRangeAssignment
This closes #10120.
---
.../java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java b/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java
index 430765b..d467ca6 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeAssignment.java
@@ -46,6 +46,7 @@ public final class KeyGroupRangeAssignment {
* @return the index of the parallel operator to which the given key should be routed.
*/
public static int assignKeyToParallelOperator(Object key, int maxParallelism, int parallelism) {
+ Preconditions.checkNotNull(key, "Assigned key must not be null!");
return computeOperatorIndexForKeyGroup(maxParallelism, parallelism, assignToKeyGroup(key, maxParallelism));
}
@@ -57,6 +58,7 @@ public final class KeyGroupRangeAssignment {
* @return the key-group to which the given key is assigned
*/
public static int assignToKeyGroup(Object key, int maxParallelism) {
+ Preconditions.checkNotNull(key, "Assigned key must not be null!");
return computeKeyGroupForKeyHash(key.hashCode(), maxParallelism);
}