Annotation Interface Aggregator
AggregatorFunction implementations.
The first thing the aggregator generation code does is find a static
method names init or initSingle. That's the method that
initializes an empty aggregation state. The method can either return
a subclass of AggregatorState or it can return an int,
long, or double which will automatically be adapted into
a small AggregatorState implementation that wraps a mutable reference
to the primitive.
Next the generation code finds a static method named combine which
"combines" the state with a new value. The first parameter of this method
must the state type detected in the previous section or be a primitive that
lines up with one of the primitive state types from the previous section.
This is called once per value to "combine" the value into the state.
If the state type has a method called seen then the generated
aggregation will call it at least once if it'll ever call combine.
Think of this as a lower overhead way of detecting the cases where no values
are ever collected.
The generation code will also look for a method called combineValueCount
which is called once per received block with a count of values. NOTE: We may
not need this after we convert AVG into a composite operation.
The generation code also looks for the optional methods combineIntermediate
and evaluateFinal which are used to combine intermediate states and
produce the final output. If the first is missing then the generated code will
call the combine method to combine intermediate states. If the second
is missing the generated code will make a block containing the primitive from
the state. If either of those don't have sensible interpretations then the code
generation code will throw an error, aborting the compilation.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionExceptions thrown by the `combine*(...)` methods to catch and convert into a warning and turn into a null value.
-
Element Details
-
value
IntermediateState[] value- Default:
{}
-
warnExceptions
Exceptions thrown by the `combine*(...)` methods to catch and convert into a warning and turn into a null value.- Default:
{}
-