Class KeyMappingMultiValueGroupByColumnSelectorStrategy
java.lang.Object
org.apache.druid.query.groupby.epinephelinae.column.KeyMappingMultiValueGroupByColumnSelectorStrategy
- All Implemented Interfaces:
ColumnSelectorStrategy,GroupByColumnSelectorStrategy
- Direct Known Subclasses:
KeyMappingMultiValueGroupByColumnSelectorStrategy.DictionaryBuilding,KeyMappingMultiValueGroupByColumnSelectorStrategy.PrebuiltDictionary
public abstract class KeyMappingMultiValueGroupByColumnSelectorStrategy
extends Object
implements GroupByColumnSelectorStrategy
Like
KeyMappingGroupByColumnSelectorStrategy, but for multi-value dimensions, i.e. strings. It can only handle
DimensionSelector-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields inherited from interface org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorStrategy
GROUP_BY_MISSING_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckRowIndexAndAddValueToGroupingKey(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.create(ColumnCapabilities capabilities, DimensionSelector dimensionSelector) intReturn the size, in bytes, of this dimension's values in the grouping key.voidinitGroupingKeyColumnValue(int keyBufferPosition, int dimensionIndex, Object rowObj, ByteBuffer keyBuffer, int[] stack) Read the first value within a row values object (e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorStrategy
bufferComparator, initColumnValues, processValueFromGroupingKey, reset, writeToKeyBuffer
-
Constructor Details
-
KeyMappingMultiValueGroupByColumnSelectorStrategy
public KeyMappingMultiValueGroupByColumnSelectorStrategy()
-
-
Method Details
-
create
public static GroupByColumnSelectorStrategy create(ColumnCapabilities capabilities, DimensionSelector dimensionSelector) -
getGroupingKeySizeBytes
public int getGroupingKeySizeBytes()Description copied from interface:GroupByColumnSelectorStrategyReturn the size, in bytes, of this dimension's values in the grouping key. For example, a String implementation would return 4, the size of an int.- Specified by:
getGroupingKeySizeBytesin interfaceGroupByColumnSelectorStrategy- Returns:
- size, in bytes, of this dimension's values in the grouping key.
-
initGroupingKeyColumnValue
public void initGroupingKeyColumnValue(int keyBufferPosition, int dimensionIndex, Object rowObj, ByteBuffer keyBuffer, int[] stack) Description copied from interface:GroupByColumnSelectorStrategyRead the first value within a row values object (e. g.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()), writeGroupByColumnSelectorStrategy.GROUP_BY_MISSING_VALUEinstead. If the size of the row is > 0, write 1 to stack[] at columnIndex, otherwise write 0.- Specified by:
initGroupingKeyColumnValuein interfaceGroupByColumnSelectorStrategy- Parameters:
keyBufferPosition- Starting offset for this column's value within the grouping key.dimensionIndex- Index of this dimension within thestackarrayrowObj- Row value object for this columnkeyBuffer- grouping keystack- array containing the current within-row value index for each column
-
checkRowIndexAndAddValueToGroupingKey
public boolean checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition, Object rowObj, int rowValIdx, ByteBuffer keyBuffer) Description copied from interface:GroupByColumnSelectorStrategyIf 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. Then return true. This method assumes that the size increase associated with the dictionary building has occurred already when callingGroupByColumnSelectorStrategy.initColumnValues(org.apache.druid.segment.ColumnValueSelector, int, java.lang.Object[])Otherwise, return false.- Specified by:
checkRowIndexAndAddValueToGroupingKeyin interfaceGroupByColumnSelectorStrategy- Parameters:
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 key- Returns:
- true if rowValIdx < size of rowObj, false otherwise
-