- java.lang.Object
-
- com.pervasive.datarush.operators.ParallelismStrategy
-
public abstract class ParallelismStrategy extends Object
AParallelismStrategy
is responsible for determining parallelization of an operator based on configured parallelism and source parallelism.Implementations should rely on one of the following standard strategies:
-
-
Field Summary
Fields Modifier and Type Field Description static ParallelismStrategy
ACCEPT_SOURCE
Uses the maximum of the input ports' parallelism as this operator's max parallelism.static ParallelismStrategy
CONFIGURED
Indicates that the operator should use whatever parallelism has been explicitly configured viaOperatorSettings.getMaxParallelism()
, defaulting toEngineConfig#getParallelism()
.static ParallelismStrategy
NEGOTIATE_BASED_ON_SOURCE
Uses the maximum of the input ports' parallelism as this operator's max parallelism.static ParallelismStrategy
NON_PARALLELIZABLE
Indicates that the operator is non-parallelizable.
-
Constructor Summary
Constructors Constructor Description ParallelismStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Integer
maxParallelism(Integer configuredParallelism, MetadataCalculationContext ctx)
Public only as a matter of implementation; operators should not call this method.
-
-
-
Field Detail
-
NON_PARALLELIZABLE
public static final ParallelismStrategy NON_PARALLELIZABLE
Indicates that the operator is non-parallelizable.
-
CONFIGURED
public static final ParallelismStrategy CONFIGURED
Indicates that the operator should use whatever parallelism has been explicitly configured viaOperatorSettings.getMaxParallelism()
, defaulting toEngineConfig#getParallelism()
.
-
NEGOTIATE_BASED_ON_SOURCE
public static final ParallelismStrategy NEGOTIATE_BASED_ON_SOURCE
Uses the maximum of the input ports' parallelism as this operator's max parallelism. If there are no parallel inputs, this will useInteger.MAX_VALUE
as its parallelism, forcing a "scatter" from the inputs. If this operator has an explicitOperatorSettings.maxParallelism(int)
specified on it or inherited from its parent, this will favor the explicit setting.
-
ACCEPT_SOURCE
public static final ParallelismStrategy ACCEPT_SOURCE
Uses the maximum of the input ports' parallelism as this operator's max parallelism. In contrast toNEGOTIATE_BASED_ON_SOURCE
, parallelism of 1 is a valid value and thus we will only be parallel if the source is parallel. If this operator has an explicitOperatorSettings.maxParallelism(int)
specified on it or inherited from its parent, this will favor the explicit setting.
-
-
Method Detail
-
maxParallelism
public abstract Integer maxParallelism(Integer configuredParallelism, MetadataCalculationContext ctx)
Public only as a matter of implementation; operators should not call this method. Computes the max parallelism to use.- Parameters:
configuredParallelism
- the parallelism explicitly configured ornull
if unspecifiedctx
- the context that the function can use to determine port inputs, etc- Returns:
- the max parallelism. a value of null will be interpretted as
Integer.MAX_VALUE
(unconstrained).
-
-