Class AbstractUdfOperator<OUT,​FT extends Function>

    • Field Detail

      • userFunction

        protected final UserCodeWrapper<FT extends Function> userFunction
        The object or class containing the user function.
      • broadcastInputs

        protected final Map<String,​Operator<?>> broadcastInputs
        The extra inputs which parameterize the user function.
    • Constructor Detail

      • AbstractUdfOperator

        protected AbstractUdfOperator​(UserCodeWrapper<FT> function,
                                      OperatorInformation<OUT> operatorInfo,
                                      String name)
        Creates a new abstract operator with the given name wrapping the given user function.
        Parameters:
        function - The wrapper object containing the user function.
        name - The given name for the operator, used in plans, logs and progress messages.
    • Method Detail

      • getUserCodeWrapper

        public UserCodeWrapper<FT> getUserCodeWrapper()
        Gets the function that is held by this operator. The function is the actual implementation of the user code.

        This throws an exception if the pact does not contain an object but a class for the user code.

        Overrides:
        getUserCodeWrapper in class Operator<OUT>
        Returns:
        The object with the user function for this operator.
        See Also:
        Operator.getUserCodeWrapper()
      • getBroadcastInputs

        public Map<String,​Operator<?>> getBroadcastInputs()
        Returns the input, or null, if none is set.
        Returns:
        The broadcast input root operator.
      • setBroadcastVariable

        public void setBroadcastVariable​(String name,
                                         Operator<?> root)
        Binds the result produced by a plan rooted at root to a variable used by the UDF wrapped in this operator.
        Parameters:
        root - The root of the plan producing this input.
      • setBroadcastVariables

        public <T> void setBroadcastVariables​(Map<String,​Operator<T>> inputs)
        Clears all previous broadcast inputs and binds the given inputs as broadcast variables of this operator.
        Parameters:
        inputs - The <name, root> pairs to be set as broadcast inputs.
      • getNumberOfInputs

        public abstract int getNumberOfInputs()
        Gets the number of inputs for this operator.
        Returns:
        The number of inputs for this operator.
      • getKeyColumns

        public abstract int[] getKeyColumns​(int inputNum)
        Gets the column numbers of the key fields in the input records for the given input.
        Returns:
        The column numbers of the key fields.
      • asArray

        protected static <U> Class<U>[] asArray​(Class<U> clazz)
        Generic utility function that wraps a single class object into an array of that class type.
        Type Parameters:
        U - The type of the classes.
        Parameters:
        clazz - The class object to be wrapped.
        Returns:
        An array wrapping the class object.
      • emptyClassArray

        protected static <U> Class<U>[] emptyClassArray()
        Generic utility function that returns an empty class array.
        Type Parameters:
        U - The type of the classes.
        Returns:
        An empty array of type Class<U>.