Package org.apache.flink.optimizer.plan
Class PlanNode
- java.lang.Object
-
- org.apache.flink.optimizer.plan.PlanNode
-
- All Implemented Interfaces:
DumpableNode<PlanNode>,org.apache.flink.util.Visitable<PlanNode>
- Direct Known Subclasses:
BulkPartialSolutionPlanNode,DualInputPlanNode,NAryUnionPlanNode,SingleInputPlanNode,SolutionSetPlanNode,SourcePlanNode,WorksetPlanNode
public abstract class PlanNode extends Object implements org.apache.flink.util.Visitable<PlanNode>, DumpableNode<PlanNode>
The representation of a data exchange between two operators. The data exchange can realize a shipping strategy, which established global properties, and a local strategy, which establishes local properties.Because we currently deal only with plans where the operator order is fixed, many properties are equal among candidates and are determined prior to the enumeration (such as for example constant/dynamic path membership). Hence, many methods will delegate to the
OptimizerNodethat represents the node this candidate was created for.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlanNode.FeedbackPropertiesMeetRequirementsReportstatic classPlanNode.SourceAndDamReport
-
Field Summary
Fields Modifier and Type Field Description protected Map<OptimizerNode,PlanNode>branchPlanprotected CostscumulativeCostsprotected GlobalPropertiesglobalPropsprotected LocalPropertieslocalPropsprotected CostsnodeCostsprotected List<Channel>outChannelsprotected OptimizerNodetemplate
-
Constructor Summary
Constructors Constructor Description PlanNode(OptimizerNode template, String nodeName, org.apache.flink.runtime.operators.DriverStrategy strategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddOutgoingChannel(Channel channel)Adds a channel to a successor node to this node.PlanNode.FeedbackPropertiesMeetRequirementsReportcheckPartialSolutionPropertiesMet(PlanNode partialSolution, GlobalProperties feedbackGlobal, LocalProperties feedbackLocal)Map<OptimizerNode,PlanNode>getBranchPlan()List<NamedChannel>getBroadcastInputs()Gets a list of all broadcast inputs attached to this node.PlanNodegetCandidateAtBranchPoint(OptimizerNode branchPoint)intgetCostWeight()CostsgetCumulativeCosts()Gets the cumulative costs of this nose.CostsgetCumulativeCostsShare()org.apache.flink.runtime.operators.DriverStrategygetDriverStrategy()Gets the driver strategy from this node.Iterable<DumpableConnection<PlanNode>>getDumpableInputs()GlobalPropertiesgetGlobalProperties()Gets the global properties from this PlanNode.longgetGuaranteedAvailableMemory()abstract Iterable<Channel>getInputs()LocalPropertiesgetLocalProperties()Gets the local properties from this PlanNode.intgetMemoryConsumerWeight()org.apache.flink.api.common.operators.ResourceSpecgetMinResources()CostsgetNodeCosts()Gets the costs incurred by this node.StringgetNodeName()Gets the name of the plan node.OptimizerNodegetOptimizerNode()OptimizerNodegetOriginalOptimizerNode()Gets the node from the optimizer DAG for which this plan candidate node was created.List<Channel>getOutgoingChannels()Gets a list of all outgoing channels leading to successors.intgetParallelism()PlanNodegetPlanNode()abstract Iterable<PlanNode>getPredecessors()Gets an iterator over the predecessors.org.apache.flink.api.common.operators.ResourceSpecgetPreferredResources()org.apache.flink.api.common.operators.Operator<?>getProgramOperator()Gets the program operator that this node represents in the plan.doublegetRelativeMemoryPerSubTask()Gets the memory dedicated to each sub-task for this node.abstract PlanNode.SourceAndDamReporthasDamOnPathDownTo(PlanNode source)Checks whether this node has a dam on the way down to the given source node.voidinitProperties(GlobalProperties globals, LocalProperties locals)booleanisOnDynamicPath()booleanisPruneMarkerSet()Checks whether the pruning marker was set.protected voidmergeBranchPlanMaps(Map<OptimizerNode,PlanNode> branchPlan1, Map<OptimizerNode,PlanNode> branchPlan2)protected voidmergeBranchPlanMaps(PlanNode pred1, PlanNode pred2)voidsetBroadcastInputs(List<NamedChannel> broadcastInputs)Sets a list of all broadcast inputs attached to this node.voidsetCosts(Costs nodeCosts)Sets the basic cost for this node to the given value, and sets the cumulative costs to those costs plus the cost shares of all inputs (regular and broadcast).voidsetDriverStrategy(org.apache.flink.runtime.operators.DriverStrategy newDriverStrategy)Sets the driver strategy for this node.voidsetParallelism(int parallelism)voidsetPruningMarker()Sets the pruning marker to true.voidsetRelativeMemoryPerSubtask(double relativeMemoryPerSubtask)Sets the memory dedicated to each task for this node.StringtoString()voidupdatePropertiesWithUniqueSets(Set<org.apache.flink.api.common.operators.util.FieldSet> uniqueFieldCombinations)
-
-
-
Field Detail
-
template
protected final OptimizerNode template
-
localProps
protected LocalProperties localProps
-
globalProps
protected GlobalProperties globalProps
-
branchPlan
protected Map<OptimizerNode,PlanNode> branchPlan
-
nodeCosts
protected Costs nodeCosts
-
cumulativeCosts
protected Costs cumulativeCosts
-
-
Constructor Detail
-
PlanNode
public PlanNode(OptimizerNode template, String nodeName, org.apache.flink.runtime.operators.DriverStrategy strategy)
-
-
Method Detail
-
mergeBranchPlanMaps
protected void mergeBranchPlanMaps(Map<OptimizerNode,PlanNode> branchPlan1, Map<OptimizerNode,PlanNode> branchPlan2)
-
getOriginalOptimizerNode
public OptimizerNode getOriginalOptimizerNode()
Gets the node from the optimizer DAG for which this plan candidate node was created.- Returns:
- The optimizer's DAG node.
-
getProgramOperator
public org.apache.flink.api.common.operators.Operator<?> getProgramOperator()
Gets the program operator that this node represents in the plan.- Returns:
- The program operator this node represents in the plan.
-
getNodeName
public String getNodeName()
Gets the name of the plan node.- Returns:
- The name of the plan node.
-
getMemoryConsumerWeight
public int getMemoryConsumerWeight()
-
getRelativeMemoryPerSubTask
public double getRelativeMemoryPerSubTask()
Gets the memory dedicated to each sub-task for this node.- Returns:
- The memory per task, in bytes.
-
setRelativeMemoryPerSubtask
public void setRelativeMemoryPerSubtask(double relativeMemoryPerSubtask)
Sets the memory dedicated to each task for this node.- Parameters:
relativeMemoryPerSubtask- The relative memory per sub-task
-
getDriverStrategy
public org.apache.flink.runtime.operators.DriverStrategy getDriverStrategy()
Gets the driver strategy from this node. This determines for example for a match Pact whether to use a merge or a hybrid hash strategy.- Returns:
- The driver strategy.
-
setDriverStrategy
public void setDriverStrategy(org.apache.flink.runtime.operators.DriverStrategy newDriverStrategy)
Sets the driver strategy for this node. Usually should not be changed.- Parameters:
newDriverStrategy- The driver strategy.
-
initProperties
public void initProperties(GlobalProperties globals, LocalProperties locals)
-
getLocalProperties
public LocalProperties getLocalProperties()
Gets the local properties from this PlanNode.- Returns:
- The local properties.
-
getGlobalProperties
public GlobalProperties getGlobalProperties()
Gets the global properties from this PlanNode.- Returns:
- The global properties.
-
getNodeCosts
public Costs getNodeCosts()
Gets the costs incurred by this node. The costs reflect also the costs incurred by the shipping strategies of the incoming connections.- Returns:
- The node-costs, or null, if not yet set.
-
getCumulativeCosts
public Costs getCumulativeCosts()
Gets the cumulative costs of this nose. The cumulative costs are the sum of the costs of this node and of all nodes in the subtree below this node.- Returns:
- The cumulative costs, or null, if not yet set.
-
getCumulativeCostsShare
public Costs getCumulativeCostsShare()
-
setCosts
public void setCosts(Costs nodeCosts)
Sets the basic cost for this node to the given value, and sets the cumulative costs to those costs plus the cost shares of all inputs (regular and broadcast).- Parameters:
nodeCosts- The already knows costs for this node (this cost a produces by a concreteOptimizerNodesubclass.
-
setParallelism
public void setParallelism(int parallelism)
-
getParallelism
public int getParallelism()
-
getMinResources
public org.apache.flink.api.common.operators.ResourceSpec getMinResources()
-
getPreferredResources
public org.apache.flink.api.common.operators.ResourceSpec getPreferredResources()
-
getGuaranteedAvailableMemory
public long getGuaranteedAvailableMemory()
-
getBranchPlan
public Map<OptimizerNode,PlanNode> getBranchPlan()
-
getPredecessors
public abstract Iterable<PlanNode> getPredecessors()
Description copied from interface:DumpableNodeGets an iterator over the predecessors.- Specified by:
getPredecessorsin interfaceDumpableNode<PlanNode>- Returns:
- An iterator over the predecessors.
-
setBroadcastInputs
public void setBroadcastInputs(List<NamedChannel> broadcastInputs)
Sets a list of all broadcast inputs attached to this node.
-
getBroadcastInputs
public List<NamedChannel> getBroadcastInputs()
Gets a list of all broadcast inputs attached to this node.
-
addOutgoingChannel
public void addOutgoingChannel(Channel channel)
Adds a channel to a successor node to this node.- Parameters:
channel- The channel to the successor.
-
getOutgoingChannels
public List<Channel> getOutgoingChannels()
Gets a list of all outgoing channels leading to successors.- Returns:
- A list of all channels leading to successors.
-
updatePropertiesWithUniqueSets
public void updatePropertiesWithUniqueSets(Set<org.apache.flink.api.common.operators.util.FieldSet> uniqueFieldCombinations)
-
getCandidateAtBranchPoint
public PlanNode getCandidateAtBranchPoint(OptimizerNode branchPoint)
-
setPruningMarker
public void setPruningMarker()
Sets the pruning marker to true.
-
isPruneMarkerSet
public boolean isPruneMarkerSet()
Checks whether the pruning marker was set.- Returns:
- True, if the pruning marker was set, false otherwise.
-
isOnDynamicPath
public boolean isOnDynamicPath()
-
getCostWeight
public int getCostWeight()
-
hasDamOnPathDownTo
public abstract PlanNode.SourceAndDamReport hasDamOnPathDownTo(PlanNode source)
Checks whether this node has a dam on the way down to the given source node. This method returns either that (a) the source node is not found as a (transitive) child of this node, (b) the node is found, but no dam is on the path, or (c) the node is found and a dam is on the path.- Parameters:
source- The node on the path to which the dam is sought.- Returns:
- The result whether the node is found and whether a dam is on the path.
-
checkPartialSolutionPropertiesMet
public PlanNode.FeedbackPropertiesMeetRequirementsReport checkPartialSolutionPropertiesMet(PlanNode partialSolution, GlobalProperties feedbackGlobal, LocalProperties feedbackLocal)
-
getOptimizerNode
public OptimizerNode getOptimizerNode()
- Specified by:
getOptimizerNodein interfaceDumpableNode<PlanNode>
-
getPlanNode
public PlanNode getPlanNode()
- Specified by:
getPlanNodein interfaceDumpableNode<PlanNode>
-
getDumpableInputs
public Iterable<DumpableConnection<PlanNode>> getDumpableInputs()
- Specified by:
getDumpableInputsin interfaceDumpableNode<PlanNode>
-
-