TPartial - the intermediate type of the value used during aggregationTFinal - the final type of the value after the aggregation is finishedpublic abstract class AggregationFunction<TPartial,TFinal> extends java.lang.Object implements FunctionImplementation
| Constructor and Description |
|---|
AggregationFunction() |
| Modifier and Type | Method and Description |
|---|---|
abstract TPartial |
iterate(RamAccountingContext ramAccountingContext,
TPartial state,
Input... args)
the "aggregate" function.
|
abstract TPartial |
newState(RamAccountingContext ramAccountingContext,
org.elasticsearch.Version indexVersionCreated,
org.elasticsearch.common.util.BigArrays bigArrays)
Called once per "aggregation cycle" to create an initial partial-state-value.
|
abstract DataType |
partialType() |
abstract TPartial |
reduce(RamAccountingContext ramAccountingContext,
TPartial state1,
TPartial state2)
This function merges two aggregation states together and returns that merged state.
|
abstract TFinal |
terminatePartial(RamAccountingContext ramAccountingContext,
TPartial state)
Called to transform partial states into their final form.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinfo, normalizeSymbol@Nullable public abstract TPartial newState(RamAccountingContext ramAccountingContext, org.elasticsearch.Version indexVersionCreated, org.elasticsearch.common.util.BigArrays bigArrays)
ramAccountingContext - used to account the memory used for the state.indexVersionCreated - the version the current index was created on, this is useful for BWCbigArrays - the BigArrays singleton instance of the current nodepublic abstract TPartial iterate(RamAccountingContext ramAccountingContext, TPartial state, Input... args) throws org.elasticsearch.common.breaker.CircuitBreakingException
ramAccountingContext - used to account for additional memory usage if the state grows in sizestate - the previous aggregation stateargs - arguments / input values matching the types of FunctionInfo.argumentTypes.
These are usually used to increment/modify the previous stateorg.elasticsearch.common.breaker.CircuitBreakingExceptionpublic abstract TPartial reduce(RamAccountingContext ramAccountingContext, TPartial state1, TPartial state2)
This is used in a distributed aggregation workflow where 2 partial aggregations are reduced into 1 partial aggregation
public abstract TFinal terminatePartial(RamAccountingContext ramAccountingContext, TPartial state)
public abstract DataType partialType()