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


Java AbstractUdfOperator类代码示例

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


AbstractUdfOperator类属于org.apache.flink.api.common.operators包,在下文中一共展示了AbstractUdfOperator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateBcVariables

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
private void translateBcVariables(DataSet<?> setOrOp, Operator<?> dataFlowOp) {
	// check if this is actually an operator that could have broadcast variables
	if (setOrOp instanceof UdfOperator) {
		if (!(dataFlowOp instanceof AbstractUdfOperator<?, ?>)) {
			throw new RuntimeException("Error while creating the data flow plan for the program: A UDF operation was not translated to a UDF operator.");
		}

		UdfOperator<?> udfOp = (UdfOperator<?>) setOrOp;
		AbstractUdfOperator<?, ?> udfDataFlowOp = (AbstractUdfOperator<?, ?>) dataFlowOp;

		for (Map.Entry<String, DataSet<?>> bcVariable : udfOp.getBroadcastSets().entrySet()) {
			Operator<?> bcInput = translate(bcVariable.getValue());
			udfDataFlowOp.setBroadcastVariable(bcVariable.getKey(), bcInput);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:OperatorTranslation.java

示例2: setBroadcastInputs

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
/**
 * This function connects the operators that produce the broadcast inputs to this operator.
 *
 * @param operatorToNode The map from program operators to optimizer nodes.
 * @param defaultExchangeMode The data exchange mode to use, if the operator does not
 *                            specify one.
 *
 * @throws CompilerException
 */
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode, ExecutionMode defaultExchangeMode) {
	// skip for Operators that don't support broadcast variables 
	if (!(getOperator() instanceof AbstractUdfOperator<?, ?>)) {
		return;
	}

	// get all broadcast inputs
	AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getOperator());

	// create connections and add them
	for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) {
		OptimizerNode predecessor = operatorToNode.get(input.getValue());
		DagConnection connection = new DagConnection(predecessor, this,
														ShipStrategyType.BROADCAST, defaultExchangeMode);
		addBroadcastConnection(input.getKey(), connection);
		predecessor.addOutgoingConnection(connection);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:28,代码来源:OptimizerNode.java

示例3: OptimizerNode

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
/**
 * Creates a new node for the optimizer plan.
 * 
 * @param op The operator that the node represents.
 */
public OptimizerNode(Operator<?> op) {
	this.pactContract = op;
	readStubAnnotations();
	
	if (this.pactContract instanceof AbstractUdfOperator) {
		final AbstractUdfOperator<?, ?> pact = (AbstractUdfOperator<?, ?>) this.pactContract;
		this.remappedKeys = new int[pact.getNumberOfInputs()][];
		for (int i = 0; i < this.remappedKeys.length; i++) {
			final int[] keys = pact.getKeyColumns(i);
			int[] rk = new int[keys.length];
			System.arraycopy(keys, 0, rk, 0, keys.length);
			this.remappedKeys[i] = rk;
		}
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:21,代码来源:OptimizerNode.java

示例4: setBroadcastInputs

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
/**
 * This function is for plan translation purposes. Upon invocation, this method creates a {@link PactConnection}
 * for each one of the broadcast inputs associated with the {@code Operator} referenced by this node.
 * <p>
 * The {@code PactConnections} must set its shipping strategy type to BROADCAST.
 * 
 * @param operatorToNode
 *        The map associating operators with their corresponding optimizer nodes.
 * @throws CompilerException
 */
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode) throws CompilerException {

	// skip for Operators that don't support broadcast variables 
	if (!(getPactContract() instanceof AbstractUdfOperator<?, ?>)) {
		return;
	}

	// get all broadcast inputs
	AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getPactContract());

	// create connections and add them
	for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) {
		OptimizerNode predecessor = operatorToNode.get(input.getValue());
		PactConnection connection = new PactConnection(predecessor, this, ShipStrategyType.BROADCAST);
		addBroadcastConnection(input.getKey(), connection);
		predecessor.addOutgoingConnection(connection);
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:29,代码来源:OptimizerNode.java

示例5: getConstantKeySet

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
/**
 * Returns the key columns for the specific input, if all keys are preserved
 * by this node. Null, otherwise.
 */
protected int[] getConstantKeySet(int input) {
	Operator<?> contract = getPactContract();
	if (contract instanceof AbstractUdfOperator<?, ?>) {
		AbstractUdfOperator<?, ?> abstractPact = (AbstractUdfOperator<?, ?>) contract;
		int[] keyColumns = abstractPact.getKeyColumns(input);
		if (keyColumns != null) {
			if (keyColumns.length == 0) {
				return null;
			}
			for (int keyColumn : keyColumns) {
				if (!isFieldConstant(input, keyColumn)) {
					return null;	
				}
			}
			return keyColumns;
		}
	}
	return null;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:24,代码来源:OptimizerNode.java

示例6: translateBcVariables

import org.apache.flink.api.common.operators.AbstractUdfOperator; //导入依赖的package包/类
private void translateBcVariables(DataSet<?> setOrOp, Operator<?> dataFlowOp) {
	// check if this is actually an operator that could have broadcast variables
	if (setOrOp instanceof UdfOperator) {
		if (!(dataFlowOp instanceof AbstractUdfOperator<?, ?>)) {
			throw new RuntimeException("Error while creating the data flow plan for the program: A UDF operation was not translated to a UDF operator.");
		}
		
		UdfOperator<?> udfOp = (UdfOperator<?>) setOrOp;
		AbstractUdfOperator<?, ?> udfDataFlowOp = (AbstractUdfOperator<?, ?>) dataFlowOp;
	
		for (Map.Entry<String, DataSet<?>> bcVariable : udfOp.getBroadcastSets().entrySet()) {
			Operator<?> bcInput = translate(bcVariable.getValue());
			udfDataFlowOp.setBroadcastVariable(bcVariable.getKey(), bcInput);
		}
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:17,代码来源:OperatorTranslation.java


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