Database Reference
In-Depth Information
}
public Long zero() {
return 0L;
}
}
The biggest advantage these CombinerAggregators functions have over the par-
titionAggregate function is that it's a more efficient and optimized approach as it
proceeds by performing partial aggregations before the transfer of results over the net-
work.
ReducerAggregator
As the name suggests, this function produces an init value and then iterates over every
tuple in the input stream to produce an output comprising of a single field and a single
tuple.
The following is the interface contract for the ReducerAggregate interface:
public interface ReducerAggregator<T> extends Serializable {
T init();
T reduce(T curr, TridentTuple tuple);
}
Here is the implementation of this interface for count functionality:
public class myReducerCount implements
ReducerAggregator<Long> {
public Long init() {
return 0L;
}
public Long reduce(Long curr, TridentTuple tuple) {
return curr + 1;
}
}
Search WWH ::




Custom Search