The GroupAggregator provides an ability to split a subset of entries in a Map 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 UniversalExtractor in such a way that two entries will belong to the same group if and only if the result of the corresponding 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.

The GroupAggregator is somewhat similar to the DistinctValues aggregator, which returns back a list of distinct values (tuples) without performing any additional aggregation work.

Type Parameters

  • K = any

    the type of the Map entry keys

  • V = any

    the type of the Map entry values

  • E = any

    key return type

  • R = any

    the type of the group aggregator result

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

@class: string

Server-side EntryAggregator implementation type identifier.

aggregator: EntryAggregator<K, V, R>

The underlying EntryAggregator.

extractor?: ValueExtractor

The ValueExtractor to apply when aggregating results.

filter?: Filter

The Filter object representing the having clause of this group by aggregator.

Methods