Class Operator<OUT>

    • Constructor Detail

      • Operator

        protected Operator​(OperatorInformation<OUT> operatorInfo,
                           String name)
        Creates a new contract with the given name. The parameters are empty by default and the compiler hints are not set.
        Parameters:
        name - The name that is used to describe the contract.
    • Method Detail

      • getOperatorInfo

        public OperatorInformation<OUT> getOperatorInfo()
        Gets the information about the operators input/output types.
      • getName

        public String getName()
        Gets the name of the contract instance. The name is only used to describe the contract instance in logging output and graphical representations.
        Returns:
        The contract instance's name.
      • setName

        public void setName​(String name)
        Sets the name of the contract instance. The name is only used to describe the contract instance in logging output and graphical representations.
        Parameters:
        name - The operator's name.
      • getCompilerHints

        public CompilerHints getCompilerHints()
        Gets the compiler hints for this contract instance. In the compiler hints, different fields may be set (for example the selectivity) that will be evaluated by the pact compiler when generating plan alternatives.
        Returns:
        The compiler hints object.
      • getParameters

        public Configuration getParameters()
        Gets the stub parameters of this contract. The stub parameters are a map that maps string keys to string or integer values. The map is accessible by the user code at runtime. Parameters that the user code needs to access at runtime to configure its behavior are typically stored in that configuration object.
        Returns:
        The configuration containing the stub parameters.
      • setParameter

        public void setParameter​(String key,
                                 String value)
        Sets a stub parameters in the configuration of this contract. The stub parameters are accessible by the user code at runtime. Parameters that the user code needs to access at runtime to configure its behavior are typically stored as stub parameters.
        Parameters:
        key - The parameter key.
        value - The parameter value.
        See Also:
        getParameters()
      • getParallelism

        public int getParallelism()
        Gets the parallelism for this contract instance. The parallelism denotes how many parallel instances of the user function will be spawned during the execution. If this value is ExecutionConfig.PARALLELISM_DEFAULT, then the system will decide the number of parallel instances by itself.
        Returns:
        The parallelism.
      • setParallelism

        public void setParallelism​(int parallelism)
        Sets the parallelism for this contract instance. The parallelism denotes how many parallel instances of the user function will be spawned during the execution.
        Parameters:
        parallelism - The number of parallel instances to spawn. Set this value to ExecutionConfig.PARALLELISM_DEFAULT to let the system decide on its own.
      • getMinResources

        @PublicEvolving
        public ResourceSpec getMinResources()
        Gets the minimum resources for this operator. The minimum resources denotes how many resources will be needed at least minimum for the operator or user function during the execution.
        Returns:
        The minimum resources of this operator.
      • getPreferredResources

        @PublicEvolving
        public ResourceSpec getPreferredResources()
        Gets the preferred resources for this contract instance. The preferred resources denote how many resources will be needed in the maximum for the user function during the execution.
        Returns:
        The preferred resource of this operator.
      • setResources

        @PublicEvolving
        public void setResources​(ResourceSpec minResources,
                                 ResourceSpec preferredResources)
        Sets the minimum and preferred resources for this contract instance. The resource denotes how many memories and cpu cores of the user function will be consumed during the execution.
        Parameters:
        minResources - The minimum resource of this operator.
        preferredResources - The preferred resource of this operator.
      • getUserCodeWrapper

        public UserCodeWrapper<?> getUserCodeWrapper()
        Gets the user code wrapper. In the case of a pact, that object will be the stub with the user function, in the case of an input or output format, it will be the format object.
        Returns:
        The class with the user code.
      • createUnionCascade

        public static <T> Operator<T> createUnionCascade​(List<? extends Operator<T>> operators)
        Takes a list of operators and creates a cascade of unions of this inputs, if needed. If not needed (there was only one operator in the list), then that operator is returned.
        Parameters:
        operators - The operators.
        Returns:
        The single operator or a cascade of unions of the operators.
      • createUnionCascade

        public static <T> Operator<T> createUnionCascade​(Operator<T>... operators)
        Takes a list of operators and creates a cascade of unions of this inputs, if needed. If not needed (there was only one operator in the list), then that operator is returned.
        Parameters:
        operators - The operators.
        Returns:
        The single operator or a cascade of unions of the operators.
      • createUnionCascade

        public static <T> Operator<T> createUnionCascade​(Operator<T> input1,
                                                         Operator<T>... input2)
        Takes a single Operator and a list of operators and creates a cascade of unions of this inputs, if needed. If not needed there was only one operator as input, then this operator is returned.
        Parameters:
        input1 - The first input operator.
        input2 - The other input operators.
        Returns:
        The single operator or a cascade of unions of the operators.