Java Code Examples for org.apache.flink.optimizer.dag.OptimizerNode.UnclosedBranchDescriptor#getBranchingNode()

The following examples show how to use org.apache.flink.optimizer.dag.OptimizerNode.UnclosedBranchDescriptor#getBranchingNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlanNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected void mergeBranchPlanMaps(Map<OptimizerNode, PlanNode> branchPlan1, Map<OptimizerNode, PlanNode> branchPlan2) {
	// merge the branchPlan maps according the template's uncloseBranchesStack
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			this.branchPlan = new HashMap<OptimizerNode, PlanNode>(8);
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			PlanNode selectedCandidate = null;

			if (branchPlan1 != null) {
				// predecessor 1 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan1.get(brancher);
			}
			
			if (selectedCandidate == null && branchPlan2 != null) {
				// predecessor 2 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan2.get(brancher);
			}
			
			// it may be that the branch candidate is only found once the broadcast variables are set
			if (selectedCandidate != null) {
				this.branchPlan.put(brancher, selectedCandidate);
			}
		}
	}
}
 
Example 2
Source File: PlanNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a list of all broadcast inputs attached to this node.
 */
public void setBroadcastInputs(List<NamedChannel> broadcastInputs) {
	if (broadcastInputs != null) {
		this.broadcastInputs = broadcastInputs;
		
		// update the branch map
		for (NamedChannel nc : broadcastInputs) {
			PlanNode source = nc.getSource();
			
			mergeBranchPlanMaps(branchPlan, source.branchPlan);
		}
	}
	
	// do a sanity check that if we are branching, we have now candidates for each branch point
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			if (this.branchPlan.get(brancher) == null) {
				throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
			}
		}
	}
}
 
Example 3
Source File: PlanNode.java    From flink with Apache License 2.0 5 votes vote down vote up
protected void mergeBranchPlanMaps(Map<OptimizerNode, PlanNode> branchPlan1, Map<OptimizerNode, PlanNode> branchPlan2) {
	// merge the branchPlan maps according the template's uncloseBranchesStack
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			this.branchPlan = new HashMap<OptimizerNode, PlanNode>(8);
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			PlanNode selectedCandidate = null;

			if (branchPlan1 != null) {
				// predecessor 1 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan1.get(brancher);
			}
			
			if (selectedCandidate == null && branchPlan2 != null) {
				// predecessor 2 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan2.get(brancher);
			}
			
			// it may be that the branch candidate is only found once the broadcast variables are set
			if (selectedCandidate != null) {
				this.branchPlan.put(brancher, selectedCandidate);
			}
		}
	}
}
 
Example 4
Source File: PlanNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a list of all broadcast inputs attached to this node.
 */
public void setBroadcastInputs(List<NamedChannel> broadcastInputs) {
	if (broadcastInputs != null) {
		this.broadcastInputs = broadcastInputs;
		
		// update the branch map
		for (NamedChannel nc : broadcastInputs) {
			PlanNode source = nc.getSource();
			
			mergeBranchPlanMaps(branchPlan, source.branchPlan);
		}
	}
	
	// do a sanity check that if we are branching, we have now candidates for each branch point
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			if (this.branchPlan.get(brancher) == null) {
				throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
			}
		}
	}
}
 
Example 5
Source File: PlanNode.java    From flink with Apache License 2.0 5 votes vote down vote up
protected void mergeBranchPlanMaps(Map<OptimizerNode, PlanNode> branchPlan1, Map<OptimizerNode, PlanNode> branchPlan2) {
	// merge the branchPlan maps according the template's uncloseBranchesStack
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			this.branchPlan = new HashMap<OptimizerNode, PlanNode>(8);
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			PlanNode selectedCandidate = null;

			if (branchPlan1 != null) {
				// predecessor 1 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan1.get(brancher);
			}
			
			if (selectedCandidate == null && branchPlan2 != null) {
				// predecessor 2 has branching children, see if it got the branch we are looking for
				selectedCandidate = branchPlan2.get(brancher);
			}
			
			// it may be that the branch candidate is only found once the broadcast variables are set
			if (selectedCandidate != null) {
				this.branchPlan.put(brancher, selectedCandidate);
			}
		}
	}
}
 
Example 6
Source File: PlanNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a list of all broadcast inputs attached to this node.
 */
public void setBroadcastInputs(List<NamedChannel> broadcastInputs) {
	if (broadcastInputs != null) {
		this.broadcastInputs = broadcastInputs;
		
		// update the branch map
		for (NamedChannel nc : broadcastInputs) {
			PlanNode source = nc.getSource();
			
			mergeBranchPlanMaps(branchPlan, source.branchPlan);
		}
	}
	
	// do a sanity check that if we are branching, we have now candidates for each branch point
	if (this.template.hasUnclosedBranches()) {
		if (this.branchPlan == null) {
			throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
		}

		for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
			OptimizerNode brancher = uc.getBranchingNode();
			if (this.branchPlan.get(brancher) == null) {
				throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
			}
		}
	}
}