Class DualInputOperator<IN1,IN2,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.DualInputOperator<IN1,IN2,OUT,FT>
-
- Type Parameters:
IN1
- First input type of the user functionIN2
- Second input type of the user functionOUT
- Output type of the user functionFT
- Type of the user function
- Direct Known Subclasses:
CoGroupOperatorBase
,CoGroupRawOperatorBase
,CrossOperatorBase
,DeltaIterationBase
,JoinOperatorBase
,Union
@Internal public abstract class DualInputOperator<IN1,IN2,OUT,FT extends Function> extends AbstractUdfOperator<OUT,FT>
Abstract operator superclass for all operators that have two inputs, like "Join", "CoGroup", or "Cross".
-
-
Field Summary
Fields Modifier and Type Field Description protected Operator<IN1>
input1
The operator producing the first input.protected Operator<IN2>
input2
The operator producing the second input.-
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
DualInputOperator(UserCodeWrapper<FT> stub, BinaryOperatorInformation<IN1,IN2,OUT> operatorInfo, int[] keyPositions1, int[] keyPositions2, String name)
Creates a new abstract dual-input operator with the given name wrapping the given user function.protected
DualInputOperator(UserCodeWrapper<FT> stub, BinaryOperatorInformation<IN1,IN2,OUT> operatorInfo, String name)
Creates a new abstract dual-input Pact 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)
Contains the logic to invoke the visitor and continue the traversal.void
clearFirstInput()
Clears this operator's first input.void
clearSecondInput()
Clears this operator's second input.protected abstract List<OUT>
executeOnCollections(List<IN1> inputData1, List<IN2> inputData2, RuntimeContext runtimeContext, ExecutionConfig executionConfig)
Operator<IN1>
getFirstInput()
Returns the first input, 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.BinaryOperatorInformation<IN1,IN2,OUT>
getOperatorInfo()
Gets the information about the operators input/output types.Operator<IN2>
getSecondInput()
Returns the second input, or null, if none is set.DualInputSemanticProperties
getSemanticProperties()
void
setFirstInput(Operator<IN1> input)
Clears all previous connections and connects the first input to the task wrapped in this contractvoid
setSecondInput(Operator<IN2> input)
Clears all previous connections and connects the second input to the task wrapped in this contractvoid
setSemanticProperties(DualInputSemanticProperties 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
-
DualInputOperator
protected DualInputOperator(UserCodeWrapper<FT> stub, BinaryOperatorInformation<IN1,IN2,OUT> operatorInfo, String name)
Creates a new abstract dual-input Pact with the given name wrapping the given user function.- Parameters:
stub
- The class containing the user function.name
- The given name for the operator, used in plans, logs and progress messages.
-
DualInputOperator
protected DualInputOperator(UserCodeWrapper<FT> stub, BinaryOperatorInformation<IN1,IN2,OUT> operatorInfo, int[] keyPositions1, int[] keyPositions2, String name)
Creates a new abstract dual-input operator with the given name wrapping the given user function. This constructor is specialized only for operator that require no keys for their processing.- Parameters:
stub
- The object containing the user function.keyPositions1
- The positions of the fields in the first input that act as keys.keyPositions2
- The positions of the fields in the second input that act as keys.name
- The given name for the operator, used in plans, logs and progress messages.
-
-
Method Detail
-
getOperatorInfo
public BinaryOperatorInformation<IN1,IN2,OUT> getOperatorInfo()
Gets the information about the operators input/output types.- Overrides:
getOperatorInfo
in classOperator<OUT>
-
getFirstInput
public Operator<IN1> getFirstInput()
Returns the first input, or null, if none is set.- Returns:
- The contract's first input.
-
getSecondInput
public Operator<IN2> getSecondInput()
Returns the second input, or null, if none is set.- Returns:
- The contract's second input.
-
clearFirstInput
public void clearFirstInput()
Clears this operator's first input.
-
clearSecondInput
public void clearSecondInput()
Clears this operator's second input.
-
setFirstInput
public void setFirstInput(Operator<IN1> input)
Clears all previous connections and connects the first input to the task wrapped in this contract- Parameters:
input
- The contract that is connected as the first input.
-
setSecondInput
public void setSecondInput(Operator<IN2> input)
Clears all previous connections and connects the second input to the task wrapped in this contract- Parameters:
input
- The contract that is connected as the second input.
-
getSemanticProperties
public DualInputSemanticProperties getSemanticProperties()
-
setSemanticProperties
public void setSemanticProperties(DualInputSemanticProperties 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)
Description copied from interface:Visitable
Contains the logic to invoke the visitor and continue the traversal. Typically invokes the pre-visit method of the visitor, then sends the visitor to the children (or predecessors) and then invokes the post-visit method.A typical code example is the following:
public void accept(Visitor<Operator> visitor) { boolean descend = visitor.preVisit(this); if (descend) { if (this.input != null) { this.input.accept(visitor); } visitor.postVisit(this); } }
- Parameters:
visitor
- The visitor to be called with this object as the parameter.- See Also:
Visitor.preVisit(Visitable)
,Visitor.postVisit(Visitable)
-
executeOnCollections
protected abstract List<OUT> executeOnCollections(List<IN1> inputData1, List<IN2> inputData2, RuntimeContext runtimeContext, ExecutionConfig executionConfig) throws Exception
- Throws:
Exception
-
-