當前位置: 首頁>>代碼示例>>Java>>正文


Java DeltaIterationBase類代碼示例

本文整理匯總了Java中org.apache.flink.api.common.operators.base.DeltaIterationBase的典型用法代碼示例。如果您正苦於以下問題:Java DeltaIterationBase類的具體用法?Java DeltaIterationBase怎麽用?Java DeltaIterationBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DeltaIterationBase類屬於org.apache.flink.api.common.operators.base包,在下文中一共展示了DeltaIterationBase類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: WorksetIterationNode

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
/**
 * Creates a new node with a single input for the optimizer plan.
 * 
 * @param iteration The iteration operator that the node represents.
 */
public WorksetIterationNode(DeltaIterationBase<?, ?> iteration) {
	super(iteration);
	
	final int[] ssKeys = iteration.getSolutionSetKeyFields();
	if (ssKeys == null || ssKeys.length == 0) {
		throw new CompilerException("Invalid WorksetIteration: No key fields defined for the solution set.");
	}
	this.solutionSetKeyFields = new FieldList(ssKeys);
	this.partitionedProperties = new GlobalProperties();
	this.partitionedProperties.setHashPartitioned(this.solutionSetKeyFields);
	
	int weight = iteration.getMaximumNumberOfIterations() > 0 ? 
		iteration.getMaximumNumberOfIterations() : DEFAULT_COST_WEIGHT;
		
	if (weight > OptimizerNode.MAX_DYNAMIC_PATH_COST_WEIGHT) {
		weight = OptimizerNode.MAX_DYNAMIC_PATH_COST_WEIGHT;
	}
	this.costWeight = weight; 
	
	this.dataProperties = Collections.<OperatorDescriptorDual>singletonList(new WorksetOpDescriptor(this.solutionSetKeyFields));
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:27,代碼來源:WorksetIterationNode.java

示例2: preVisit

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
@Override
public boolean preVisit(Operator<?> visitable) {
	if (this.seen.add(visitable)) {
		// add to  the map
		final String name = visitable.getName();
		List<Operator<?>> list = this.map.get(name);
		if (list == null) {
			list = new ArrayList<Operator<?>>(2);
			this.map.put(name, list);
		}
		list.add(visitable);
		
		// recurse into bulk iterations
		if (visitable instanceof BulkIterationBase) {
			((BulkIterationBase) visitable).getNextPartialSolution().accept(this);
		} else if (visitable instanceof DeltaIterationBase) {
			((DeltaIterationBase) visitable).getSolutionSetDelta().accept(this);
			((DeltaIterationBase) visitable).getNextWorkset().accept(this);
		}
		
		return true;
	} else {
		return false;
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:26,代碼來源:OperatorResolver.java

示例3: translateDeltaIteration

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
private <D, W> DeltaIterationBase<D, W> translateDeltaIteration(DeltaIterationResultSet<?, ?> untypedIterationEnd) {
	@SuppressWarnings("unchecked")
	DeltaIterationResultSet<D, W> iterationEnd = (DeltaIterationResultSet<D, W>) untypedIterationEnd;
	DeltaIteration<D, W> iterationHead = iterationEnd.getIterationHead();

	String name = iterationHead.getName() == null ? "Unnamed Delta Iteration" : iterationHead.getName();

	DeltaIterationBase<D, W> iterationOperator = new DeltaIterationBase<>(new BinaryOperatorInformation<>(iterationEnd.getType(), iterationEnd.getWorksetType(), iterationEnd.getType()),
			iterationEnd.getKeyPositions(), name);

	iterationOperator.setMaximumNumberOfIterations(iterationEnd.getMaxIterations());

	if (iterationHead.getParallelism() > 0) {
		iterationOperator.setParallelism(iterationHead.getParallelism());
	}

	DeltaIteration.SolutionSetPlaceHolder<D> solutionSetPlaceHolder = iterationHead.getSolutionSet();
	DeltaIteration.WorksetPlaceHolder<W> worksetPlaceHolder = iterationHead.getWorkset();

	translated.put(solutionSetPlaceHolder, iterationOperator.getSolutionSet());
	translated.put(worksetPlaceHolder, iterationOperator.getWorkset());

	Operator<D> translatedSolutionSet = translate(iterationEnd.getNextSolutionSet());
	Operator<W> translatedWorkset = translate(iterationEnd.getNextWorkset());

	iterationOperator.setNextWorkset(translatedWorkset);
	iterationOperator.setSolutionSetDelta(translatedSolutionSet);

	iterationOperator.setInitialSolutionSet(translate(iterationHead.getInitialSolutionSet()));
	iterationOperator.setInitialWorkset(translate(iterationHead.getInitialWorkset()));

	// register all aggregators
	iterationOperator.getAggregators().addAll(iterationHead.getAggregators());

	iterationOperator.setSolutionSetUnManaged(iterationHead.isSolutionSetUnManaged());

	return iterationOperator;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:39,代碼來源:OperatorTranslation.java

示例4: execute

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
private List<?> execute(Operator<?> operator, int superStep) throws Exception {
	List<?> result = this.intermediateResults.get(operator);
	
	// if it has already been computed, use the cached variant
	if (result != null) {
		return result;
	}
	
	if (operator instanceof BulkIterationBase) {
		result = executeBulkIteration((BulkIterationBase<?>) operator);
	}
	else if (operator instanceof DeltaIterationBase) {
		result = executeDeltaIteration((DeltaIterationBase<?, ?>) operator);
	}
	else if (operator instanceof SingleInputOperator) {
		result = executeUnaryOperator((SingleInputOperator<?, ?, ?>) operator, superStep);
	}
	else if (operator instanceof DualInputOperator) {
		result = executeBinaryOperator((DualInputOperator<?, ?, ?, ?>) operator, superStep);
	}
	else if (operator instanceof GenericDataSourceBase) {
		result = executeDataSource((GenericDataSourceBase<?, ?>) operator, superStep);
	}
	else if (operator instanceof GenericDataSinkBase) {
		executeDataSink((GenericDataSinkBase<?>) operator, superStep);
		result = Collections.emptyList();
	}
	else {
		throw new RuntimeException("Cannot execute operator " + operator.getClass().getName());
	}
	
	this.intermediateResults.put(operator, result);
	
	return result;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:36,代碼來源:CollectionExecutor.java

示例5: preVisit

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
@Override
public boolean preVisit(Operator<?> visitable) {
	if (visitable instanceof DeltaIterationBase.WorksetPlaceHolder) {
		foundWorkset = true;
	}

	return (!foundWorkset) && seenBefore.add(visitable);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:9,代碼來源:StepFunctionValidator.java

示例6: translateDeltaIteration

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
private <D, W> DeltaIterationBase<D, W> translateDeltaIteration(DeltaIterationResultSet<?, ?> untypedIterationEnd) {
	@SuppressWarnings("unchecked")
	DeltaIterationResultSet<D, W> iterationEnd = (DeltaIterationResultSet<D, W>) untypedIterationEnd;
	DeltaIteration<D, W> iterationHead = iterationEnd.getIterationHead();
	
	String name = iterationHead.getName() == null ? "Unnamed Delta Iteration" : iterationHead.getName();
	
	DeltaIterationBase<D, W> iterationOperator = new DeltaIterationBase<D, W>(new BinaryOperatorInformation<D, W, D>(iterationEnd.getType(), iterationEnd.getWorksetType(), iterationEnd.getType()),
			iterationEnd.getKeyPositions(), name);
	
	iterationOperator.setMaximumNumberOfIterations(iterationEnd.getMaxIterations());
	
	if (iterationHead.getParallelism() > 0) {
		iterationOperator.setDegreeOfParallelism(iterationHead.getParallelism());
	}

	DeltaIteration.SolutionSetPlaceHolder<D> solutionSetPlaceHolder = iterationHead.getSolutionSet();
	DeltaIteration.WorksetPlaceHolder<W> worksetPlaceHolder = iterationHead.getWorkset();

	translated.put(solutionSetPlaceHolder, iterationOperator.getSolutionSet());
	translated.put(worksetPlaceHolder, iterationOperator.getWorkset());

	Operator<D> translatedSolutionSet = translate(iterationEnd.getNextSolutionSet());
	Operator<W> translatedWorkset = translate(iterationEnd.getNextWorkset());
	
	iterationOperator.setNextWorkset(translatedWorkset);
	iterationOperator.setSolutionSetDelta(translatedSolutionSet);

	iterationOperator.setInitialSolutionSet(translate(iterationHead.getInitialSolutionSet()));
	iterationOperator.setInitialWorkset(translate(iterationHead.getInitialWorkset()));
	
	// register all aggregators
	iterationOperator.getAggregators().addAll(iterationHead.getAggregators());
	
	iterationOperator.setSolutionSetUnManaged(iterationHead.isSolutionSetUnManaged());
	
	return iterationOperator;
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:39,代碼來源:OperatorTranslation.java

示例7: execute

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
private List<?> execute(Operator<?> operator, int superStep) throws Exception {
	List<?> result = this.intermediateResults.get(operator);
	
	// if it has already been computed, use the cached variant
	if (result != null) {
		return result;
	}
	
	if (operator instanceof BulkIterationBase) {
		result = executeBulkIteration((BulkIterationBase<?>) operator);
	}
	else if (operator instanceof DeltaIterationBase) {
		result = executeDeltaIteration((DeltaIterationBase<?, ?>) operator);
	}
	else if (operator instanceof SingleInputOperator) {
		result = executeUnaryOperator((SingleInputOperator<?, ?, ?>) operator, superStep);
	}
	else if (operator instanceof DualInputOperator) {
		result = executeBinaryOperator((DualInputOperator<?, ?, ?, ?>) operator, superStep);
	}
	else if (operator instanceof GenericDataSourceBase) {
		result = executeDataSource((GenericDataSourceBase<?, ?>) operator);
	}
	else if (operator instanceof GenericDataSinkBase) {
		executeDataSink((GenericDataSinkBase<?>) operator);
		result = Collections.emptyList();
	}
	else {
		throw new RuntimeException("Cannot execute operator " + operator.getClass().getName());
	}
	
	this.intermediateResults.put(operator, result);
	
	return result;
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:36,代碼來源:CollectionExecutor.java

示例8: getIterationContract

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
public DeltaIterationBase<?, ?> getIterationContract() {
	return (DeltaIterationBase<?, ?>) getOperator();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:4,代碼來源:WorksetIterationNode.java

示例9: getIterationContract

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
public DeltaIterationBase<?, ?> getIterationContract() {
	return (DeltaIterationBase<?, ?>) getPactContract();
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:4,代碼來源:WorksetIterationNode.java

示例10: WorksetPlaceHolder

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
public WorksetPlaceHolder(DeltaIterationBase<?, Record> container) {
	super(container, new OperatorInformation<Record>(new RecordTypeInfo()));
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:4,代碼來源:DeltaIteration.java

示例11: SolutionSetPlaceHolder

import org.apache.flink.api.common.operators.base.DeltaIterationBase; //導入依賴的package包/類
public SolutionSetPlaceHolder(DeltaIterationBase<Record, ?> container) {
	super(container, new OperatorInformation<Record>(new RecordTypeInfo()));
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:4,代碼來源:DeltaIteration.java


注:本文中的org.apache.flink.api.common.operators.base.DeltaIterationBase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。