public class NullableNumericGroupByColumnSelectorStrategy extends Object implements GroupByColumnSelectorStrategy
GroupByColumnSelectorStrategy that makes it null-aware. Should only be used
for numeric strategies, not for string strategies.GROUP_BY_MISSING_VALUE| Constructor and Description |
|---|
NullableNumericGroupByColumnSelectorStrategy(GroupByColumnSelectorStrategy delegate) |
| 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[] values)
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.
|
public NullableNumericGroupByColumnSelectorStrategy(GroupByColumnSelectorStrategy delegate)
public int getGroupingKeySize()
GroupByColumnSelectorStrategygetGroupingKeySize in interface GroupByColumnSelectorStrategypublic void processValueFromGroupingKey(GroupByColumnSelectorPlus selectorPlus, ByteBuffer key, ResultRow resultRow, int keyBufferPosition)
GroupByColumnSelectorStrategyprocessValueFromGroupingKey in interface GroupByColumnSelectorStrategyselectorPlus - dimension info containing the key offset, value selector, and dimension speckey - grouping keyresultRow - result row for the group by query being servedkeyBufferPosition - buffer position for the grouping key, added to support chaining multiple ColumnSelectorStrategypublic int initColumnValues(ColumnValueSelector selector, int columnIndex, Object[] values)
GroupByColumnSelectorStrategyColumnValueSelector and put it in valuess at columnIndex.initColumnValues in interface GroupByColumnSelectorStrategyselector - Value selector for a column.columnIndex - Index of the column within the row values arrayvalues - Row values array, one index per columnpublic int writeToKeyBuffer(int keyBufferPosition,
ColumnValueSelector selector,
ByteBuffer keyBuffer)
GroupByColumnSelectorStrategywriteToKeyBuffer in interface GroupByColumnSelectorStrategykeyBufferPosition - starting offset for this column's value within the grouping keyselector - selector to retrieve row value object fromkeyBuffer - grouping keypublic Grouper.BufferComparator bufferComparator(int keyBufferPosition, @Nullable StringComparator stringComparator)
GroupByColumnSelectorStrategybufferComparator in interface GroupByColumnSelectorStrategykeyBufferPosition - 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.public void initGroupingKeyColumnValue(int keyBufferPosition,
int dimensionIndex,
Object rowObj,
ByteBuffer keyBuffer,
int[] stack)
GroupByColumnSelectorStrategyIndexedInts, 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 GroupByColumnSelectorStrategy.GROUP_BY_MISSING_VALUE instead.
If the size of the row is > 0, write 1 to stack[] at columnIndex, otherwise write 0.initGroupingKeyColumnValue in interface GroupByColumnSelectorStrategykeyBufferPosition - 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 columnpublic boolean checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition,
Object rowObj,
int rowValIdx,
ByteBuffer keyBuffer)
GroupByColumnSelectorStrategycheckRowIndexAndAddValueToGroupingKey in interface GroupByColumnSelectorStrategykeyBufferPosition - 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 keypublic void reset()
GroupByColumnSelectorStrategyGroupByColumnSelectorStrategy.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.reset in interface GroupByColumnSelectorStrategyCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.