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 theKeyMappingMultiValueGroupByColumnSelectorStrategy.Encoding
The caller is expected to handle non-null values. Null values must be filtered by the caller, and assignedGroupByColumnSelectorStrategy.GROUP_BY_MISSING_VALUE1.DimensionIdCodecextracts the dimension from the selector 2. The value gets encoded into a dictionaryId, usinglookupId(DimensionType)3. The callers can use this integer dictionaryID to represent the grouping keyDecoding
Converts back the dictionaryId to the dimension value. The implementations are not expected to handleGroupByColumnSelectorStrategy.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanCompareIds()Returns if the object comparison can be optimised directly by comparing the dictionaryIds, instead of decoding the objects and comparing those.DimensionTypeidToKey(int id)MemoryFootprint<Integer>lookupId(DimensionType dimension)voidreset()
-
-
-
Method Detail
-
lookupId
MemoryFootprint<Integer> lookupId(DimensionType dimension)
- Returns:
- DictionaryId of the object at the given index and the memory increase associated with it
-
idToKey
DimensionType idToKey(int id)
-
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()
-
-