Class SingleInputOperator<IN,OUT,FT extends 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 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>
input
The 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 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.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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor<Operator<?>> visitor)
Accepts the visitor and applies it this instance.void
clearInputs()
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.int
getNumberOfInputs()
Gets the number of inputs for this operator.UnaryOperatorInformation<IN,OUT>
getOperatorInfo()
Gets the information about the operators input/output types.SingleInputSemanticProperties
getSemanticProperties()
void
setInput(Operator<IN> input)
Sets the given operator as the input to this operator.void
setSemanticProperties(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, 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:
getOperatorInfo
in 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.
-
getSemanticProperties
public SingleInputSemanticProperties getSemanticProperties()
-
setSemanticProperties
public void setSemanticProperties(SingleInputSemanticProperties semanticProperties)
-
getNumberOfInputs
public final int getNumberOfInputs()
Description copied from class:AbstractUdfOperator
Gets the number of inputs for this operator.- Specified by:
getNumberOfInputs
in classAbstractUdfOperator<OUT,FT extends Function>
- Returns:
- The number of inputs for this operator.
-
getKeyColumns
public int[] getKeyColumns(int inputNum)
Description copied from class:AbstractUdfOperator
Gets the column numbers of the key fields in the input records for the given input.- Specified by:
getKeyColumns
in classAbstractUdfOperator<OUT,FT extends 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
-
-