Class LoopOperator<InputType,ConvergenceType>
- java.lang.Object
-
- org.apache.wayang.core.plan.wayangplan.OperatorBase
-
- org.apache.wayang.basic.operators.LoopOperator<InputType,ConvergenceType>
-
- All Implemented Interfaces:
java.io.Serializable,ActualOperator,ElementaryOperator,LoopHeadOperator,Operator
- Direct Known Subclasses:
FlinkLoopOperator,JavaLoopOperator,SparkLoopOperator
public class LoopOperator<InputType,ConvergenceType> extends OperatorBase implements ElementaryOperator, LoopHeadOperator
This operator has three inputs and three outputs.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
OperatorBase.GsonSerializer
-
Nested classes/interfaces inherited from interface org.apache.wayang.core.plan.wayangplan.LoopHeadOperator
LoopHeadOperator.State
-
-
Field Summary
Fields Modifier and Type Field Description protected PredicateDescriptor<java.util.Collection<ConvergenceType>>criterionDescriptorFunction that this operator applies to the input elements.static intFINAL_OUTPUT_INDEXstatic intINITIAL_CONVERGENCE_INPUT_INDEXstatic intINITIAL_INPUT_INDEXstatic intITERATION_CONVERGENCE_INPUT_INDEXstatic intITERATION_CONVERGENCE_OUTPUT_INDEXstatic intITERATION_INPUT_INDEXstatic intITERATION_OUTPUT_INDEX-
Fields inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
inputSlots, outputSlots, STANDARD_OPERATOR_ARGS
-
Fields inherited from interface org.apache.wayang.core.plan.wayangplan.Operator
FIRST_EPOCH
-
-
Constructor Summary
Constructors Constructor Description LoopOperator(java.lang.Class<InputType> inputTypeClass, java.lang.Class<ConvergenceType> convergenceTypeClass, FunctionDescriptor.SerializablePredicate<java.util.Collection<ConvergenceType>> criterionPredicate, java.lang.Integer numExpectedIterations)LoopOperator(LoopOperator<InputType,ConvergenceType> that)Creates a copy of the givenLoopOperator.LoopOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, FunctionDescriptor.SerializablePredicate<java.util.Collection<ConvergenceType>> criterionPredicate, java.lang.Integer numExpectedIterations)LoopOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, PredicateDescriptor<java.util.Collection<ConvergenceType>> criterionDescriptor, java.lang.Integer numExpectedIterations)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginIteration(Operator beginOperator, int beginInputIndex, Operator convergeOperator, int convergeInputIndex)voidbeginIteration(Operator beginOperator, Operator convergeOperator)java.util.Optional<CardinalityEstimator>createCardinalityEstimator(int outputIndex, Configuration configuration)voidendIteration(Operator endOperator, int endOpOutputIndex, Operator convergeOperator, int convergeOutputIndex)voidendIteration(Operator endOperator, Operator convergeOperator)java.util.Collection<InputSlot<?>>getConditionInputSlots()Retrieve thoseInputSlots that are required to evaluate the loop condition.java.util.Collection<OutputSlot<?>>getConditionOutputSlots()Retrieve thoseOutputSlots that forward theLoopHeadOperator.getConditionInputSlots().DataSetType<ConvergenceType>getConvergenceType()PredicateDescriptor<java.util.Collection<ConvergenceType>>getCriterionDescriptor()java.util.Collection<OutputSlot<?>>getFinalLoopOutputs()If this instance is the head of a loop, then return theseOutputSlots that form the final result of the iteration.java.util.Collection<OutputSlot<?>>getForwards(InputSlot<?> input)Declare forward rules.DataSetType<InputType>getInputType()java.util.Collection<InputSlot<?>>getLoopBodyInputs()java.util.Collection<OutputSlot<?>>getLoopBodyOutputs()If this instance is the head of a loop, then return theseOutputSlots that go into the loop body (as opposed to theOutputSlots that form the final result of the iteration).java.util.Collection<InputSlot<?>>getLoopInitializationInputs()If this instance is the head of a loop, then return theseInputSlots that initialize the loop.intgetNumExpectedIterations()LoopHeadOperator.StategetState()Optional operation.voidinitialize(Operator initOperator, int initOpOutputIndex, Operator convOperator, int convOpOutputIndex)voidinitialize(Operator initOperator, Operator convOperator)booleanisReading(InputSlot<?> input)Tells whether the giveninputis read by this operator.voidoutputConnectTo(Operator outputOperator)voidoutputConnectTo(Operator outputOperator, int thatInputIndex)voidsetNumExpectedIterations(int numExpectedIterations)voidsetState(LoopHeadOperator.State state)Optional operation.-
Methods inherited from class org.apache.wayang.core.plan.wayangplan.OperatorBase
accept, addBroadcastInput, addTargetPlatform, at, collectMappedInputSlots, collectMappedOutputSlots, copy, createCopy, getAllInputs, getAllOutputs, getCardinalityEstimator, getContainer, getEpoch, getName, getOriginal, getSimpleClassName, getTargetPlatforms, isAuxiliary, isSupportingBroadcastInputs, propagateInputCardinality, propagateOutputCardinality, setAuxiliary, setCardinalityEstimator, setContainer, setEpoch, setName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.ActualOperator
accept
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.ElementaryOperator
getCardinalityEstimator, isAuxiliary, setAuxiliary, setCardinalityEstimator
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.LoopHeadOperator
getCardinalityPusher, getFinalizationPusher, getInitializationPusher
-
Methods inherited from interface org.apache.wayang.core.plan.wayangplan.Operator
addBroadcastInput, addTargetPlatform, broadcastTo, broadcastTo, collectMappedInputSlots, collectMappedOutputSlots, connectTo, connectTo, getAllInputs, getAllOutputs, getContainer, getEffectiveOccupant, getEffectiveOccupant, getEpoch, getEstimationContextProperties, getInnermostLoop, getInput, getInput, getLoopStack, getName, getNumBroadcastInputs, getNumInputs, getNumOutputs, getNumRegularInputs, getOuterInputSlot, getOutermostInputSlot, getOutermostOutputSlots, getOutput, getOutput, getParent, getTargetPlatforms, isAlternative, isElementary, isExecutionOperator, isFeedbackInput, isFeedforwardOutput, isLoopHead, isLoopSubplan, isOwnerOf, isSink, isSource, isSubplan, isSupportingBroadcastInputs, isUnconnected, propagateInputCardinality, propagateOutputCardinality, propagateOutputCardinality, setContainer, setEpoch, setInput, setName, setOutput
-
-
-
-
Field Detail
-
INITIAL_INPUT_INDEX
public static final int INITIAL_INPUT_INDEX
- See Also:
- Constant Field Values
-
INITIAL_CONVERGENCE_INPUT_INDEX
public static final int INITIAL_CONVERGENCE_INPUT_INDEX
- See Also:
- Constant Field Values
-
ITERATION_INPUT_INDEX
public static final int ITERATION_INPUT_INDEX
- See Also:
- Constant Field Values
-
ITERATION_CONVERGENCE_INPUT_INDEX
public static final int ITERATION_CONVERGENCE_INPUT_INDEX
- See Also:
- Constant Field Values
-
ITERATION_OUTPUT_INDEX
public static final int ITERATION_OUTPUT_INDEX
- See Also:
- Constant Field Values
-
ITERATION_CONVERGENCE_OUTPUT_INDEX
public static final int ITERATION_CONVERGENCE_OUTPUT_INDEX
- See Also:
- Constant Field Values
-
FINAL_OUTPUT_INDEX
public static final int FINAL_OUTPUT_INDEX
- See Also:
- Constant Field Values
-
criterionDescriptor
protected final PredicateDescriptor<java.util.Collection<ConvergenceType>> criterionDescriptor
Function that this operator applies to the input elements.
-
-
Constructor Detail
-
LoopOperator
public LoopOperator(java.lang.Class<InputType> inputTypeClass, java.lang.Class<ConvergenceType> convergenceTypeClass, FunctionDescriptor.SerializablePredicate<java.util.Collection<ConvergenceType>> criterionPredicate, java.lang.Integer numExpectedIterations)
-
LoopOperator
public LoopOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, FunctionDescriptor.SerializablePredicate<java.util.Collection<ConvergenceType>> criterionPredicate, java.lang.Integer numExpectedIterations)
-
LoopOperator
public LoopOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, PredicateDescriptor<java.util.Collection<ConvergenceType>> criterionDescriptor, java.lang.Integer numExpectedIterations)
Creates a new instance.
-
LoopOperator
public LoopOperator(LoopOperator<InputType,ConvergenceType> that)
Creates a copy of the givenLoopOperator.- Parameters:
that- should be copied
-
-
Method Detail
-
getState
public LoopHeadOperator.State getState()
Description copied from interface:LoopHeadOperatorOptional operation. OnlyExecutionOperators need to implement this method.- Specified by:
getStatein interfaceLoopHeadOperator- Returns:
- the current
LoopHeadOperator.Stateof this instance
-
setState
public void setState(LoopHeadOperator.State state)
Description copied from interface:LoopHeadOperatorOptional operation. OnlyExecutionOperators need to implement this method. Sets theLoopHeadOperator.Stateof this instance.- Specified by:
setStatein interfaceLoopHeadOperator
-
getInputType
public DataSetType<InputType> getInputType()
-
getConvergenceType
public DataSetType<ConvergenceType> getConvergenceType()
-
initialize
public void initialize(Operator initOperator, int initOpOutputIndex, Operator convOperator, int convOpOutputIndex)
-
beginIteration
public void beginIteration(Operator beginOperator, int beginInputIndex, Operator convergeOperator, int convergeInputIndex)
-
endIteration
public void endIteration(Operator endOperator, int endOpOutputIndex, Operator convergeOperator, int convergeOutputIndex)
-
outputConnectTo
public void outputConnectTo(Operator outputOperator, int thatInputIndex)
-
outputConnectTo
public void outputConnectTo(Operator outputOperator)
-
getCriterionDescriptor
public PredicateDescriptor<java.util.Collection<ConvergenceType>> getCriterionDescriptor()
-
getForwards
public java.util.Collection<OutputSlot<?>> getForwards(InputSlot<?> input)
Description copied from interface:OperatorDeclare forward rules. Execution engines may take the chance to optimize the executed plans by having forwarded data by-pass this instance. However, note the specific semantics of a forward rule: If anOperatorserves anOutputSlotthat is involved in a foward rule, it will do so by forwarding. If theOutputSlotis not served, then the forwarding does not apply.- Specified by:
getForwardsin interfaceOperator- Returns:
OutputSlots to which this instance forwards the giveninput.- See Also:
Operator.isReading(InputSlot)
-
isReading
public boolean isReading(InputSlot<?> input)
Description copied from interface:OperatorTells whether the giveninputis read by this operator. If not, the optimizer can make use of this insight.- Specified by:
isReadingin interfaceOperator- See Also:
Operator.getForwards(InputSlot)
-
createCardinalityEstimator
public java.util.Optional<CardinalityEstimator> createCardinalityEstimator(int outputIndex, Configuration configuration)
Description copied from interface:ElementaryOperator- Specified by:
createCardinalityEstimatorin interfaceElementaryOperator- Parameters:
outputIndex- index of theOutputSlotfor that theCardinalityEstimatoris requestedconfiguration- if theCardinalityEstimatordepends on further ones, use this to obtain the latter- Returns:
- an
Optionalthat might provide the requested instance
-
getLoopBodyOutputs
public java.util.Collection<OutputSlot<?>> getLoopBodyOutputs()
Description copied from interface:LoopHeadOperatorIf this instance is the head of a loop, then return theseOutputSlots that go into the loop body (as opposed to theOutputSlots that form the final result of the iteration).- Specified by:
getLoopBodyOutputsin interfaceLoopHeadOperator- Returns:
- the loop body-bound
OutputSlots
-
getFinalLoopOutputs
public java.util.Collection<OutputSlot<?>> getFinalLoopOutputs()
Description copied from interface:LoopHeadOperatorIf this instance is the head of a loop, then return theseOutputSlots that form the final result of the iteration.- Specified by:
getFinalLoopOutputsin interfaceLoopHeadOperator- Returns:
- the loop-terminal
OutputSlots
-
getLoopBodyInputs
public java.util.Collection<InputSlot<?>> getLoopBodyInputs()
Description copied from interface:LoopHeadOperatorIf this instance is the head of a loop, then return theseInputSlots that are fed from the loop body (as opposed to theInputSlots that initialize the loop).- Specified by:
getLoopBodyInputsin interfaceLoopHeadOperator- Returns:
- the loop body-bound
InputSlots
-
getLoopInitializationInputs
public java.util.Collection<InputSlot<?>> getLoopInitializationInputs()
Description copied from interface:LoopHeadOperatorIf this instance is the head of a loop, then return theseInputSlots that initialize the loop.- Specified by:
getLoopInitializationInputsin interfaceLoopHeadOperator- Returns:
- the initialization
InputSlots
-
getConditionInputSlots
public java.util.Collection<InputSlot<?>> getConditionInputSlots()
Description copied from interface:LoopHeadOperatorRetrieve thoseInputSlots that are required to evaluate the loop condition.- Specified by:
getConditionInputSlotsin interfaceLoopHeadOperator- Returns:
- the condition
InputSlots
-
getConditionOutputSlots
public java.util.Collection<OutputSlot<?>> getConditionOutputSlots()
Description copied from interface:LoopHeadOperatorRetrieve thoseOutputSlots that forward theLoopHeadOperator.getConditionInputSlots().- Specified by:
getConditionOutputSlotsin interfaceLoopHeadOperator- Returns:
- the condition
OutputSlots
-
setNumExpectedIterations
public void setNumExpectedIterations(int numExpectedIterations)
-
getNumExpectedIterations
public int getNumExpectedIterations()
- Specified by:
getNumExpectedIterationsin interfaceLoopHeadOperator- Returns:
- a number of expected iterations; not necessarily the actual value
-
-