org.apache.flink.optimizer.plan.IterationPlanNode Java Examples

The following examples show how to use org.apache.flink.optimizer.plan.IterationPlanNode. 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: RangePartitionRewriter.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void postVisit(PlanNode node) {

	if(node instanceof IterationPlanNode) {
		IterationPlanNode iNode = (IterationPlanNode)node;
		if(!visitedIterationNodes.contains(iNode)) {
			visitedIterationNodes.add(iNode);
			iNode.acceptForStepFunction(this);
		}
	}

	final Iterable<Channel> inputChannels = node.getInputs();
	for (Channel channel : inputChannels) {
		ShipStrategyType shipStrategy = channel.getShipStrategy();
		// Make sure we only optimize the DAG for range partition, and do not optimize multi times.
		if (shipStrategy == ShipStrategyType.PARTITION_RANGE) {

			if(channel.getDataDistribution() == null) {
				if (node.isOnDynamicPath()) {
					throw new InvalidProgramException("Range Partitioning not supported within iterations if users do not supply the data distribution.");
				}

				PlanNode channelSource = channel.getSource();
				List<Channel> newSourceOutputChannels = rewriteRangePartitionChannel(channel);
				channelSource.getOutgoingChannels().remove(channel);
				channelSource.getOutgoingChannels().addAll(newSourceOutputChannels);
			}
		}
	}
}
 
Example #2
Source File: PlanFinalizer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new plan finalizer.
 */
public PlanFinalizer() {
	this.allNodes = new HashSet<PlanNode>();
	this.sources = new ArrayList<SourcePlanNode>();
	this.sinks = new ArrayList<SinkPlanNode>();
	this.stackOfIterationNodes = new ArrayDeque<IterationPlanNode>();
}
 
Example #3
Source File: BinaryUnionReplacer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public boolean preVisit(PlanNode visitable) {
	if (this.seenBefore.add(visitable)) {
		if (visitable instanceof IterationPlanNode) {
			((IterationPlanNode) visitable).acceptForStepFunction(this);
		}
		return true;
	} else {
		return false;
	}
}
 
Example #4
Source File: RangePartitionRewriter.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void postVisit(PlanNode node) {

	if(node instanceof IterationPlanNode) {
		IterationPlanNode iNode = (IterationPlanNode)node;
		if(!visitedIterationNodes.contains(iNode)) {
			visitedIterationNodes.add(iNode);
			iNode.acceptForStepFunction(this);
		}
	}

	final Iterable<Channel> inputChannels = node.getInputs();
	for (Channel channel : inputChannels) {
		ShipStrategyType shipStrategy = channel.getShipStrategy();
		// Make sure we only optimize the DAG for range partition, and do not optimize multi times.
		if (shipStrategy == ShipStrategyType.PARTITION_RANGE) {

			if(channel.getDataDistribution() == null) {
				if (node.isOnDynamicPath()) {
					throw new InvalidProgramException("Range Partitioning not supported within iterations if users do not supply the data distribution.");
				}

				PlanNode channelSource = channel.getSource();
				List<Channel> newSourceOutputChannels = rewriteRangePartitionChannel(channel);
				channelSource.getOutgoingChannels().remove(channel);
				channelSource.getOutgoingChannels().addAll(newSourceOutputChannels);
			}
		}
	}
}
 
Example #5
Source File: PlanFinalizer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new plan finalizer.
 */
public PlanFinalizer() {
	this.allNodes = new HashSet<PlanNode>();
	this.sources = new ArrayList<SourcePlanNode>();
	this.sinks = new ArrayList<SinkPlanNode>();
	this.stackOfIterationNodes = new ArrayDeque<IterationPlanNode>();
}
 
Example #6
Source File: BinaryUnionReplacer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public boolean preVisit(PlanNode visitable) {
	if (this.seenBefore.add(visitable)) {
		if (visitable instanceof IterationPlanNode) {
			((IterationPlanNode) visitable).acceptForStepFunction(this);
		}
		return true;
	} else {
		return false;
	}
}
 
Example #7
Source File: RangePartitionRewriter.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void postVisit(PlanNode node) {

	if(node instanceof IterationPlanNode) {
		IterationPlanNode iNode = (IterationPlanNode)node;
		if(!visitedIterationNodes.contains(iNode)) {
			visitedIterationNodes.add(iNode);
			iNode.acceptForStepFunction(this);
		}
	}

	final Iterable<Channel> inputChannels = node.getInputs();
	for (Channel channel : inputChannels) {
		ShipStrategyType shipStrategy = channel.getShipStrategy();
		// Make sure we only optimize the DAG for range partition, and do not optimize multi times.
		if (shipStrategy == ShipStrategyType.PARTITION_RANGE) {

			if(channel.getDataDistribution() == null) {
				if (node.isOnDynamicPath()) {
					throw new InvalidProgramException("Range Partitioning not supported within iterations if users do not supply the data distribution.");
				}

				PlanNode channelSource = channel.getSource();
				List<Channel> newSourceOutputChannels = rewriteRangePartitionChannel(channel);
				channelSource.getOutgoingChannels().remove(channel);
				channelSource.getOutgoingChannels().addAll(newSourceOutputChannels);
			}
		}
	}
}
 
Example #8
Source File: PlanFinalizer.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new plan finalizer.
 */
public PlanFinalizer() {
	this.allNodes = new HashSet<PlanNode>();
	this.sources = new ArrayList<SourcePlanNode>();
	this.sinks = new ArrayList<SinkPlanNode>();
	this.stackOfIterationNodes = new ArrayDeque<IterationPlanNode>();
}
 
Example #9
Source File: BinaryUnionReplacer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public boolean preVisit(PlanNode visitable) {
	if (this.seenBefore.add(visitable)) {
		if (visitable instanceof IterationPlanNode) {
			((IterationPlanNode) visitable).acceptForStepFunction(this);
		}
		return true;
	} else {
		return false;
	}
}
 
Example #10
Source File: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public IterationDescriptor(IterationPlanNode iterationNode, int id) {
	this.iterationNode = iterationNode;
	this.id = id;
}
 
Example #11
Source File: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public IterationPlanNode getIterationNode() {
	return iterationNode;
}
 
Example #12
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
public IterationDescriptor(IterationPlanNode iterationNode, int id) {
	this.iterationNode = iterationNode;
	this.id = id;
}
 
Example #13
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
public IterationPlanNode getIterationNode() {
	return iterationNode;
}
 
Example #14
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
public IterationDescriptor(IterationPlanNode iterationNode, int id) {
	this.iterationNode = iterationNode;
	this.id = id;
}
 
Example #15
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
public IterationPlanNode getIterationNode() {
	return iterationNode;
}