public final class KeyGroupRangeAssignment extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOWER_BOUND_MAX_PARALLELISM
The default lower bound for max parallelism if nothing was configured by the user.
|
static int |
UPPER_BOUND_MAX_PARALLELISM
The (inclusive) upper bound for max parallelism.
|
Modifier and Type | Method and Description |
---|---|
static int |
assignKeyToParallelOperator(Object key,
int maxParallelism,
int parallelism)
Assigns the given key to a parallel operator index.
|
static int |
assignToKeyGroup(Object key,
int maxParallelism)
Assigns the given key to a key-group index.
|
static void |
checkParallelismPreconditions(int parallelism) |
static int |
computeDefaultMaxParallelism(int operatorParallelism)
Computes a default maximum parallelism from the operator parallelism.
|
static int |
computeKeyGroupForKeyHash(int keyHash,
int maxParallelism)
Assigns the given key to a key-group index.
|
static KeyGroupRange |
computeKeyGroupRangeForOperatorIndex(int maxParallelism,
int parallelism,
int operatorIndex)
Computes the range of key-groups that are assigned to a given operator under the given
parallelism and maximum parallelism.
|
static int |
computeOperatorIndexForKeyGroup(int maxParallelism,
int parallelism,
int keyGroupId)
Computes the index of the operator to which a key-group belongs under the given parallelism
and maximum parallelism.
|
public static final int DEFAULT_LOWER_BOUND_MAX_PARALLELISM
public static final int UPPER_BOUND_MAX_PARALLELISM
public static int assignKeyToParallelOperator(Object key, int maxParallelism, int parallelism)
key
- the key to assignmaxParallelism
- the maximum supported parallelism, aka the number of key-groups.parallelism
- the current parallelism of the operatorpublic static int assignToKeyGroup(Object key, int maxParallelism)
key
- the key to assignmaxParallelism
- the maximum supported parallelism, aka the number of key-groups.public static int computeKeyGroupForKeyHash(int keyHash, int maxParallelism)
keyHash
- the hash of the key to assignmaxParallelism
- the maximum supported parallelism, aka the number of key-groups.public static KeyGroupRange computeKeyGroupRangeForOperatorIndex(int maxParallelism, int parallelism, int operatorIndex)
IMPORTANT: maxParallelism must be <= Short.MAX_VALUE to avoid rounding problems in this method. If we ever want to go beyond this boundary, this method must perform arithmetic on long values.
maxParallelism
- Maximal parallelism that the job was initially created with.parallelism
- The current parallelism under which the job runs. Must be <=
maxParallelism.operatorIndex
- Id of a key-group. 0 <= keyGroupID < maxParallelism.public static int computeOperatorIndexForKeyGroup(int maxParallelism, int parallelism, int keyGroupId)
IMPORTANT: maxParallelism must be <= Short.MAX_VALUE to avoid rounding problems in this method. If we ever want to go beyond this boundary, this method must perform arithmetic on long values.
maxParallelism
- Maximal parallelism that the job was initially created with. 0 <
parallelism <= maxParallelism <= Short.MAX_VALUE must hold.parallelism
- The current parallelism under which the job runs. Must be <=
maxParallelism.keyGroupId
- Id of a key-group. 0 <= keyGroupID < maxParallelism.public static int computeDefaultMaxParallelism(int operatorParallelism)
operatorParallelism
- the operator parallelism as basis for computation.public static void checkParallelismPreconditions(int parallelism)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.