Class DimensionDictionary<T extends Comparable<T>>

java.lang.Object
org.apache.druid.segment.DimensionDictionary<T>
Direct Known Subclasses:
StringDimensionDictionary

public abstract class DimensionDictionary<T extends Comparable<T>> extends Object
Buildable dictionary for some comparable type. Values are unsorted, or rather sorted in the order which they are added. A SortedDimensionDictionary can be constructed with a mapping of ids from this dictionary to the sorted dictionary with the sort() method.

Concrete implementations of this dictionary must be thread-safe.

  • Field Details

  • Constructor Details

    • DimensionDictionary

      public DimensionDictionary(Class<T> cls)
  • Method Details

    • getId

      public int getId(@Nullable T value)
    • getValue

      @Nullable public T getValue(int id)
    • getValues

      public T[] getValues(int[] ids)
    • size

      public int size()
    • sizeInBytes

      public long sizeInBytes()
      Gets the current size of this dictionary in bytes.
      Throws:
      IllegalStateException - if size computation is disabled.
    • add

      public int add(@Nullable T originalValue)
    • getMinValue

      public T getMinValue()
    • getMaxValue

      public T getMaxValue()
    • getIdForNull

      public int getIdForNull()
    • sort

      public SortedDimensionDictionary<T> sort()
    • estimateSizeOfValue

      public abstract long estimateSizeOfValue(T value)
      Estimates the size of the dimension value in bytes.