GroupAggregator Class Reference

Detailed Description

The GroupAggregator provides an ability to split a subset of entries in an InvocableMap into a collection of non-intersecting subsets and then aggregate them separately and independently.

The splitting (grouping) is performed using the results of the underlying ValueExtractor in such a way that two entries will belong to the same group if and only if the result of the corresponding ValueExtractor::extract extract call produces the same value or tuple (list of values). After the entries are split into the groups, the underlying aggregator is applied separately to each group. The result of the aggregation by the GroupAggregator is a Map that has distinct values (or tuples) as keys and results of the individual aggregation as values. Additionally, those results could be further reduced using an optional Filter object.

Informally speaking, this aggregator is analogous to the SQL "group by" and "having" clauses. Note that the "having" Filter is applied independently on each server against the partial aggregation results; this generally implies that data affinity is required to ensure that all required data used to generate a given result exists within a single cache partition. In other words, the "group by" predicate should not span multiple partitions if the "having" clause is used.

Unlike many other concrete EntryAggregator implementations that are constructed directly, instances of GroupAggregator should only be created using one of the factory methods: create(ValueExtractor, InvocableMap::EntryAggregator) create(vExtractor, hAggregator), create(ValueExtractor, InvocableMap::EntryAggregator, Filter),

Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.

If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.

It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.