Class AbstractAllByKeyGroupingState

java.lang.Object
org.elasticsearch.compute.aggregation.AbstractArrayState
org.elasticsearch.compute.aggregation.AbstractAllByKeyGroupingState
All Implemented Interfaces:
Closeable, AutoCloseable, GroupingAggregatorState, Releasable
Direct Known Subclasses:
AbstractAllByIntGroupingState, AbstractAllByLongGroupingState

public abstract class AbstractAllByKeyGroupingState extends AbstractArrayState
Base class for the grouping state of all "all first/last by key" aggregators. Tracks the null-value and null-key flags per group. Subclasses add the key array itself, typed to the key element type.

Whether a group has ever been collected is tracked via AbstractArrayState.hasValue(int) from AbstractArrayState, driven by AbstractArrayState.trackGroupId(int) calls in collectValue. The nullValue bit only distinguishes null values from non-null values; it does not encode "never seen".

  • Constructor Details

    • AbstractAllByKeyGroupingState

      protected AbstractAllByKeyGroupingState(BigArrays bigArrays)
  • Method Details

    • nullValue

      protected final boolean nullValue(int group)
    • markNullValue

      protected final void markNullValue(int group)
    • clearNullValue

      protected final void clearNullValue(int group)
    • nullKey

      protected final boolean nullKey(int group)
    • markNullKey

      protected final void markNullKey(int group)
    • clearNullKey

      protected final void clearNullKey(int group)
    • grow

      protected abstract void grow(int group)
      Called when a new group id is seen to grow subclass arrays to accommodate group. Both nullValue and nullKey are lazy BitArrays that handle out-of-range indices safely, so no grow is needed in this base class.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Releasable
      Overrides:
      close in class AbstractArrayState