Interface DimensionIdCodec<DimensionType>
- Type Parameters:
DimensionType- Type of the dimension holder
public interface DimensionIdCodec<DimensionType>
Dimension to integer id encoder - decoder i.e. it is an interface for converters of dimension to dictionary id and back.
It only handles single value dimensions. Handle multi-value dimensions (i.e. strings) using the
KeyMappingMultiValueGroupByColumnSelectorStrategy.
Encoding
The caller is expected to handle non-null values. Null values must be filtered by the caller, and assigned GroupByColumnSelectorStrategy.GROUP_BY_MISSING_VALUE
1. DimensionIdCodec extracts the dimension from the selector
2. The value gets encoded into a dictionaryId, using lookupId(DimensionType)
3. The callers can use this integer dictionaryID to represent the grouping key
Decoding
Converts back the dictionaryId to the dimension value. The implementations are not expected to handle GroupByColumnSelectorStrategy.GROUP_BY_MISSING_VALUE.
The callers should handle those values appropriately ontheir own, and filter those out before trying to convert
the dictionary id back to value.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns if the object comparison can be optimised directly by comparing the dictionaryIds, instead of decoding the objects and comparing those.idToKey(int id) lookupId(DimensionType dimension) voidreset()
-
Method Details
-
lookupId
- Returns:
- DictionaryId of the object at the given index and the memory increase associated with it
-
idToKey
-
canCompareIds
boolean canCompareIds()Returns if the object comparison can be optimised directly by comparing the dictionaryIds, instead of decoding the objects and comparing those. Therefore, it returns true iff the "dict" function defined by dict(id) = value is monotonically increasing. Ids backed by dictionaries built on the fly can never be compared, therefore those should always return false. -
reset
void reset()
-