org.apache.flink.optimizer.operators.OperatorDescriptorSingle Java Examples

The following examples show how to use org.apache.flink.optimizer.operators.OperatorDescriptorSingle. 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: SingleInputNode.java    From flink with Apache License 2.0 6 votes vote down vote up
protected void addLocalCandidates(Channel template, List<Set<? extends NamedChannel>> broadcastPlanChannels, RequestedGlobalProperties rgps,
		List<PlanNode> target, CostEstimator estimator)
{
	for (RequestedLocalProperties ilp : this.inConn.getInterestingProperties().getLocalProperties()) {
		final Channel in = template.clone();
		ilp.parameterizeChannel(in);
		
		// instantiate a candidate, if the instantiated local properties meet one possible local property set
		outer:
		for (OperatorDescriptorSingle dps: getPossibleProperties()) {
			for (RequestedLocalProperties ilps : dps.getPossibleLocalProperties()) {
				if (ilps.isMetBy(in.getLocalProperties())) {
					in.setRequiredLocalProps(ilps);
					instantiateCandidate(dps, in, broadcastPlanChannels, target, estimator, rgps, ilp);
					break outer;
				}
			}
		}
	}
}
 
Example #2
Source File: SingleInputNode.java    From flink with Apache License 2.0 6 votes vote down vote up
protected void addLocalCandidates(Channel template, List<Set<? extends NamedChannel>> broadcastPlanChannels, RequestedGlobalProperties rgps,
		List<PlanNode> target, CostEstimator estimator)
{
	for (RequestedLocalProperties ilp : this.inConn.getInterestingProperties().getLocalProperties()) {
		final Channel in = template.clone();
		ilp.parameterizeChannel(in);
		
		// instantiate a candidate, if the instantiated local properties meet one possible local property set
		outer:
		for (OperatorDescriptorSingle dps: getPossibleProperties()) {
			for (RequestedLocalProperties ilps : dps.getPossibleLocalProperties()) {
				if (ilps.isMetBy(in.getLocalProperties())) {
					in.setRequiredLocalProps(ilps);
					instantiateCandidate(dps, in, broadcastPlanChannels, target, estimator, rgps, ilp);
					break outer;
				}
			}
		}
	}
}
 
Example #3
Source File: SingleInputNode.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
protected void addLocalCandidates(Channel template, List<Set<? extends NamedChannel>> broadcastPlanChannels, RequestedGlobalProperties rgps,
		List<PlanNode> target, CostEstimator estimator)
{
	for (RequestedLocalProperties ilp : this.inConn.getInterestingProperties().getLocalProperties()) {
		final Channel in = template.clone();
		ilp.parameterizeChannel(in);
		
		// instantiate a candidate, if the instantiated local properties meet one possible local property set
		outer:
		for (OperatorDescriptorSingle dps: getPossibleProperties()) {
			for (RequestedLocalProperties ilps : dps.getPossibleLocalProperties()) {
				if (ilps.isMetBy(in.getLocalProperties())) {
					in.setRequiredLocalProps(ilps);
					instantiateCandidate(dps, in, broadcastPlanChannels, target, estimator, rgps, ilp);
					break outer;
				}
			}
		}
	}
}
 
Example #4
Source File: GroupCombineNode.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties() {

		// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
		Ordering groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}

		OperatorDescriptorSingle props = (this.keys == null ?
				new AllGroupCombineProperties() :
				new GroupCombineProperties(this.keys, groupOrder));

		return Collections.singletonList(props);
	}
 
Example #5
Source File: PartitionNode.java    From flink with Apache License 2.0 5 votes vote down vote up
public PartitionNode(PartitionOperatorBase<?> operator) {
	super(operator);
	
	OperatorDescriptorSingle descr = new PartitionDescriptor(
				this.getOperator().getPartitionMethod(), this.keys, operator.getOrdering(), operator.getCustomPartitioner(),
				operator.getDistribution());
	this.possibleProperties = Collections.singletonList(descr);
}
 
Example #6
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 #7
Source File: GroupCombineNode.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties() {

		// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
		Ordering groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}

		OperatorDescriptorSingle props = (this.keys == null ?
				new AllGroupCombineProperties() :
				new GroupCombineProperties(this.keys, groupOrder));

		return Collections.singletonList(props);
	}
 
Example #8
Source File: GroupReduceNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties(Partitioner<?> customPartitioner) {
	// see if an internal hint dictates the strategy to use
	final Configuration conf = getOperator().getParameters();
	final String localStrategy = conf.getString(Optimizer.HINT_LOCAL_STRATEGY, null);

	final boolean useCombiner;
	if (localStrategy != null) {
		if (Optimizer.HINT_LOCAL_STRATEGY_SORT.equals(localStrategy)) {
			useCombiner = false;
		}
		else if (Optimizer.HINT_LOCAL_STRATEGY_COMBINING_SORT.equals(localStrategy)) {
			if (!isCombineable()) {
				Optimizer.LOG.warn("Strategy hint for GroupReduce '" + getOperator().getName() +
					"' requires combinable reduce, but user function is not marked combinable.");
			}
			useCombiner = true;
		} else {
			throw new CompilerException("Invalid local strategy hint for match contract: " + localStrategy);
		}
	} else {
		useCombiner = isCombineable();
	}
	
	// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
	Ordering groupOrder = null;
	if (getOperator() != null) {
		groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}
	}
	
	OperatorDescriptorSingle props = useCombiner ?
		(this.keys == null ? new AllGroupWithPartialPreGroupProperties() : new GroupReduceWithCombineProperties(this.keys, groupOrder, customPartitioner)) :
		(this.keys == null ? new AllGroupReduceProperties() : new GroupReduceProperties(this.keys, groupOrder, customPartitioner));

	return Collections.singletonList(props);
}
 
Example #9
Source File: GroupReduceNode.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties(Partitioner<?> customPartitioner) {
	// see if an internal hint dictates the strategy to use
	final Configuration conf = getOperator().getParameters();
	final String localStrategy = conf.getString(Optimizer.HINT_LOCAL_STRATEGY, null);

	final boolean useCombiner;
	if (localStrategy != null) {
		if (Optimizer.HINT_LOCAL_STRATEGY_SORT.equals(localStrategy)) {
			useCombiner = false;
		}
		else if (Optimizer.HINT_LOCAL_STRATEGY_COMBINING_SORT.equals(localStrategy)) {
			if (!isCombineable()) {
				Optimizer.LOG.warn("Strategy hint for GroupReduce '" + getOperator().getName() +
					"' requires combinable reduce, but user function is not marked combinable.");
			}
			useCombiner = true;
		} else {
			throw new CompilerException("Invalid local strategy hint for match contract: " + localStrategy);
		}
	} else {
		useCombiner = isCombineable();
	}
	
	// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
	Ordering groupOrder = null;
	if (getOperator() != null) {
		groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}
	}
	
	OperatorDescriptorSingle props = useCombiner ?
		(this.keys == null ? new AllGroupWithPartialPreGroupProperties() : new GroupReduceWithCombineProperties(this.keys, groupOrder, customPartitioner)) :
		(this.keys == null ? new AllGroupReduceProperties() : new GroupReduceProperties(this.keys, groupOrder, customPartitioner));

	return Collections.singletonList(props);
}
 
Example #10
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 #11
Source File: PartitionNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public PartitionNode(PartitionOperatorBase<?> operator) {
	super(operator);
	
	OperatorDescriptorSingle descr = new PartitionDescriptor(
				this.getOperator().getPartitionMethod(), this.keys, operator.getOrdering(), operator.getCustomPartitioner(),
				operator.getDistribution());
	this.possibleProperties = Collections.singletonList(descr);
}
 
Example #12
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 #13
Source File: PartitionNode.java    From flink with Apache License 2.0 5 votes vote down vote up
public PartitionNode(PartitionOperatorBase<?> operator) {
	super(operator);
	
	OperatorDescriptorSingle descr = new PartitionDescriptor(
				this.getOperator().getPartitionMethod(), this.keys, operator.getOrdering(), operator.getCustomPartitioner(),
				operator.getDistribution());
	this.possibleProperties = Collections.singletonList(descr);
}
 
Example #14
Source File: GroupCombineNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties() {

		// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
		Ordering groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}

		OperatorDescriptorSingle props = (this.keys == null ?
				new AllGroupCombineProperties() :
				new GroupCombineProperties(this.keys, groupOrder));

		return Collections.singletonList(props);
	}
 
Example #15
Source File: GroupReduceNode.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<OperatorDescriptorSingle> initPossibleProperties(Partitioner<?> customPartitioner) {
	// see if an internal hint dictates the strategy to use
	final Configuration conf = getOperator().getParameters();
	final String localStrategy = conf.getString(Optimizer.HINT_LOCAL_STRATEGY, null);

	final boolean useCombiner;
	if (localStrategy != null) {
		if (Optimizer.HINT_LOCAL_STRATEGY_SORT.equals(localStrategy)) {
			useCombiner = false;
		}
		else if (Optimizer.HINT_LOCAL_STRATEGY_COMBINING_SORT.equals(localStrategy)) {
			if (!isCombineable()) {
				Optimizer.LOG.warn("Strategy hint for GroupReduce '" + getOperator().getName() +
					"' requires combinable reduce, but user function is not marked combinable.");
			}
			useCombiner = true;
		} else {
			throw new CompilerException("Invalid local strategy hint for match contract: " + localStrategy);
		}
	} else {
		useCombiner = isCombineable();
	}
	
	// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
	Ordering groupOrder = null;
	if (getOperator() != null) {
		groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}
	}
	
	OperatorDescriptorSingle props = useCombiner ?
		(this.keys == null ? new AllGroupWithPartialPreGroupProperties() : new GroupReduceWithCombineProperties(this.keys, groupOrder, customPartitioner)) :
		(this.keys == null ? new AllGroupReduceProperties() : new GroupReduceProperties(this.keys, groupOrder, customPartitioner));

	return Collections.singletonList(props);
}
 
Example #16
Source File: UnaryOperatorNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public UnaryOperatorNode(String name, FieldSet keys, List<OperatorDescriptorSingle> operators) {
	super(keys);
	
	this.operators = operators;
	this.name = name;
}
 
Example #17
Source File: UnaryOperatorNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.operators;
}
 
Example #18
Source File: SortPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public SortPartitionNode(SortPartitionOperatorBase<?> operator) {
	super(operator);
	
	OperatorDescriptorSingle descr = new SortPartitionDescriptor(operator.getPartitionOrdering());
	this.possibleProperties = Collections.singletonList(descr);
}
 
Example #19
Source File: FilterNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}
 
Example #20
Source File: SortPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}
 
Example #21
Source File: UnaryOperatorNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public UnaryOperatorNode(String name, FieldSet keys, List<OperatorDescriptorSingle> operators) {
	super(keys);
	
	this.operators = operators;
	this.name = name;
}
 
Example #22
Source File: FilterNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public FilterNode(FilterOperatorBase<?, ?> operator) {
	super(operator);
	this.possibleProperties = Collections.<OperatorDescriptorSingle>singletonList(new FilterDescriptor());
}
 
Example #23
Source File: ReduceNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}
 
Example #24
Source File: MapPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}
 
Example #25
Source File: MapPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new MapNode for the given contract.
 * 
 * @param operator The map partition contract object.
 */
public MapPartitionNode(SingleInputOperator<?, ?, ?> operator) {
	super(operator);
	
	this.possibleProperties = Collections.<OperatorDescriptorSingle>singletonList(new MapPartitionDescriptor());
}
 
Example #26
Source File: BulkIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return Collections.<OperatorDescriptorSingle>singletonList(new NoOpDescriptor());
}
 
Example #27
Source File: SortPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}
 
Example #28
Source File: SortPartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
public SortPartitionNode(SortPartitionOperatorBase<?> operator) {
	super(operator);
	
	OperatorDescriptorSingle descr = new SortPartitionDescriptor(operator.getPartitionOrdering());
	this.possibleProperties = Collections.singletonList(descr);
}
 
Example #29
Source File: UnaryOperatorNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.operators;
}
 
Example #30
Source File: PartitionNode.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<OperatorDescriptorSingle> getPossibleProperties() {
	return this.possibleProperties;
}