本文整理汇总了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));
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例8: getIterationContract
import org.apache.flink.api.common.operators.base.DeltaIterationBase; //导入依赖的package包/类
public DeltaIterationBase<?, ?> getIterationContract() {
return (DeltaIterationBase<?, ?>) getOperator();
}
示例9: getIterationContract
import org.apache.flink.api.common.operators.base.DeltaIterationBase; //导入依赖的package包/类
public DeltaIterationBase<?, ?> getIterationContract() {
return (DeltaIterationBase<?, ?>) getPactContract();
}
示例10: WorksetPlaceHolder
import org.apache.flink.api.common.operators.base.DeltaIterationBase; //导入依赖的package包/类
public WorksetPlaceHolder(DeltaIterationBase<?, Record> container) {
super(container, new OperatorInformation<Record>(new RecordTypeInfo()));
}
示例11: SolutionSetPlaceHolder
import org.apache.flink.api.common.operators.base.DeltaIterationBase; //导入依赖的package包/类
public SolutionSetPlaceHolder(DeltaIterationBase<Record, ?> container) {
super(container, new OperatorInformation<Record>(new RecordTypeInfo()));
}