Google Cloud Dataflow SDK for Java, version 1.9.1
Interface Aggregator<InputT,OutputT>
-
- Type Parameters:
InputT
- the type of input valuesOutputT
- the type of output values
public interface Aggregator<InputT,OutputT>
AnAggregator<InputT>
enables monitoring of values of typeInputT
, to be combined across all bundles.Aggregators are created by calling
DoFn.createAggregator(java.lang.String, com.google.cloud.dataflow.sdk.transforms.Combine.CombineFn<? super AggInputT, ?, AggOutputT>)
, typically from theDoFn
constructor. Elements can be added to theAggregator
by callingaddValue(InputT)
.Aggregators are visible in the monitoring UI, when the pipeline is run using DataflowPipelineRunner or BlockingDataflowPipelineRunner, along with their current value. Aggregators may not become visible until the system begins executing the ParDo transform that created them and/or their initial value is changed.
Example:
class MyDoFn extends DoFn
{ private Aggregator myAggregator; public MyDoFn() { myAggregator = createAggregator("myAggregator", new Sum.SumIntegerFn()); }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
addValue(InputT value)
Adds a new value into the Aggregator.Combine.CombineFn<InputT,?,OutputT>
getCombineFn()
Returns theCombine.CombineFn
, which combines input elements in the aggregator.String
getName()
Returns the name of the Aggregator.
-
-
-
Method Detail
-
addValue
void addValue(InputT value)
Adds a new value into the Aggregator.
-
getName
String getName()
Returns the name of the Aggregator.
-
getCombineFn
Combine.CombineFn<InputT,?,OutputT> getCombineFn()
Returns theCombine.CombineFn
, which combines input elements in the aggregator.
-
-