Java Code Examples for org.apache.flink.optimizer.plan.PlanNode#getCandidateAtBranchPoint()

The following examples show how to use org.apache.flink.optimizer.plan.PlanNode#getCandidateAtBranchPoint() . 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: OptimizerNode.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether to candidate plans for the sub-plan of this node are comparable. The two
 * alternative plans are comparable, if
 * 
 * a) There is no branch in the sub-plan of this node
 * b) Both candidates have the same candidate as the child at the last open branch. 
 * 
 * @param plan1 The root node of the first candidate plan.
 * @param plan2 The root node of the second candidate plan.
 * @return True if the nodes are branch compatible in the inputs.
 */
protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
	if (plan1 == null || plan2 == null) {
		throw new NullPointerException();
	}
	
	// if there is no open branch, the children are always compatible.
	// in most plans, that will be the dominant case
	if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
		return true;
	}

	for (OptimizerNode joinedBrancher : hereJoinedBranches) {
		final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
		final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
		
		if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
			return false;
		}
	}
	return true;
}
 
Example 2
Source File: OptimizerNode.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether to candidate plans for the sub-plan of this node are comparable. The two
 * alternative plans are comparable, if
 * 
 * a) There is no branch in the sub-plan of this node
 * b) Both candidates have the same candidate as the child at the last open branch. 
 * 
 * @param plan1 The root node of the first candidate plan.
 * @param plan2 The root node of the second candidate plan.
 * @return True if the nodes are branch compatible in the inputs.
 */
protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
	if (plan1 == null || plan2 == null) {
		throw new NullPointerException();
	}
	
	// if there is no open branch, the children are always compatible.
	// in most plans, that will be the dominant case
	if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
		return true;
	}

	for (OptimizerNode joinedBrancher : hereJoinedBranches) {
		final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
		final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
		
		if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
			return false;
		}
	}
	return true;
}
 
Example 3
Source File: OptimizerNode.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether to candidate plans for the sub-plan of this node are comparable. The two
 * alternative plans are comparable, if
 * 
 * a) There is no branch in the sub-plan of this node
 * b) Both candidates have the same candidate as the child at the last open branch. 
 * 
 * @param plan1 The root node of the first candidate plan.
 * @param plan2 The root node of the second candidate plan.
 * @return True if the nodes are branch compatible in the inputs.
 */
protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
	if (plan1 == null || plan2 == null) {
		throw new NullPointerException();
	}
	
	// if there is no open branch, the children are always compatible.
	// in most plans, that will be the dominant case
	if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
		return true;
	}

	for (OptimizerNode joinedBrancher : hereJoinedBranches) {
		final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
		final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
		
		if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
			return false;
		}
	}
	return true;
}