public interface GroupByColumnSelectorStrategy extends ColumnSelectorStrategy
DictionaryBuildingStringGroupByColumnSelectorStrategy. Callers should assume that the internal
state footprint starts out empty (zero bytes) and is also reset to zero on each call to reset(). Each call
to initColumnValues(org.apache.druid.segment.ColumnValueSelector, int, java.lang.Object[]) or writeToKeyBuffer(int, ColumnValueSelector, ByteBuffer) returns the
incremental increase in internal state footprint that happened as a result of that particular call.the vectorized version| Modifier and Type | Field and Description |
|---|---|
static int |
GROUP_BY_MISSING_VALUE |
| Modifier and Type | Method and Description |
|---|---|
Grouper.BufferComparator |
bufferComparator(int keyBufferPosition,
StringComparator stringComparator)
Return BufferComparator for values written using this strategy when limit is pushed down to segment scan.
|
boolean |
checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition,
Object rowObj,
int rowValIdx,
ByteBuffer keyBuffer)
If rowValIdx is less than the size of rowObj (haven't handled all of the row values):
First, read the value at rowValIdx from a rowObj and write that value to the keyBuffer at keyBufferPosition.
|
int |
getGroupingKeySize()
Return the size, in bytes, of this dimension's values in the grouping key.
|
int |
initColumnValues(ColumnValueSelector selector,
int columnIndex,
Object[] valuess)
Retrieve a row object from the
ColumnValueSelector and put it in valuess at columnIndex. |
void |
initGroupingKeyColumnValue(int keyBufferPosition,
int dimensionIndex,
Object rowObj,
ByteBuffer keyBuffer,
int[] stack)
Read the first value within a row values object (e.
|
void |
processValueFromGroupingKey(GroupByColumnSelectorPlus selectorPlus,
ByteBuffer key,
ResultRow resultRow,
int keyBufferPosition)
Read a value from a grouping key and add it to the group by query result row, using the output name specified
in a DimensionSpec.
|
void |
reset()
Reset any internal state held by this selector.
|
int |
writeToKeyBuffer(int keyBufferPosition,
ColumnValueSelector selector,
ByteBuffer keyBuffer)
Write a single object from the given selector to the keyBuffer at keyBufferPosition.
|
static final int GROUP_BY_MISSING_VALUE
int getGroupingKeySize()
void processValueFromGroupingKey(GroupByColumnSelectorPlus selectorPlus, ByteBuffer key, ResultRow resultRow, int keyBufferPosition)
selectorPlus - dimension info containing the key offset, value selector, and dimension specresultRow - result row for the group by query being servedkey - grouping keykeyBufferPosition - buffer position for the grouping key, added to support chaining multiple ColumnSelectorStrategyint initColumnValues(ColumnValueSelector selector, int columnIndex, Object[] valuess)
ColumnValueSelector and put it in valuess at columnIndex.selector - Value selector for a column.columnIndex - Index of the column within the row values arrayvaluess - Row values array, one index per columnvoid initGroupingKeyColumnValue(int keyBufferPosition,
int dimensionIndex,
Object rowObj,
ByteBuffer keyBuffer,
int[] stack)
IndexedInts, as the value in
a dictionary-encoded string column) and write that value to the keyBuffer at keyBufferPosition. If the row size is
0 (e. g. IndexedInts.size()), write GROUP_BY_MISSING_VALUE instead.
If the size of the row is > 0, write 1 to stack[] at columnIndex, otherwise write 0.keyBufferPosition - Starting offset for this column's value within the grouping key.dimensionIndex - Index of this dimension within the stack arrayrowObj - Row value object for this columnkeyBuffer - grouping keystack - array containing the current within-row value index for each columnboolean checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition,
Object rowObj,
int rowValIdx,
ByteBuffer keyBuffer)
keyBufferPosition - Starting offset for this column's value within the grouping key.rowObj - Row value object for this column (e.g., IndexedInts)rowValIdx - Index of the current value being grouped on within the rowkeyBuffer - grouping keyint writeToKeyBuffer(int keyBufferPosition,
ColumnValueSelector selector,
ByteBuffer keyBuffer)
keyBufferPosition - starting offset for this column's value within the grouping keyselector - selector to retrieve row value object fromkeyBuffer - grouping keyGrouper.BufferComparator bufferComparator(int keyBufferPosition, @Nullable StringComparator stringComparator)
keyBufferPosition - starting offset for this column's value within the grouping keystringComparator - stringComparator from LimitSpec for this column. If this is null, implementations
will use the StringComparators.LEXICOGRAPHIC
comparator.void reset()
processValueFromGroupingKey(org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus, java.nio.ByteBuffer, org.apache.druid.query.groupby.ResultRow, int) on that memory has undefined behavior.Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.