Class ParallelismStrategy

java.lang.Object
com.pervasive.datarush.operators.ParallelismStrategy

public abstract class ParallelismStrategy extends Object
A ParallelismStrategy 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:

  1. NON_PARALLELIZABLE
  2. CONFIGURED
  3. ACCEPT_SOURCE
  4. NEGOTIATE_BASED_ON_SOURCE
  • Field Details

    • 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 via OperatorSettings.getMaxParallelism(), defaulting to EngineConfig#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 use Integer.MAX_VALUE as its parallelism, forcing a "scatter" from the inputs. If this operator has an explicit OperatorSettings.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 to NEGOTIATE_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 explicit OperatorSettings.maxParallelism(int) specified on it or inherited from its parent, this will favor the explicit setting.
  • Constructor Details

    • ParallelismStrategy

      public ParallelismStrategy()
  • Method Details

    • 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 or null if unspecified
      ctx - 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).