Interface IncrementalOperatorAggregationStateManager

All Known Implementing Classes:
IncrementalChunkedOperatorAggregationStateManagerOpenAddressedBase

public interface IncrementalOperatorAggregationStateManager
Interface for ChunkedOperatorAggregationHelper to process incremental updates.
  • Field Details

  • Method Details

    • makeProbeContext

      SafeCloseable makeProbeContext(ColumnSource<?>[] probeSources, long maxSize)
    • beginUpdateCycle

      void beginUpdateCycle(long step)
      Allow our managers to do a little bit of work at the very start of the update cycle. We have this method so that even if nothing is to be done, we rehash a little bit on each cycle to avoid always rehashing when there is other work to be done. Called before any change to the hash table in the cycle.
      Parameters:
      step - the clock step of the update cycle
    • lastStateChangeStep

      long lastStateChangeStep()
      The step of the last update cycle that began changing the hash table, set before its first change. A cycle that has rehash work left, adds rows or modifies keys may change the hash table, so it records its step; a cycle that only removes rows or modifies other columns leaves the hash table unchanged, and records nothing. A reader on another thread reads the clock's step before its reads, and this after them behind a fence. Compared to the reader's step, this is:
      • less: no cycle at or after the reader's step changed the hash table during the reads, so they saw its state at that step, which is both its previous and current state;
      • equal: the reader's step's cycle has begun changing the hash table, so the reads may not have seen its previous state; they saw its current state if the reader waited for that cycle to finish;
      • greater: a later cycle has begun changing the hash table, so the reads may not have seen either state at the reader's step.
      Returns:
      the step of the last update cycle that began changing the hash table, or QueryConstants.NULL_LONG if none has
    • startTrackingPrevValues

      void startTrackingPrevValues()
    • remove

      void remove(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions)
    • findModifications

      void findModifications(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions)
    • maxTableSize

      int maxTableSize()
    • makeAggregationStateBuildContext

      SafeCloseable makeAggregationStateBuildContext(ColumnSource<?>[] buildSources, long maxSize)
    • add

      void add(SafeCloseable bc, RowSequence rowSequence, ColumnSource<?>[] sources, MutableInt nextOutputPosition, WritableIntChunk<RowKeys> outputPositions)
    • getKeyHashTableSources

      ColumnSource[] getKeyHashTableSources()
    • findPositionForKey

      int findPositionForKey(Object key)
      Implement a lookup in order to support AggregationRowLookup.get(Object).
      Parameters:
      key - The opaque group-by key to find the row position/key for
      Returns:
      The row position/key for key in the result table, or -1 if not found
    • findPositionsForKeys

      void findPositionsForKeys(@NotNull @NotNull Chunk<? extends Values>[] keyChunks, @NotNull @NotNull WritableLongChunk<RowKeys> positions)
      Implement a chunked lookup in order to support AggregationRowLookup.get(Chunk[], WritableLongChunk).
      Parameters:
      keyChunks - The group-by keys, one chunk per group-by column, at least one, reinterpreted as for the build
      positions - Receives the row position/key of each key, or -1 for a key not found; its size is set to the number of keys