public final class Aggregators extends Object
Aggregator
instances.
Min/Max/Average aggregators are type specific, so an integerAvg() aggregator expects all elements to be integers. There is no conversion executed while accumulating, so if there is any other type met an exception will be thrown.
In order to operate on a generic Number type use the fixedPointSum(), floatingPointSum() and numberAvg() aggregators. All of them will convert the given number to either Long or Double during the accumulation phase. It will result in a lot of allocations since each number has to be converted, but it enables the user to operate on the whole family of numbers. It is especially useful if the numbers given to the aggregators may not be of one type only.
The attributePath given in the factory method allows the aggregator to operate on the value extracted by navigating to the given attributePath on each object that has been returned from a query. The attribute path may be simple, e.g. "name", or nested "address.city".
If an aggregator does not accept null values pass a predicate to the aggregate call that will filter them out.
If the input value or the extracted value is a collection it won't be "unfolded" - so for example count aggregation on "person.postalCodes" will return 1 for each input object and not the size of the collection. In order to calculate the size of the collection use the [any] operator, e.g. "person.postalCodes[any]".
public static <I> Aggregator<I,Long> count()
I
- type of the input object.public static <I> Aggregator<I,Long> count(String attributePath)
I
- type of the input object.public static <I,R> Aggregator<I,Set<R>> distinct()
I
- type of the input object.R
- type of the return object.public static <I,R> Aggregator<I,Set<R>> distinct(String attributePath)
I
- type of the input object.R
- type of the return object.public static <I> Aggregator<I,BigDecimal> bigDecimalAvg()
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigIntegerAvg()
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigIntegerAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> doubleAvg()
I
- type of the input object.public static <I> Aggregator<I,Double> doubleAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> integerAvg()
I
- type of the input object.public static <I> Aggregator<I,Double> integerAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> longAvg()
I
- type of the input object.public static <I> Aggregator<I,Double> longAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> numberAvg()
I
- type of the input object.public static <I> Aggregator<I,Double> numberAvg(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalMax()
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalMax(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerMax()
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerMax(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> doubleMax()
I
- type of the input object.public static <I> Aggregator<I,Double> doubleMax(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Integer> integerMax()
I
- type of the input object.public static <I> Aggregator<I,Integer> integerMax(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Long> longMax()
I
- type of the input object.public static <I> Aggregator<I,Long> longMax(String attributePath)
I
- type of the input object.public static <I,R extends Comparable> Aggregator<I,R> comparableMax()
I
- type of the input object.R
- type of the return object (subtype of Comparable)public static <I,R extends Comparable> Aggregator<I,R> comparableMax(String attributePath)
I
- type of the input object.R
- type of the return object (subtype of Comparable)public static <I> Aggregator<I,I> maxBy(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalMin()
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalMin(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerMin()
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerMin(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> doubleMin()
I
- type of the input object.public static <I> Aggregator<I,Double> doubleMin(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Integer> integerMin()
I
- type of the input object.public static <I> Aggregator<I,Integer> integerMin(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Long> longMin()
I
- type of the input object.public static <I> Aggregator<I,Long> longMin(String attributePath)
I
- type of the input object.public static <I,R extends Comparable> Aggregator<I,R> comparableMin()
I
- type of the input object.R
- type of the return object (subtype of Comparable)public static <I,R extends Comparable> Aggregator<I,R> comparableMin(String attributePath)
I
- type of the input object.R
- type of the return object (subtype of Comparable)public static <I> Aggregator<I,I> minBy(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalSum()
I
- type of the input object.public static <I> Aggregator<I,BigDecimal> bigDecimalSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerSum()
I
- type of the input object.public static <I> Aggregator<I,BigInteger> bigIntegerSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> doubleSum()
I
- type of the input object.public static <I> Aggregator<I,Double> doubleSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Long> integerSum()
I
- type of the input object.public static <I> Aggregator<I,Long> integerSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Long> longSum()
I
- type of the input object.public static <I> Aggregator<I,Long> longSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Long> fixedPointSum()
I
- type of the input object.public static <I> Aggregator<I,Long> fixedPointSum(String attributePath)
I
- type of the input object.public static <I> Aggregator<I,Double> floatingPointSum()
I
- type of the input object.public static <I> Aggregator<I,Double> floatingPointSum(String attributePath)
I
- type of the input object.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.