Package org.apache.druid.segment
Class ComparatorDimensionDictionary<T>
- java.lang.Object
-
- org.apache.druid.segment.ComparatorDimensionDictionary<T>
-
public class ComparatorDimensionDictionary<T> extends Object
Comparator
basedDimensionDictionary
there are a lot of unused methods in here for now since the only thing this is used for is to build up the unsorted dictionary and then it is converted to aComparatorSortedDimensionDictionary
, but leaving the unused methods in place for now to be basically compatible with the other implementation. This version is not thread-safe since the only current user doesn't use the dictionary for realtime queries, if this changes we need to add a 'ConcurrentComparatorDimensionDictionary'.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ABSENT_VALUE_ID
-
Constructor Summary
Constructors Constructor Description ComparatorDimensionDictionary(Comparator<T> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(T originalValue)
long
estimateSizeOfValue(T value)
Estimates the size of the dimension value in bytes.int
getId(T value)
int
getIdForNull()
T
getMaxValue()
T
getMinValue()
T
getValue(int id)
int
size()
long
sizeInBytes()
Gets the current size of this dictionary in bytes.ComparatorSortedDimensionDictionary<T>
sort()
-
-
-
Field Detail
-
ABSENT_VALUE_ID
public static final int ABSENT_VALUE_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ComparatorDimensionDictionary
public ComparatorDimensionDictionary(Comparator<T> comparator)
-
-
Method Detail
-
size
public int size()
-
sizeInBytes
public long sizeInBytes()
Gets the current size of this dictionary in bytes.- Throws:
IllegalStateException
- if size computation is disabled.
-
getMinValue
public T getMinValue()
-
getMaxValue
public T getMaxValue()
-
getIdForNull
public int getIdForNull()
-
sort
public ComparatorSortedDimensionDictionary<T> sort()
-
estimateSizeOfValue
public long estimateSizeOfValue(T value)
Estimates the size of the dimension value in bytes. This method is called only when a new dimension value is being added to the lookup.- Throws:
UnsupportedOperationException
- Implementations that want to estimate memory must override this method.
-
-