当前位置: 首页>>代码示例>>Java>>正文


Java Ordering.getNumberOfFields方法代码示例

本文整理汇总了Java中org.apache.flink.api.common.operators.Ordering.getNumberOfFields方法的典型用法代码示例。如果您正苦于以下问题:Java Ordering.getNumberOfFields方法的具体用法?Java Ordering.getNumberOfFields怎么用?Java Ordering.getNumberOfFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.common.operators.Ordering的用法示例。


在下文中一共展示了Ordering.getNumberOfFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GroupReduceWithCombineProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public GroupReduceWithCombineProperties(FieldSet groupKeys, Ordering additionalOrderKeys, Partitioner<?> customPartitioner) {
	super(groupKeys);
	
	// if we have an additional ordering, construct the ordering to have primarily the grouping fields
	if (additionalOrderKeys != null) {
		this.ordering = new Ordering();
		for (Integer key : this.keyList) {
			this.ordering.appendOrdering(key, null, Order.ANY);
		}
	
		// and next the additional order fields
		for (int i = 0; i < additionalOrderKeys.getNumberOfFields(); i++) {
			Integer field = additionalOrderKeys.getFieldNumber(i);
			Order order = additionalOrderKeys.getOrder(i);
			this.ordering.appendOrdering(field, additionalOrderKeys.getType(i), order);
		}
	} else {
		this.ordering = null;
	}
	
	this.customPartitioner = customPartitioner;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:GroupReduceWithCombineProperties.java

示例2: GroupReduceProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public GroupReduceProperties(FieldSet groupKeys, Ordering additionalOrderKeys, Partitioner<?> customPartitioner) {
	super(groupKeys);
	
	// if we have an additional ordering, construct the ordering to have primarily the grouping fields
	if (additionalOrderKeys != null) {
		this.ordering = new Ordering();
		for (Integer key : this.keyList) {
			this.ordering.appendOrdering(key, null, Order.ANY);
		}
	
		// and next the additional order fields
		for (int i = 0; i < additionalOrderKeys.getNumberOfFields(); i++) {
			Integer field = additionalOrderKeys.getFieldNumber(i);
			Order order = additionalOrderKeys.getOrder(i);
			this.ordering.appendOrdering(field, additionalOrderKeys.getType(i), order);
		}
	}
	else {
		this.ordering = null;
	}
	
	this.customPartitioner = customPartitioner;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:GroupReduceProperties.java

示例3: GroupCombineProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public GroupCombineProperties(FieldSet groupKeys, Ordering additionalOrderKeys) {
	super(groupKeys);

	// if we have an additional ordering, construct the ordering to have primarily the grouping fields
	
	this.ordering = new Ordering();
	for (Integer key : this.keyList) {
		this.ordering.appendOrdering(key, null, Order.ANY);
	}

	// and next the additional order fields
	if (additionalOrderKeys != null) {
		for (int i = 0; i < additionalOrderKeys.getNumberOfFields(); i++) {
			Integer field = additionalOrderKeys.getFieldNumber(i);
			Order order = additionalOrderKeys.getOrder(i);
			this.ordering.appendOrdering(field, additionalOrderKeys.getType(i), order);
		}
	}

}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:GroupCombineProperties.java

示例4: areCoFulfilled

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
@Override
public boolean areCoFulfilled(RequestedLocalProperties requested1, RequestedLocalProperties requested2,
		LocalProperties produced1, LocalProperties produced2) {
	int numRelevantFields = this.keys1.size();

	Ordering prod1 = produced1.getOrdering();
	Ordering prod2 = produced2.getOrdering();

	if (prod1 == null || prod2 == null || prod1.getNumberOfFields() < numRelevantFields
			|| prod2.getNumberOfFields() < numRelevantFields) {
		throw new CompilerException("The given properties do not meet this operators requirements.");
	}

	for (int i = 0; i < numRelevantFields; i++) {
		if (prod1.getOrder(i) != prod2.getOrder(i)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:CoGroupRawDescriptor.java

示例5: initializeDataProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
private List<OperatorDescriptorDual> initializeDataProperties() {
	Ordering groupOrder1 = null;
	Ordering groupOrder2 = null;

	CoGroupRawOperatorBase<?, ?, ?, ?> cgc = getOperator();
	groupOrder1 = cgc.getGroupOrderForInputOne();
	groupOrder2 = cgc.getGroupOrderForInputTwo();

	if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) {
		groupOrder1 = null;
	}
	if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) {
		groupOrder2 = null;
	}

	return Collections.<OperatorDescriptorDual>singletonList(new CoGroupRawDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:CoGroupRawNode.java

示例6: initializeDataProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
private List<OperatorDescriptorDual> initializeDataProperties(Partitioner<?> customPartitioner) {
	Ordering groupOrder1 = null;
	Ordering groupOrder2 = null;
	
	CoGroupOperatorBase<?, ?, ?, ?> cgc = getOperator();
	groupOrder1 = cgc.getGroupOrderForInputOne();
	groupOrder2 = cgc.getGroupOrderForInputTwo();
		
	if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) {
		groupOrder1 = null;
	}
	if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) {
		groupOrder2 = null;
	}
	
	CoGroupDescriptor descr = new CoGroupDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2);
	if (customPartitioner != null) {
		descr.setCustomPartitioner(customPartitioner);
	}
	
	return Collections.<OperatorDescriptorDual>singletonList(descr);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupNode.java

示例7: GroupReduceWithCombineProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public GroupReduceWithCombineProperties(FieldSet groupKeys, Ordering additionalOrderKeys) {
	super(groupKeys);
	
	// if we have an additional ordering, construct the ordering to have primarily the grouping fields
	if (additionalOrderKeys != null) {
		this.ordering = new Ordering();
		for (Integer key : this.keyList) {
			this.ordering.appendOrdering(key, null, Order.ANY);
		}
	
		// and next the additional order fields
		for (int i = 0; i < additionalOrderKeys.getNumberOfFields(); i++) {
			Integer field = additionalOrderKeys.getFieldNumber(i);
			Order order = additionalOrderKeys.getOrder(i);
			this.ordering.appendOrdering(field, additionalOrderKeys.getType(i), order);
		}
	} else {
		this.ordering = null;
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:21,代码来源:GroupReduceWithCombineProperties.java

示例8: GroupReduceProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public GroupReduceProperties(FieldSet groupKeys, Ordering additionalOrderKeys) {
	super(groupKeys);
	
	// if we have an additional ordering, construct the ordering to have primarily the grouping fields
	if (additionalOrderKeys != null) {
		this.ordering = new Ordering();
		for (Integer key : this.keyList) {
			this.ordering.appendOrdering(key, null, Order.ANY);
		}
	
		// and next the additional order fields
		for (int i = 0; i < additionalOrderKeys.getNumberOfFields(); i++) {
			Integer field = additionalOrderKeys.getFieldNumber(i);
			Order order = additionalOrderKeys.getOrder(i);
			this.ordering.appendOrdering(field, additionalOrderKeys.getType(i), order);
		}
	} else {
		this.ordering = null;
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:21,代码来源:GroupReduceProperties.java

示例9: areCoFulfilled

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
@Override
public boolean areCoFulfilled(RequestedLocalProperties requested1, RequestedLocalProperties requested2,
		LocalProperties produced1, LocalProperties produced2)
{
	int numRelevantFields = this.keys1.size();
	
	Ordering prod1 = produced1.getOrdering();
	Ordering prod2 = produced2.getOrdering();
	
	if (prod1 == null || prod2 == null || prod1.getNumberOfFields() < numRelevantFields ||
			prod2.getNumberOfFields() < prod2.getNumberOfFields())
	{
		throw new CompilerException("The given properties do not meet this operators requirements.");
	}
		
	for (int i = 0; i < numRelevantFields; i++) {
		if (prod1.getOrder(i) != prod2.getOrder(i)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:23,代码来源:SortMergeJoinDescriptor.java

示例10: initializeDataProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
private List<OperatorDescriptorDual> initializeDataProperties() {
	Ordering groupOrder1 = null;
	Ordering groupOrder2 = null;
	
	CoGroupOperatorBase<?, ?, ?, ?> cgc = getPactContract();
	groupOrder1 = cgc.getGroupOrderForInputOne();
	groupOrder2 = cgc.getGroupOrderForInputTwo();
		
	if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) {
		groupOrder1 = null;
	}
	if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) {
		groupOrder2 = null;
	}
	
	return Collections.<OperatorDescriptorDual>singletonList(new CoGroupDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2));
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:18,代码来源:CoGroupNode.java

示例11: matchesOrderedPartitioning

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public boolean matchesOrderedPartitioning(Ordering o) {
	if (this.partitioning == PartitioningProperty.RANGE_PARTITIONED) {
		if (this.ordering.getNumberOfFields() > o.getNumberOfFields()) {
			return false;
		}
		
		for (int i = 0; i < this.ordering.getNumberOfFields(); i++) {
			if (!this.ordering.getFieldNumber(i).equals(o.getFieldNumber(i))) {
				return false;
			}
			
			// if this one request no order, everything is good
			final Order oo = o.getOrder(i);
			final Order to = this.ordering.getOrder(i);
			if (oo != Order.NONE) {
				if (oo == Order.ANY) {
					// if any order is requested, any not NONE order is good
					if (to == Order.NONE) {
						return false;
					}
				} else if (oo != to) {
					// the orders must be equal
					return false;
				}
			}
		}
		return true;
	} else {
		return false;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:32,代码来源:GlobalProperties.java

示例12: initPossibleProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
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);
	}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:GroupCombineNode.java

示例13: initPossibleProperties

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
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() instanceof GroupReduceOperatorBase) {
		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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:39,代码来源:GroupReduceNode.java

示例14: addOrderingToSchema

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
private void addOrderingToSchema(Ordering o, SparseKeySchema schema) throws ConflictingFieldTypeInfoException {
	for (int i = 0; i < o.getNumberOfFields(); i++) {
		Integer pos = o.getFieldNumber(i);
		Class<? extends Key<?>> type = o.getType(i);
		schema.addType(pos, type);
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:8,代码来源:RecordModelPostPass.java

示例15: matchesOrderedPartitioning

import org.apache.flink.api.common.operators.Ordering; //导入方法依赖的package包/类
public boolean matchesOrderedPartitioning(Ordering o) {
	if (this.partitioning == PartitioningProperty.RANGE_PARTITIONED) {
		if (this.ordering.getNumberOfFields() > o.getNumberOfFields()) {
			return false;
		}
		
		for (int i = 0; i < this.ordering.getNumberOfFields(); i++) {
			if (this.ordering.getFieldNumber(i) != o.getFieldNumber(i)) {
				return false;
			}
			
			// if this one request no order, everything is good
			final Order oo = o.getOrder(i);
			final Order to = this.ordering.getOrder(i);
			if (oo != Order.NONE) {
				if (oo == Order.ANY) {
					// if any order is requested, any not NONE order is good
					if (to == Order.NONE) {
						return false;
					}
				} else if (oo != to) {
					// the orders must be equal
					return false;
				}
			}
		}
		return true;
	} else {
		return false;
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:32,代码来源:GlobalProperties.java


注:本文中的org.apache.flink.api.common.operators.Ordering.getNumberOfFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。