T- element type
public abstract class AnalyticHelper<T> extends RichOutputFormat<T>
GraphAnalyticcomputes over a DataSet and returns the results via Flink accumulators. This computation is cheaply performed in a terminating
RichOutputFormat. This class simplifies the creation of analytic helpers by providing pass-through methods for adding and getting accumulators. Each accumulator name is prefixed with a random string since Flink accumulators share a per-job global namespace. This class also provides empty implementations of
|Constructor and Description|
|Modifier and Type||Method and Description|
Adds an accumulator by prepending the given name with a random string.
Configures this output format.
Gets the accumulator with the given name.
Opens a parallel instance of the output format to store the result of its parallel instance.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void configure(Configuration parameters)
This method is always called first on a newly instantiated output format.
parameters- The configuration with all parameters.
public void open(int taskNumber, int numTasks) throws IOException
When this method is called, the output format it guaranteed to be configured.
taskNumber- The number of the parallel instance.
numTasks- The number of parallel tasks.
IOException- Thrown, if the output could not be opened due to an I/O problem.
public <V,A extends Serializable> void addAccumulator(String name, Accumulator<V,A> accumulator)
V- Type of values that are added to the accumulator
A- Type of the accumulator result as it will be reported to the client
name- The name of the accumulator
accumulator- The accumulator
public <A> A getAccumulator(ExecutionEnvironment env, String accumulatorName)
null, if no accumulator with that name was produced.
A- The generic type of the accumulator value
accumulatorName- The name of the accumulator
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.