org.apache.flink.optimizer.dataproperties.InterestingProperties Java Examples

The following examples show how to use org.apache.flink.optimizer.dataproperties.InterestingProperties. 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: DataSinkNode.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties iProps = new InterestingProperties();

	{
		final RequestedGlobalProperties partitioningProps = new RequestedGlobalProperties();
		iProps.addGlobalProperties(partitioningProps);
	}

	{
		final Ordering localOrder = getOperator().getLocalOrder();
		final RequestedLocalProperties orderProps = new RequestedLocalProperties();
		if (localOrder != null) {
			orderProps.setOrdering(localOrder);
		}
		iProps.addLocalProperties(orderProps);
	}
	
	this.input.setInterestingProperties(iProps);
}
 
Example #2
Source File: DataSinkNode.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties iProps = new InterestingProperties();

	{
		final RequestedGlobalProperties partitioningProps = new RequestedGlobalProperties();
		iProps.addGlobalProperties(partitioningProps);
	}

	{
		final Ordering localOrder = getOperator().getLocalOrder();
		final RequestedLocalProperties orderProps = new RequestedLocalProperties();
		if (localOrder != null) {
			orderProps.setOrdering(localOrder);
		}
		iProps.addLocalProperties(orderProps);
	}
	
	this.input.setInterestingProperties(iProps);
}
 
Example #3
Source File: DataSinkNode.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties iProps = new InterestingProperties();

	{
		final RequestedGlobalProperties partitioningProps = new RequestedGlobalProperties();
		iProps.addGlobalProperties(partitioningProps);
	}

	{
		final Ordering localOrder = getOperator().getLocalOrder();
		final RequestedLocalProperties orderProps = new RequestedLocalProperties();
		if (localOrder != null) {
			orderProps.setOrdering(localOrder);
		}
		iProps.addLocalProperties(orderProps);
	}
	
	this.input.setInterestingProperties(iProps);
}
 
Example #4
Source File: SingleInputNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props = getInterestingProperties().filterByCodeAnnotations(this, 0);
	
	// add all properties relevant to this node
	for (OperatorDescriptorSingle dps : getPossibleProperties()) {
		for (RequestedGlobalProperties gp : dps.getPossibleGlobalProperties()) {
			
			if (gp.getPartitioning().isPartitionedOnKey()) {
				// make sure that among the same partitioning types, we do not push anything down that has fewer key fields
				
				for (RequestedGlobalProperties contained : props.getGlobalProperties()) {
					if (contained.getPartitioning() == gp.getPartitioning() && gp.getPartitionedFields().isValidSubset(contained.getPartitionedFields())) {
						props.getGlobalProperties().remove(contained);
						break;
					}
				}
			}
			
			props.addGlobalProperties(gp);
		}
		
		for (RequestedLocalProperties lp : dps.getPossibleLocalProperties()) {
			props.addLocalProperties(lp);
		}
	}
	this.inConn.setInterestingProperties(props);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #5
Source File: DagConnection.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the interesting properties for this pact connection.
 * 
 * @param props The interesting properties.
 */
public void setInterestingProperties(InterestingProperties props) {
	if (this.interestingProps == null) {
		this.interestingProps = props;
	} else {
		throw new IllegalStateException("Interesting Properties have already been set.");
	}
}
 
Example #6
Source File: TwoInputNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props1 = getInterestingProperties().filterByCodeAnnotations(this, 0);
	final InterestingProperties props2 = getInterestingProperties().filterByCodeAnnotations(this, 1);
	
	// add all properties relevant to this node
	for (OperatorDescriptorDual dpd : getProperties()) {
		for (GlobalPropertiesPair gp : dpd.getPossibleGlobalProperties()) {
			// input 1
			props1.addGlobalProperties(gp.getProperties1());
			
			// input 2
			props2.addGlobalProperties(gp.getProperties2());
		}
		for (LocalPropertiesPair lp : dpd.getPossibleLocalProperties()) {
			// input 1
			props1.addLocalProperties(lp.getProperties1());
			
			// input 2
			props2.addLocalProperties(lp.getProperties2());
		}
	}
	this.input1.setInterestingProperties(props1);
	this.input2.setInterestingProperties(props2);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #7
Source File: OptimizerNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Computes all the interesting properties that are relevant to this node. The interesting
 * properties are a union of the interesting properties on each outgoing connection.
 * However, if two interesting properties on the outgoing connections overlap,
 * the interesting properties will occur only once in this set. For that, this
 * method deduplicates and merges the interesting properties.
 * This method returns copies of the original interesting properties objects and
 * leaves the original objects, contained by the connections, unchanged.
 */
public void computeUnionOfInterestingPropertiesFromSuccessors() {
	List<DagConnection> conns = getOutgoingConnections();
	if (conns.size() == 0) {
		// no incoming, we have none ourselves
		this.intProps = new InterestingProperties();
	} else {
		this.intProps = conns.get(0).getInterestingProperties().clone();
		for (int i = 1; i < conns.size(); i++) {
			this.intProps.addInterestingProperties(conns.get(i).getInterestingProperties());
		}
	}
	this.intProps.dropTrivials();
}
 
Example #8
Source File: TwoInputNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props1 = getInterestingProperties().filterByCodeAnnotations(this, 0);
	final InterestingProperties props2 = getInterestingProperties().filterByCodeAnnotations(this, 1);
	
	// add all properties relevant to this node
	for (OperatorDescriptorDual dpd : getProperties()) {
		for (GlobalPropertiesPair gp : dpd.getPossibleGlobalProperties()) {
			// input 1
			props1.addGlobalProperties(gp.getProperties1());
			
			// input 2
			props2.addGlobalProperties(gp.getProperties2());
		}
		for (LocalPropertiesPair lp : dpd.getPossibleLocalProperties()) {
			// input 1
			props1.addLocalProperties(lp.getProperties1());
			
			// input 2
			props2.addLocalProperties(lp.getProperties2());
		}
	}
	this.input1.setInterestingProperties(props1);
	this.input2.setInterestingProperties(props2);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #9
Source File: OptimizerNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Computes all the interesting properties that are relevant to this node. The interesting
 * properties are a union of the interesting properties on each outgoing connection.
 * However, if two interesting properties on the outgoing connections overlap,
 * the interesting properties will occur only once in this set. For that, this
 * method deduplicates and merges the interesting properties.
 * This method returns copies of the original interesting properties objects and
 * leaves the original objects, contained by the connections, unchanged.
 */
public void computeUnionOfInterestingPropertiesFromSuccessors() {
	List<DagConnection> conns = getOutgoingConnections();
	if (conns.size() == 0) {
		// no incoming, we have none ourselves
		this.intProps = new InterestingProperties();
	} else {
		this.intProps = conns.get(0).getInterestingProperties().clone();
		for (int i = 1; i < conns.size(); i++) {
			this.intProps.addInterestingProperties(conns.get(i).getInterestingProperties());
		}
	}
	this.intProps.dropTrivials();
}
 
Example #10
Source File: DagConnection.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the interesting properties for this pact connection.
 * 
 * @param props The interesting properties.
 */
public void setInterestingProperties(InterestingProperties props) {
	if (this.interestingProps == null) {
		this.interestingProps = props;
	} else {
		throw new IllegalStateException("Interesting Properties have already been set.");
	}
}
 
Example #11
Source File: BinaryUnionNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) { 
	final InterestingProperties props = getInterestingProperties();
	
	// if no other properties exist, add the pruned trivials back
	if (props.getGlobalProperties().isEmpty()) {
		props.addGlobalProperties(new RequestedGlobalProperties());
	}
	props.addLocalProperties(new RequestedLocalProperties());
	this.input1.setInterestingProperties(props.clone());
	this.input2.setInterestingProperties(props.clone());
	
	this.channelProps = props.getGlobalProperties();
}
 
Example #12
Source File: SingleInputNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props = getInterestingProperties().filterByCodeAnnotations(this, 0);
	
	// add all properties relevant to this node
	for (OperatorDescriptorSingle dps : getPossibleProperties()) {
		for (RequestedGlobalProperties gp : dps.getPossibleGlobalProperties()) {
			
			if (gp.getPartitioning().isPartitionedOnKey()) {
				// make sure that among the same partitioning types, we do not push anything down that has fewer key fields
				
				for (RequestedGlobalProperties contained : props.getGlobalProperties()) {
					if (contained.getPartitioning() == gp.getPartitioning() && gp.getPartitionedFields().isValidSubset(contained.getPartitionedFields())) {
						props.getGlobalProperties().remove(contained);
						break;
					}
				}
			}
			
			props.addGlobalProperties(gp);
		}
		
		for (RequestedLocalProperties lp : dps.getPossibleLocalProperties()) {
			props.addLocalProperties(lp);
		}
	}
	this.inConn.setInterestingProperties(props);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #13
Source File: BinaryUnionNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) { 
	final InterestingProperties props = getInterestingProperties();
	
	// if no other properties exist, add the pruned trivials back
	if (props.getGlobalProperties().isEmpty()) {
		props.addGlobalProperties(new RequestedGlobalProperties());
	}
	props.addLocalProperties(new RequestedLocalProperties());
	this.input1.setInterestingProperties(props.clone());
	this.input2.setInterestingProperties(props.clone());
	
	this.channelProps = props.getGlobalProperties();
}
 
Example #14
Source File: SingleInputNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props = getInterestingProperties().filterByCodeAnnotations(this, 0);
	
	// add all properties relevant to this node
	for (OperatorDescriptorSingle dps : getPossibleProperties()) {
		for (RequestedGlobalProperties gp : dps.getPossibleGlobalProperties()) {
			
			if (gp.getPartitioning().isPartitionedOnKey()) {
				// make sure that among the same partitioning types, we do not push anything down that has fewer key fields
				
				for (RequestedGlobalProperties contained : props.getGlobalProperties()) {
					if (contained.getPartitioning() == gp.getPartitioning() && gp.getPartitionedFields().isValidSubset(contained.getPartitionedFields())) {
						props.getGlobalProperties().remove(contained);
						break;
					}
				}
			}
			
			props.addGlobalProperties(gp);
		}
		
		for (RequestedLocalProperties lp : dps.getPossibleLocalProperties()) {
			props.addLocalProperties(lp);
		}
	}
	this.inConn.setInterestingProperties(props);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #15
Source File: BinaryUnionNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) { 
	final InterestingProperties props = getInterestingProperties();
	
	// if no other properties exist, add the pruned trivials back
	if (props.getGlobalProperties().isEmpty()) {
		props.addGlobalProperties(new RequestedGlobalProperties());
	}
	props.addLocalProperties(new RequestedLocalProperties());
	this.input1.setInterestingProperties(props.clone());
	this.input2.setInterestingProperties(props.clone());
	
	this.channelProps = props.getGlobalProperties();
}
 
Example #16
Source File: DagConnection.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the interesting properties for this pact connection.
 * 
 * @param props The interesting properties.
 */
public void setInterestingProperties(InterestingProperties props) {
	if (this.interestingProps == null) {
		this.interestingProps = props;
	} else {
		throw new IllegalStateException("Interesting Properties have already been set.");
	}
}
 
Example #17
Source File: TwoInputNode.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// get what we inherit and what is preserved by our user code 
	final InterestingProperties props1 = getInterestingProperties().filterByCodeAnnotations(this, 0);
	final InterestingProperties props2 = getInterestingProperties().filterByCodeAnnotations(this, 1);
	
	// add all properties relevant to this node
	for (OperatorDescriptorDual dpd : getProperties()) {
		for (GlobalPropertiesPair gp : dpd.getPossibleGlobalProperties()) {
			// input 1
			props1.addGlobalProperties(gp.getProperties1());
			
			// input 2
			props2.addGlobalProperties(gp.getProperties2());
		}
		for (LocalPropertiesPair lp : dpd.getPossibleLocalProperties()) {
			// input 1
			props1.addLocalProperties(lp.getProperties1());
			
			// input 2
			props2.addLocalProperties(lp.getProperties2());
		}
	}
	this.input1.setInterestingProperties(props1);
	this.input2.setInterestingProperties(props2);
	
	for (DagConnection conn : getBroadcastConnections()) {
		conn.setInterestingProperties(new InterestingProperties());
	}
}
 
Example #18
Source File: OptimizerNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Computes all the interesting properties that are relevant to this node. The interesting
 * properties are a union of the interesting properties on each outgoing connection.
 * However, if two interesting properties on the outgoing connections overlap,
 * the interesting properties will occur only once in this set. For that, this
 * method deduplicates and merges the interesting properties.
 * This method returns copies of the original interesting properties objects and
 * leaves the original objects, contained by the connections, unchanged.
 */
public void computeUnionOfInterestingPropertiesFromSuccessors() {
	List<DagConnection> conns = getOutgoingConnections();
	if (conns.size() == 0) {
		// no incoming, we have none ourselves
		this.intProps = new InterestingProperties();
	} else {
		this.intProps = conns.get(0).getInterestingProperties().clone();
		for (int i = 1; i < conns.size(); i++) {
			this.intProps.addInterestingProperties(conns.get(i).getInterestingProperties());
		}
	}
	this.intProps.dropTrivials();
}
 
Example #19
Source File: BulkIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties intProps = getInterestingProperties().clone();
	
	if (this.terminationCriterion != null) {
		// first propagate through termination Criterion. since it has no successors, it has no
		// interesting properties
		this.terminationCriterionRootConnection.setInterestingProperties(new InterestingProperties());
		this.terminationCriterion.accept(new InterestingPropertyVisitor(estimator));
	}
	
	// we need to make 2 interesting property passes, because the root of the step function needs also
	// the interesting properties as generated by the partial solution
	
	// give our own interesting properties (as generated by the iterations successors) to the step function and
	// make the first pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties partialSolutionIntProps = this.partialSolution.getInterestingProperties();
	intProps.getGlobalProperties().addAll(partialSolutionIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(partialSolutionIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	// this clears only the path down from the next partial solution. The paths down
	// from the termination criterion (before they meet the paths down from the next partial solution)
	// remain unaffected by this step
	this.rootConnection.clearInterestingProperties();
	this.nextPartialSolution.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// now add the interesting properties of the partial solution to the input
	final InterestingProperties inProps = this.partialSolution.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.inConn.setInterestingProperties(inProps);
}
 
Example #20
Source File: DataSinkNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
	// check if we have a cached version
	if (this.cachedPlans != null) {
		return this.cachedPlans;
	}
	
	// calculate alternative sub-plans for predecessor
	List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
	List<PlanNode> outputPlans = new ArrayList<PlanNode>();
	
	final int parallelism = getParallelism();
	final int inDop = getPredecessorNode().getParallelism();

	final ExecutionMode executionMode = this.input.getDataExchangeMode();
	final boolean dopChange = parallelism != inDop;
	final boolean breakPipeline = this.input.isBreakingPipeline();

	InterestingProperties ips = this.input.getInterestingProperties();
	for (PlanNode p : subPlans) {
		for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
			for (RequestedLocalProperties lp : ips.getLocalProperties()) {
				Channel c = new Channel(p);
				gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
				lp.parameterizeChannel(c);
				c.setRequiredLocalProps(lp);
				c.setRequiredGlobalProps(gp);
				
				// no need to check whether the created properties meet what we need in case
				// of ordering or global ordering, because the only interesting properties we have
				// are what we require
				outputPlans.add(new SinkPlanNode(this, "DataSink ("+this.getOperator().getName()+")" ,c));
			}
		}
	}
	
	// cost and prune the plans
	for (PlanNode node : outputPlans) {
		estimator.costOperator(node);
	}
	prunePlanAlternatives(outputPlans);

	this.cachedPlans = outputPlans;
	return outputPlans;
}
 
Example #21
Source File: WorksetIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// our own solution (the solution set) is always partitioned and this cannot be adjusted
	// depending on what the successor to the workset iteration requests. for that reason,
	// we ignore incoming interesting properties.
	
	// in addition, we need to make 2 interesting property passes, because the root of the step function 
	// that computes the next workset needs the interesting properties as generated by the
	// workset source of the step function. the second pass concerns only the workset path.
	// as initial interesting properties, we have the trivial ones for the step function,
	// and partitioned on the solution set key for the solution set delta 
	
	RequestedGlobalProperties partitionedProperties = new RequestedGlobalProperties();
	partitionedProperties.setHashPartitioned(this.solutionSetKeyFields);
	InterestingProperties partitionedIP = new InterestingProperties();
	partitionedIP.addGlobalProperties(partitionedProperties);
	partitionedIP.addLocalProperties(new RequestedLocalProperties());
	
	this.nextWorksetRootConnection.setInterestingProperties(new InterestingProperties());
	this.solutionSetDeltaRootConnection.setInterestingProperties(partitionedIP.clone());
	
	InterestingPropertyVisitor ipv = new InterestingPropertyVisitor(estimator);
	this.nextWorkset.accept(ipv);
	this.solutionSetDelta.accept(ipv);
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties worksetIntProps = this.worksetNode.getInterestingProperties();
	InterestingProperties intProps = new InterestingProperties();
	intProps.getGlobalProperties().addAll(worksetIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(worksetIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	this.nextWorksetRootConnection.clearInterestingProperties();
	this.nextWorkset.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.nextWorksetRootConnection.setInterestingProperties(intProps);
	this.nextWorkset.accept(ipv);
	
	// now add the interesting properties of the workset to the workset input
	final InterestingProperties inProps = this.worksetNode.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.input2.setInterestingProperties(inProps);
	
	// the partial solution must be hash partitioned, so it has only that as interesting properties
	this.input1.setInterestingProperties(partitionedIP);
}
 
Example #22
Source File: BulkIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties intProps = getInterestingProperties().clone();
	
	if (this.terminationCriterion != null) {
		// first propagate through termination Criterion. since it has no successors, it has no
		// interesting properties
		this.terminationCriterionRootConnection.setInterestingProperties(new InterestingProperties());
		this.terminationCriterion.accept(new InterestingPropertyVisitor(estimator));
	}
	
	// we need to make 2 interesting property passes, because the root of the step function needs also
	// the interesting properties as generated by the partial solution
	
	// give our own interesting properties (as generated by the iterations successors) to the step function and
	// make the first pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties partialSolutionIntProps = this.partialSolution.getInterestingProperties();
	intProps.getGlobalProperties().addAll(partialSolutionIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(partialSolutionIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	// this clears only the path down from the next partial solution. The paths down
	// from the termination criterion (before they meet the paths down from the next partial solution)
	// remain unaffected by this step
	this.rootConnection.clearInterestingProperties();
	this.nextPartialSolution.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// now add the interesting properties of the partial solution to the input
	final InterestingProperties inProps = this.partialSolution.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.inConn.setInterestingProperties(inProps);
}
 
Example #23
Source File: WorksetIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// our own solution (the solution set) is always partitioned and this cannot be adjusted
	// depending on what the successor to the workset iteration requests. for that reason,
	// we ignore incoming interesting properties.
	
	// in addition, we need to make 2 interesting property passes, because the root of the step function 
	// that computes the next workset needs the interesting properties as generated by the
	// workset source of the step function. the second pass concerns only the workset path.
	// as initial interesting properties, we have the trivial ones for the step function,
	// and partitioned on the solution set key for the solution set delta 
	
	RequestedGlobalProperties partitionedProperties = new RequestedGlobalProperties();
	partitionedProperties.setHashPartitioned(this.solutionSetKeyFields);
	InterestingProperties partitionedIP = new InterestingProperties();
	partitionedIP.addGlobalProperties(partitionedProperties);
	partitionedIP.addLocalProperties(new RequestedLocalProperties());
	
	this.nextWorksetRootConnection.setInterestingProperties(new InterestingProperties());
	this.solutionSetDeltaRootConnection.setInterestingProperties(partitionedIP.clone());
	
	InterestingPropertyVisitor ipv = new InterestingPropertyVisitor(estimator);
	this.nextWorkset.accept(ipv);
	this.solutionSetDelta.accept(ipv);
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties worksetIntProps = this.worksetNode.getInterestingProperties();
	InterestingProperties intProps = new InterestingProperties();
	intProps.getGlobalProperties().addAll(worksetIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(worksetIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	this.nextWorksetRootConnection.clearInterestingProperties();
	this.nextWorkset.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.nextWorksetRootConnection.setInterestingProperties(intProps);
	this.nextWorkset.accept(ipv);
	
	// now add the interesting properties of the workset to the workset input
	final InterestingProperties inProps = this.worksetNode.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.input2.setInterestingProperties(inProps);
	
	// the partial solution must be hash partitioned, so it has only that as interesting properties
	this.input1.setInterestingProperties(partitionedIP);
}
 
Example #24
Source File: DataSinkNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
	// check if we have a cached version
	if (this.cachedPlans != null) {
		return this.cachedPlans;
	}
	
	// calculate alternative sub-plans for predecessor
	List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
	List<PlanNode> outputPlans = new ArrayList<PlanNode>();
	
	final int parallelism = getParallelism();
	final int inDop = getPredecessorNode().getParallelism();

	final ExecutionMode executionMode = this.input.getDataExchangeMode();
	final boolean dopChange = parallelism != inDop;
	final boolean breakPipeline = this.input.isBreakingPipeline();

	InterestingProperties ips = this.input.getInterestingProperties();
	for (PlanNode p : subPlans) {
		for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
			for (RequestedLocalProperties lp : ips.getLocalProperties()) {
				Channel c = new Channel(p);
				gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
				lp.parameterizeChannel(c);
				c.setRequiredLocalProps(lp);
				c.setRequiredGlobalProps(gp);
				
				// no need to check whether the created properties meet what we need in case
				// of ordering or global ordering, because the only interesting properties we have
				// are what we require
				outputPlans.add(new SinkPlanNode(this, "DataSink ("+this.getOperator().getName()+")" ,c));
			}
		}
	}
	
	// cost and prune the plans
	for (PlanNode node : outputPlans) {
		estimator.costOperator(node);
	}
	prunePlanAlternatives(outputPlans);

	this.cachedPlans = outputPlans;
	return outputPlans;
}
 
Example #25
Source File: BulkIterationNode.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	final InterestingProperties intProps = getInterestingProperties().clone();
	
	if (this.terminationCriterion != null) {
		// first propagate through termination Criterion. since it has no successors, it has no
		// interesting properties
		this.terminationCriterionRootConnection.setInterestingProperties(new InterestingProperties());
		this.terminationCriterion.accept(new InterestingPropertyVisitor(estimator));
	}
	
	// we need to make 2 interesting property passes, because the root of the step function needs also
	// the interesting properties as generated by the partial solution
	
	// give our own interesting properties (as generated by the iterations successors) to the step function and
	// make the first pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties partialSolutionIntProps = this.partialSolution.getInterestingProperties();
	intProps.getGlobalProperties().addAll(partialSolutionIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(partialSolutionIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	// this clears only the path down from the next partial solution. The paths down
	// from the termination criterion (before they meet the paths down from the next partial solution)
	// remain unaffected by this step
	this.rootConnection.clearInterestingProperties();
	this.nextPartialSolution.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.rootConnection.setInterestingProperties(intProps);
	this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
	
	// now add the interesting properties of the partial solution to the input
	final InterestingProperties inProps = this.partialSolution.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.inConn.setInterestingProperties(inProps);
}
 
Example #26
Source File: WorksetIterationNode.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
	// our own solution (the solution set) is always partitioned and this cannot be adjusted
	// depending on what the successor to the workset iteration requests. for that reason,
	// we ignore incoming interesting properties.
	
	// in addition, we need to make 2 interesting property passes, because the root of the step function 
	// that computes the next workset needs the interesting properties as generated by the
	// workset source of the step function. the second pass concerns only the workset path.
	// as initial interesting properties, we have the trivial ones for the step function,
	// and partitioned on the solution set key for the solution set delta 
	
	RequestedGlobalProperties partitionedProperties = new RequestedGlobalProperties();
	partitionedProperties.setHashPartitioned(this.solutionSetKeyFields);
	InterestingProperties partitionedIP = new InterestingProperties();
	partitionedIP.addGlobalProperties(partitionedProperties);
	partitionedIP.addLocalProperties(new RequestedLocalProperties());
	
	this.nextWorksetRootConnection.setInterestingProperties(new InterestingProperties());
	this.solutionSetDeltaRootConnection.setInterestingProperties(partitionedIP.clone());
	
	InterestingPropertyVisitor ipv = new InterestingPropertyVisitor(estimator);
	this.nextWorkset.accept(ipv);
	this.solutionSetDelta.accept(ipv);
	
	// take the interesting properties of the partial solution and add them to the root interesting properties
	InterestingProperties worksetIntProps = this.worksetNode.getInterestingProperties();
	InterestingProperties intProps = new InterestingProperties();
	intProps.getGlobalProperties().addAll(worksetIntProps.getGlobalProperties());
	intProps.getLocalProperties().addAll(worksetIntProps.getLocalProperties());
	
	// clear all interesting properties to prepare the second traversal
	this.nextWorksetRootConnection.clearInterestingProperties();
	this.nextWorkset.accept(InterestingPropertiesClearer.INSTANCE);
	
	// 2nd pass
	this.nextWorksetRootConnection.setInterestingProperties(intProps);
	this.nextWorkset.accept(ipv);
	
	// now add the interesting properties of the workset to the workset input
	final InterestingProperties inProps = this.worksetNode.getInterestingProperties().clone();
	inProps.addGlobalProperties(new RequestedGlobalProperties());
	inProps.addLocalProperties(new RequestedLocalProperties());
	this.input2.setInterestingProperties(inProps);
	
	// the partial solution must be hash partitioned, so it has only that as interesting properties
	this.input1.setInterestingProperties(partitionedIP);
}
 
Example #27
Source File: DataSinkNode.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
	// check if we have a cached version
	if (this.cachedPlans != null) {
		return this.cachedPlans;
	}
	
	// calculate alternative sub-plans for predecessor
	List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
	List<PlanNode> outputPlans = new ArrayList<PlanNode>();
	
	final int parallelism = getParallelism();
	final int inDop = getPredecessorNode().getParallelism();

	final ExecutionMode executionMode = this.input.getDataExchangeMode();
	final boolean dopChange = parallelism != inDop;
	final boolean breakPipeline = this.input.isBreakingPipeline();

	InterestingProperties ips = this.input.getInterestingProperties();
	for (PlanNode p : subPlans) {
		for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
			for (RequestedLocalProperties lp : ips.getLocalProperties()) {
				Channel c = new Channel(p);
				gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
				lp.parameterizeChannel(c);
				c.setRequiredLocalProps(lp);
				c.setRequiredGlobalProps(gp);
				
				// no need to check whether the created properties meet what we need in case
				// of ordering or global ordering, because the only interesting properties we have
				// are what we require
				outputPlans.add(new SinkPlanNode(this, "DataSink ("+this.getOperator().getName()+")" ,c));
			}
		}
	}
	
	// cost and prune the plans
	for (PlanNode node : outputPlans) {
		estimator.costOperator(node);
	}
	prunePlanAlternatives(outputPlans);

	this.cachedPlans = outputPlans;
	return outputPlans;
}
 
Example #28
Source File: OptimizerNode.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the properties that are interesting for this node to produce.
 * 
 * @return The interesting properties for this node, or null, if not yet computed.
 */
public InterestingProperties getInterestingProperties() {
	return this.intProps;
}
 
Example #29
Source File: DagConnection.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the interesting properties object for this pact connection.
 * If the interesting properties for this connections have not yet been set,
 * this method returns null.
 * 
 * @return The collection of all interesting properties, or null, if they have not yet been set.
 */
public InterestingProperties getInterestingProperties() {
	return this.interestingProps;
}
 
Example #30
Source File: DagConnection.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the interesting properties object for this pact connection.
 * If the interesting properties for this connections have not yet been set,
 * this method returns null.
 * 
 * @return The collection of all interesting properties, or null, if they have not yet been set.
 */
public InterestingProperties getInterestingProperties() {
	return this.interestingProps;
}