Database Reference
In-Depth Information
public void complete(CountState state,
TridentCollector collector) {
collector.emit(new Values(state.count));
}
}
Numerous times we run into implementations requiring multiple aggregators to be execut-
ing simultaneously. In such cases, the concept of chaining comes in handy. Thanks to this
functionality in the Trident API, we can build an execution chain of aggregators to be ex-
ecuted over batches of incoming stream tuples. Here is an example of these kinds of
chains:
myInputstream.chainedAgg()
.partitionAggregate(new Count(), new
Fields("count"))
.partitionAggregate(new Fields("b"), new Sum(),
new Fields("sum"))
.chainEnd()
The execution of this chain would run the specified sum and count aggregator functions
on each partition. The output would be a single tuple, with two fields holding the values
of sum and count .
Search WWH ::




Custom Search