All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisPlanVerificationAware, Resolvable
Direct Known Subclasses:
Absent, Avg, Count, CountApproximate, CountDistinct, DimensionValues, Earliest, First, FirstDocId, FromPartial, HistogramMerge, Last, Latest, Max, Median, Min, NumericAggregate, Present, Sample, Scalar, Sparkline, SpatialAggregateFunction, StdDev, TimeSeriesAggregateFunction, Top, ToPartial, Values, Variance, WeightedAvg

public abstract class AggregateFunction extends Function implements PostAnalysisPlanVerificationAware
A type of Function that takes multiple values and extracts a single value out of them. For example, AVG(). - Aggregate functions can have an optional filter and window, which default to Literal.TRUE and NO_WINDOW. - The aggregation function should be composed as: source, field, filter, window, parameters. Extra parameters should go to the parameters after the filter and window.

These function appear only in special places in the language that expect to take many inputs and produce one output per group key:

  • | STATS MAX(a)
  • | STATS MAX(a) BY ...

They always process many input rows to produce their values. If they are built without a BY they produce a single value as output. If they are built with a BY they produce one value per group key as output.

See AggregatorMode for important information about their execution lifecycle.