Interface AggregationRowLookup


public interface AggregationRowLookup
Tool to identify the aggregation result row key (also row position) from a logical key representing a set of values for the aggregation's group-by columns.
  • Field Details

    • EMPTY_KEY

      static final Object[] EMPTY_KEY
      Re-usable empty key, for use in (trivial) reverse lookups against no-key aggregations.
    • DEFAULT_UNKNOWN_ROW

      static final int DEFAULT_UNKNOWN_ROW
      Re-usable unknown row constant to serve as the default return value for noEntryValue().
      See Also:
  • Method Details

    • get

      int get(Object key)
      Gets the row key value where key exists in the aggregation result table, or the noEntryValue() if key is not found in the table.

      This serves to map group-by column values to the row position (also row key) in the result table. Missing keys will map to noEntryValue().

      Keys are specified as follows:

      No group-by columns
      "Empty" keys are signified by the EMPTY_KEY object, or any zero-length Object[], and are looked up one at a time; the chunked get needs a group-by column to give the number of keys
      One group-by column
      Singular keys are (boxed, if needed) objects
      Multiple group-by columns
      Compound keys are Object[] of (boxed, if needed) objects, in the order of the aggregation's group-by columns

      All key fields must be reinterpreted to the appropriate primitive value before boxing. See ReinterpretUtils.maybeConvertToPrimitive(io.deephaven.engine.table.ColumnSource<?>).

      Parameters:
      key - A single (boxed) value for single-column keys, or an array of (boxed) values for compound keys
      Returns:
      The row key where key exists in the table
    • noEntryValue

      default int noEntryValue()
      Returns:
      The value that will be returned from get(Object) if no entry exists for a given key
    • get

      void get(@NotNull @NotNull Chunk<? extends Values>[] keyChunks, @NotNull @NotNull WritableLongChunk<RowKeys> rowKeys)
      Gets the row key for each of a chunk of keys, given one chunk per group-by column, each reinterpreted to the appropriate primitive value as for get(Object). The aggregation must have at least one group-by column, whose chunk gives the number of keys.
      Parameters:
      keyChunks - The keys, one chunk per group-by column, at least one, all the same size
      rowKeys - Receives the row key of each key, or noEntryValue() for a key that is not found; its size is set to the number of keys
    • lastStateChangeStep

      long lastStateChangeStep()
      The step of the last update cycle in which the aggregation began to change the structure this lookup reads, for a reader on another thread; see IncrementalOperatorAggregationStateManager.lastStateChangeStep().
      Returns:
      The step of the last update cycle that began changing the structure, or QueryConstants.NULL_LONG if none has or the structure never changes
    • boxedGet

      static void boxedGet(@NotNull @NotNull AggregationRowLookup lookup, @NotNull @NotNull Chunk<? extends Values>[] keyChunks, @NotNull @NotNull WritableLongChunk<RowKeys> rowKeys)
      Implement get(Chunk[], WritableLongChunk) by boxing each key and calling get(Object) on lookup, for implementations that cannot search a chunk of keys at once.
      Parameters:
      lookup - The lookup to call for each key
      keyChunks - The keys, one chunk per group-by column, at least one, all the same size
      rowKeys - Receives the row key of each key; its size is set to the number of keys