Class DualInputOperator<IN1,IN2,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.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 org.apache.flink.api.common.functions.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>input1The operator producing the first input.protected Operator<IN2>input2The 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 protectedDualInputOperator(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.protectedDualInputOperator(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 Deprecated Methods Modifier and Type Method Description voidaccept(Visitor<Operator<?>> visitor)Contains the logic to invoke the visitor and continue the traversal.voidaddFirstInput(Operator<IN1>... input)Deprecated.This method will be removed in future versions.voidaddFirstInputs(List<Operator<IN1>> inputs)Deprecated.This method will be removed in future versions.voidaddSecondInput(Operator<IN2>... input)Deprecated.This method will be removed in future versions.voidaddSecondInputs(List<Operator<IN2>> inputs)Deprecated.This method will be removed in future versions.voidclearFirstInput()Clears this operator's first input.voidclearSecondInput()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.intgetNumberOfInputs()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.DualInputSemanticPropertiesgetSemanticProperties()voidsetFirstInput(Operator<IN1> input)Clears all previous connections and connects the first input to the task wrapped in this contractvoidsetFirstInput(Operator<IN1>... inputs)Deprecated.This method will be removed in future versions.voidsetFirstInputs(List<Operator<IN1>> inputs)Deprecated.This method will be removed in future versions.voidsetSecondInput(Operator<IN2> input)Clears all previous connections and connects the second input to the task wrapped in this contractvoidsetSecondInput(Operator<IN2>... inputs)Deprecated.This method will be removed in future versions.voidsetSecondInputs(List<Operator<IN2>> inputs)Deprecated.This method will be removed in future versions.voidsetSemanticProperties(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, setParameter, 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:
getOperatorInfoin 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.
-
setFirstInput
@Deprecated public void setFirstInput(Operator<IN1>... inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the first input to the union of the given operators.- Parameters:
inputs- The operator(s) that form the first input.
-
setSecondInput
@Deprecated public void setSecondInput(Operator<IN2>... inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the second input to the union of the given operators.- Parameters:
inputs- The operator(s) that form the second input.
-
setFirstInputs
@Deprecated public void setFirstInputs(List<Operator<IN1>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the first input to the union of the given operators.- Parameters:
inputs- The operator(s) that form the first inputs.
-
setSecondInputs
@Deprecated public void setSecondInputs(List<Operator<IN2>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Sets the second input to the union of the given operators.- Parameters:
inputs- The operator(s) that form the second inputs.
-
addFirstInput
@Deprecated public void addFirstInput(Operator<IN1>... input)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Add to the first input the union of the given operators.- Parameters:
input- The operator(s) to be unioned with the first input.
-
addSecondInput
@Deprecated public void addSecondInput(Operator<IN2>... input)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Add to the second input the union of the given operators.- Parameters:
input- The operator(s) to be unioned with the second input.
-
addFirstInputs
@Deprecated public void addFirstInputs(List<Operator<IN1>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Add to the first input the union of the given operators.- Parameters:
inputs- The operator(s) to be unioned with the first input.
-
addSecondInputs
@Deprecated public void addSecondInputs(List<Operator<IN2>> inputs)
Deprecated.This method will be removed in future versions. Use theUnionoperator instead.Add to the second input the union of the given operators.- Parameters:
inputs- The operator(s) to be unioned with the second input.
-
getSemanticProperties
public DualInputSemanticProperties getSemanticProperties()
-
setSemanticProperties
public void setSemanticProperties(DualInputSemanticProperties 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)
Description copied from interface:VisitableContains 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
-
-