|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Key
- the input key typeSupplied
- the value type returned from the Supplier
Result
- the value type returned from the aggregation@Beta public interface Aggregation<Key,Supplied,Result>
The Aggregation interface combines multiple map-reduce operations steps to a
single operation definition. It is a predefined set of Mapper
,
Combiner
, Reducer
and
probably a Collator
to execute an aggregation over a
supplied set of data.
IMap<String, Employee> map = hazelcastInstance.getMap("employees"); Supplier<String, Employee, Integer> supplier = Supplier.all((employee) -> employee.getSalaryPerMonth()); Aggregation<String, Integer, Integer> aggregation = Aggregations.integerAvg(); int avgSalary = map.aggregate(supplier, aggregation);With Java 8 it is possible to write that all in just one line so that the API becomes very straight forward.
IMap<String, Employee> map = hazelcastInstance.getMap("employees"); int avgSalary = map.aggregate(Supplier.all((employee) -> employee.getSalaryPerMonth(), Aggregations.integerAvg());
Method Summary | |
---|---|
Collator<Map.Entry,Result> |
getCollator()
Returns a Collator implementation used in this aggregation |
CombinerFactory |
getCombinerFactory()
Returns the CombinerFactory for this aggregation to pre-reduce values on mapping nodes. |
Mapper |
getMapper(Supplier<Key,?,Supplied> supplier)
Returns the Mapper for this aggregation. |
ReducerFactory |
getReducerFactory()
Returns the ReducerFactory for this aggregation. |
Method Detail |
---|
Collator<Map.Entry,Result> getCollator()
Mapper getMapper(Supplier<Key,?,Supplied> supplier)
Supplier
to filter / transform
values before emitting them to the further aggregation steps.
supplier
- the Supplier to filter or / and transform values
CombinerFactory getCombinerFactory()
Combiner
is not always possible.
ReducerFactory getReducerFactory()
Reducer
has to handle values of
the returned type of the Combiner
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |