Key
- the input key typeSupplied
- the value type returned from the Supplier
Result
- the value type returned from the aggregationIMap.aggregate(Aggregator)
or IMap.aggregate(Aggregator, Predicate)
.@Deprecated public interface Aggregation<Key,Supplied,Result>
Mapper
,
Combiner
, Reducer
and
probably a Collator
to execute an aggregation over a
supplied set of data.
As you'll see in the following example, the Aggregations API is fully type-safe. Due to the lack of
full type inference support on Java 6 and Java 7, it seems more verbose than it actually is.
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());
Modifier and Type | Method and Description |
---|---|
Collator<Map.Entry,Result> |
getCollator()
Deprecated.
Returns the Collator implementation used in this aggregation.
|
CombinerFactory |
getCombinerFactory()
Deprecated.
Returns the CombinerFactory for this aggregation to pre-reduce values on mapping
nodes.
|
Mapper |
getMapper(Supplier<Key,?,Supplied> supplier)
Deprecated.
Returns the Mapper for this aggregation.
|
ReducerFactory |
getReducerFactory()
Deprecated.
Returns the ReducerFactory for this aggregation.
|
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 valuesCombinerFactory getCombinerFactory()
Combiner
is not always possible.ReducerFactory getReducerFactory()
Reducer
has to handle values of
the returned type of the Combiner
.Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.