public Vertex<K, NV> map(Vertex<K, VV> value) throws Exception { output.f0 = value.f0; output.f1 = mapper.map(value); return output; } })
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public final int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }
@Override public void reduce(Iterable<IN> values, Collector<OUT> out) throws Exception { wrappedFunction.reduce(values, out); } }
/** * Returns the metric group for this parallel subtask. * * @return metric group for this parallel subtask. */ public MetricGroup getMetricGroup() { return context.getMetricGroup(); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
@Override public Tuple2<K, T> reduce(Tuple2<K, T> value1, Tuple2<K, T> value2) throws Exception { value1.f1 = this.wrappedFunction.reduce(value1.f1, value2.f1); return value1; } }
@Override public void coGroup(Iterable<T1> first, Iterable<T2> second, Collector<T> out) throws Exception { for (T1 val1: first) { for (T2 val2: second) { wrappedFunction.join(val1, val2, out); } } } }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public final <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
public static void setFunctionRuntimeContext(Function function, RuntimeContext context){ if (function instanceof RichFunction) { RichFunction richFunction = (RichFunction) function; richFunction.setRuntimeContext(context); } }
public static void closeFunction(Function function) throws Exception{ if (function instanceof RichFunction) { RichFunction richFunction = (RichFunction) function; richFunction.close(); } }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
public static RuntimeContext getFunctionRuntimeContext(Function function, RuntimeContext defaultContext){ if (function instanceof RichFunction) { RichFunction richFunction = (RichFunction) function; return richFunction.getRuntimeContext(); } else { return defaultContext; } }
@Override public void reduce(Iterable<IN> values, Collector<OUT> out) throws Exception { wrappedFunction.reduce(values, out); } }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. They can be registered via * {@link org.apache.flink.graph.spargel.ScatterGatherConfiguration#addBroadcastSetForGatherFunction(String, org.apache.flink.api.java.DataSet)}. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }