A MaxAnalyticAggregator is an AnalyticFunction that determines the maximum of the property values. This is a subclass of MaxAggregator that implements additional logic necessary to efficiently determine the maximum when values are deleted from consideration.
Create and use a MaxAnalyticAggregator, with one of the following methods:
AnalyticAggregator ana = new AnalyticAggregator.Builder() .setAnalyticFunction(new MaxAnalyticAggregator("prop")) .setPartition(new PartitionClause(Arrays.asList("category1"))) .setOrderBy(new OrderByClause(Arrays.asList(new OrderByElement("value2", OrderByElement.SortDir.DESC)))) .setWindow(new WindowClause(WindowClause.Type.ROWS, 12, 0)) .build();
AnalyticAggregator agg = AnalyticAggregator.getAnalytic("MaxAnalyticAggregator(prop) partitionBy(category1) orderBy(value2 DESC) rows(12, 0)");
The values returned by the property of the object must be Comparable. This includes, but is not limited to, all numeric values and Strings.
The value's "compareTo" method may be called to establish which object is the maximum.
MaxAnalyticAggregator accepts user-given window clauses.