Class SingleInputOperator<IN,OUT,FT extends org.apache.flink.api.common.functions.Function>
- java.lang.Object
-
- org.apache.flink.api.common.operators.Operator<OUT>
-
- org.apache.flink.api.common.operators.AbstractUdfOperator<OUT,FT>
-
- org.apache.flink.api.common.operators.SingleInputOperator<IN,OUT,FT>
-
- Type Parameters:
IN- Input type of the user functionOUT- Output type of the user functionFT- Type of the user function
- Direct Known Subclasses:
BulkIterationBase,FilterOperatorBase,FlatMapOperatorBase,GroupCombineOperatorBase,GroupReduceOperatorBase,MapOperatorBase,MapPartitionOperatorBase,PartitionOperatorBase,ReduceOperatorBase,SortPartitionOperatorBase
@Internal public abstract class SingleInputOperator<IN,OUT,FT extends org.apache.flink.api.common.functions.Function> extends AbstractUdfOperator<OUT,FT>
Abstract superclass for all operators that have one input like "map" or "reduce".
-
-
Field Summary
Fields Modifier and Type Field Description protected Operator<IN>inputThe input which produces the data consumed by this operator.-
Fields inherited from class org.apache.flink.api.common.operators.AbstractUdfOperator
broadcastInputs, userFunction
-
Fields inherited from class org.apache.flink.api.common.operators.Operator
compilerHints, name, operatorInfo, parameters
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSingleInputOperator(UserCodeWrapper<FT> stub, UnaryOperatorInformation<IN,OUT> operatorInfo, int[] keyPositions, String name)Creates a new abstract single-input operator with the given name wrapping the given user function.protectedSingleInputOperator(UserCodeWrapper<FT> stub, UnaryOperatorInformation<IN,OUT> operatorInfo, String name)Creates a new abstract single-input operator with the given name wrapping the given user function.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(Visitor<Operator<?>> visitor)Accepts the visitor and applies it this instance.voidaddInput(List<Operator<IN>> inputs)Deprecated.This method will be removed in future versions.voidaddInput(Operator<IN>... input)Deprecated.This method will be removed in future versions.voidclearInputs()Removes all inputs.protected abstract List<OUT>executeOnCollections(List<IN> inputData, RuntimeContext runtimeContext, ExecutionConfig executionConfig)Operator<IN>getInput()Returns the input operator or data source, or null, if none is set.int[]getKeyColumns(int inputNum)Gets the column numbers of the key fields in the input records for the given input.intgetNumberOfInputs()Gets the number of inputs for this operator.UnaryOperatorInformation<IN,OUT>getOperatorInfo()Gets the information about the operators input/output types.SingleInputSemanticPropertiesgetSemanticProperties()voidsetInput(Operator<IN> input)Sets the given operator as the input to this operator.voidsetInput(Operator<IN>... input)Deprecated.This method will be removed in future versions.voidsetInputs(List<Operator<IN>> inputs)Deprecated.This method will be removed in future versions.voidsetSemanticProperties(SingleInputSemanticProperties semanticProperties)-
Methods inherited from class org.apache.flink.api.common.operators.AbstractUdfOperator
asArray, emptyClassArray, getBroadcastInputs, getUserCodeWrapper, setBroadcastVariable, setBroadcastVariables
-
Methods inherited from class org.apache.flink.api.common.operators.Operator
createUnionCascade, createUnionCascade, createUnionCascade, getCompilerHints, getMinResources, getName, getParallelism, getParameters, getPreferredResources, setName, setParallelism, setParameter, setParameter, setParameter, setResources, toString
-
-
-
-
Constructor Detail
-
SingleInputOperator
protected SingleInputOperator(UserCodeWrapper<FT> stub, UnaryOperatorInformation<IN,OUT> operatorInfo, int[] keyPositions, String name)
Creates a new abstract single-input operator with the given name wrapping the given user function.- Parameters:
stub- The object containing the user function.keyPositions- The field positions of the input records that act as keys.name- The given name for the operator, used in plans, logs and progress messages.
-
SingleInputOperator
protected SingleInputOperator(UserCodeWrapper<FT> stub, UnaryOperatorInformation<IN,OUT> operatorInfo, String name)
Creates a new abstract single-input operator with the given name wrapping the given user function. This constructor is specialized only for operators that require no keys for their processing.- Parameters:
stub- The object containing the user function.name- The given name for the operator, used in plans, logs and progress messages.
-
-
Method Detail
-
getOperatorInfo
public UnaryOperatorInformation<IN,OUT> getOperatorInfo()
Gets the information about the operators input/output types.- Overrides:
getOperatorInfoin classOperator<OUT>
-
getInput
public Operator<IN> getInput()
Returns the input operator or data source, or null, if none is set.- Returns:
- This operator's input.
-
clearInputs
public void clearInputs()
Removes all inputs.
-
setInput
public void setInput(Operator<IN> input)
Sets the given operator as the input to this operator.- Parameters:
input- The operator to use as the input.
-
setInput
@Deprecated public void setInput(Operator<IN>... input)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the input to the union of the given operators.- Parameters:
input- The operator(s) that form the input.
-
setInputs
@Deprecated public void setInputs(List<Operator<IN>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the input to the union of the given operators.- Parameters:
inputs- The operator(s) that form the input.
-
addInput
@Deprecated public void addInput(Operator<IN>... input)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Adds to the input the union of the given operators.- Parameters:
input- The operator(s) that form the input.
-
addInput
@Deprecated public void addInput(List<Operator<IN>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Adds to the input the union of the given operators.- Parameters:
inputs- The operator(s) that form the input.
-
getSemanticProperties
public SingleInputSemanticProperties getSemanticProperties()
-
setSemanticProperties
public void setSemanticProperties(SingleInputSemanticProperties semanticProperties)
-
getNumberOfInputs
public final int getNumberOfInputs()
Description copied from class:AbstractUdfOperatorGets the number of inputs for this operator.- Specified by:
getNumberOfInputsin classAbstractUdfOperator<OUT,FT extends org.apache.flink.api.common.functions.Function>- Returns:
- The number of inputs for this operator.
-
getKeyColumns
public int[] getKeyColumns(int inputNum)
Description copied from class:AbstractUdfOperatorGets the column numbers of the key fields in the input records for the given input.- Specified by:
getKeyColumnsin classAbstractUdfOperator<OUT,FT extends org.apache.flink.api.common.functions.Function>- Returns:
- The column numbers of the key fields.
-
accept
public void accept(Visitor<Operator<?>> visitor)
Accepts the visitor and applies it this instance. The visitors pre-visit method is called and, if returning true, the visitor is recursively applied on the single input. After the recursion returned, the post-visit method is called.- Parameters:
visitor- The visitor.- See Also:
Visitable.accept(org.apache.flink.util.Visitor)
-
executeOnCollections
protected abstract List<OUT> executeOnCollections(List<IN> inputData, RuntimeContext runtimeContext, ExecutionConfig executionConfig) throws Exception
- Throws:
Exception
-
-