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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intRe-usable unknown row constant to serve as the default return value fornoEntryValue().static final Object[]Re-usable empty key, for use in (trivial) reverse lookups against no-key aggregations. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidboxedGet(@NotNull AggregationRowLookup lookup, @NotNull Chunk<? extends Values>[] keyChunks, @NotNull WritableLongChunk<RowKeys> rowKeys) Implementget(Chunk[], WritableLongChunk)by boxing each key and callingget(Object)onlookup, for implementations that cannot search a chunk of keys at once.voidget(@NotNull Chunk<? extends Values>[] keyChunks, @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 forget(Object).intGets the row key value wherekeyexists in the aggregation result table, or thenoEntryValue()ifkeyis not found in the table.longThe step of the last update cycle in which the aggregation began to change the structure this lookup reads, for a reader on another thread; seeIncrementalOperatorAggregationStateManager.lastStateChangeStep().default int
-
Field Details
-
EMPTY_KEY
Re-usable empty key, for use in (trivial) reverse lookups against no-key aggregations. -
DEFAULT_UNKNOWN_ROW
static final int DEFAULT_UNKNOWN_ROWRe-usable unknown row constant to serve as the default return value fornoEntryValue().- See Also:
-
-
Method Details
-
get
Gets the row key value wherekeyexists in the aggregation result table, or thenoEntryValue()ifkeyis 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_KEYobject, or any zero-lengthObject[], and are looked up one at a time; the chunkedgetneeds 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
keyexists 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 forget(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 sizerowKeys- Receives the row key of each key, ornoEntryValue()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; seeIncrementalOperatorAggregationStateManager.lastStateChangeStep().- Returns:
- The step of the last update cycle that began changing the structure, or
QueryConstants.NULL_LONGif 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) Implementget(Chunk[], WritableLongChunk)by boxing each key and callingget(Object)onlookup, for implementations that cannot search a chunk of keys at once.- Parameters:
lookup- The lookup to call for each keykeyChunks- The keys, one chunk per group-by column, at least one, all the same sizerowKeys- Receives the row key of each key; its size is set to the number of keys
-