Class ComparatorDimensionDictionary<T>

java.lang.Object
org.apache.druid.segment.ComparatorDimensionDictionary<T>

public class ComparatorDimensionDictionary<T> extends Object
Comparator based DimensionDictionary 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 a ComparatorSortedDimensionDictionary, 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 Details

  • Constructor Details

    • ComparatorDimensionDictionary

      public ComparatorDimensionDictionary(Comparator<T> comparator)
  • Method Details

    • getId

      public int getId(@Nullable T value)
    • getValue

      @Nullable public T getValue(int id)
    • 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

    • 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.