Annotation Interface Aggregator


@Target(TYPE) @Retention(SOURCE) public @interface Aggregator
Trigger for generating 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 also looks for the optional methods combineIntermediate and evaluateFinal which are used to combine intermediate states and produce the final output. Please note, those are auto-generated when aggregating primitive types such as boolean, int, long, float, double.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If true then the @timestamp LongVector will be appended to the input blocks of the aggregation function.
     
    Class<? extends Exception>[]
    Exceptions thrown by the `combine*(...)` methods to catch and convert into a warning and turn into a null value.
  • Element Details

    • value

      Default:
      {}
    • warnExceptions

      Class<? extends Exception>[] warnExceptions
      Exceptions thrown by the `combine*(...)` methods to catch and convert into a warning and turn into a null value.
      Default:
      {}
    • includeTimestamps

      boolean includeTimestamps
      If true then the @timestamp LongVector will be appended to the input blocks of the aggregation function.
      Default:
      false