Interface Dictionary

  • All Superinterfaces:
    AutoCloseable, Closeable
    All Known Subinterfaces:
    MutableDictionary

    public interface Dictionary
    extends Closeable
    Interface for the dictionary. For the read APIs, type conversion among INT, LONG, FLOAT, DOUBLE, STRING should be supported. Type conversion between STRING and BYTES via Hex encoding/decoding should be supported.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int NULL_VALUE_INDEX  
    • Method Summary

      Modifier and Type Method Description
      int compare​(int dictId1, int dictId2)
      Returns the comparison result of the values (actual value instead of string representation of the value) for the given dictionary ids, i.e.
      Object get​(int dictId)
      Returns the value at the given dictId in the dictionary.
      BigDecimal getBigDecimalValue​(int dictId)  
      default ByteArray getByteArrayValue​(int dictId)  
      default byte[] getBytesValue​(int dictId)
      NOTE: Should be overridden for STRING, BIG_DECIMAL and BYTES dictionary.
      it.unimi.dsi.fastutil.ints.IntSet getDictIdsInRange​(String lower, String upper, boolean includeLower, boolean includeUpper)
      Returns a set of dictIds in the given value range, where lower/upper bound can be "*" which indicates unbounded range.
      double getDoubleValue​(int dictId)  
      float getFloatValue​(int dictId)  
      default Object getInternal​(int dictId)
      Returns the value at the given dictId in the dictionary.
      int getIntValue​(int dictId)  
      long getLongValue​(int dictId)  
      Comparable getMaxVal()
      Returns the maximum value in the dictionary.
      Comparable getMinVal()
      Returns the minimum value in the dictionary.
      Object getSortedValues()
      Returns a sorted array of all values in the dictionary.
      String getStringValue​(int dictId)  
      FieldSpec.DataType getValueType()
      Returns the data type of the values in the dictionary.
      default int indexOf​(double doubleValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      default int indexOf​(float floatValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      default int indexOf​(int intValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      default int indexOf​(long longValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      int indexOf​(String stringValue)
      Returns the index of the string representation of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      default int indexOf​(BigDecimal bigDecimalValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      default int indexOf​(ByteArray bytesValue)
      Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist.
      int insertionIndexOf​(String stringValue)
      Returns the insertion index of the string representation of the value in the dictionary.
      boolean isSorted()
      Returns true if the values in the dictionary are sorted, false otherwise.
      int length()
      Returns the number of values in the dictionary.
      default void readBigDecimalValues​(int[] dictIds, int length, BigDecimal[] outValues)  
      default void readBytesValues​(int[] dictIds, int length, byte[][] outValues)  
      default void readDoubleValues​(int[] dictIds, int length, double[] outValues)  
      default void readFloatValues​(int[] dictIds, int length, float[] outValues)  
      default void readIntValues​(int[] dictIds, int length, int[] outValues)  
      default void readLongValues​(int[] dictIds, int length, long[] outValues)  
      default void readStringValues​(int[] dictIds, int length, String[] outValues)  
    • Method Detail

      • isSorted

        boolean isSorted()
        Returns true if the values in the dictionary are sorted, false otherwise.
      • getValueType

        FieldSpec.DataType getValueType()
        Returns the data type of the values in the dictionary.
      • length

        int length()
        Returns the number of values in the dictionary.
      • indexOf

        int indexOf​(String stringValue)
        Returns the index of the string representation of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. This method is for the cross-type predicate evaluation.
      • indexOf

        default int indexOf​(int intValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for INT dictionaries.
      • indexOf

        default int indexOf​(long longValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for LONG dictionaries.
      • indexOf

        default int indexOf​(float floatValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for FLOAT dictionaries.
      • indexOf

        default int indexOf​(double doubleValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for DOUBLE dictionaries.
      • indexOf

        default int indexOf​(BigDecimal bigDecimalValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for BIG_DECIMAL dictionaries.
      • indexOf

        default int indexOf​(ByteArray bytesValue)
        Returns the index of the value in the dictionary, or NULL_VALUE_INDEX (-1) if the value does not exist. Must be implemented for BYTE_ARRAY dictionaries.
      • insertionIndexOf

        int insertionIndexOf​(String stringValue)
        Returns the insertion index of the string representation of the value in the dictionary. This method follows the same behavior as in Arrays.binarySearch(Object[], Object). All sorted dictionaries should support this method. This method is for the range predicate evaluation.
      • getDictIdsInRange

        it.unimi.dsi.fastutil.ints.IntSet getDictIdsInRange​(String lower,
                                                            String upper,
                                                            boolean includeLower,
                                                            boolean includeUpper)
        Returns a set of dictIds in the given value range, where lower/upper bound can be "*" which indicates unbounded range. All unsorted dictionaries should support this method. This method is for the range predicate evaluation.
      • compare

        int compare​(int dictId1,
                    int dictId2)
        Returns the comparison result of the values (actual value instead of string representation of the value) for the given dictionary ids, i.e. value1.compareTo(value2).
      • getMinVal

        Comparable getMinVal()
        Returns the minimum value in the dictionary. For type BYTES, ByteArray will be returned. Undefined if the dictionary is empty.
      • getMaxVal

        Comparable getMaxVal()
        Returns the maximum value in the dictionary. For type BYTES, ByteArray will be returned. Undefined if the dictionary is empty.
      • getSortedValues

        Object getSortedValues()
        Returns a sorted array of all values in the dictionary. For type INT/LONG/FLOAT/DOUBLE, primitive type array will be returned; for type BIG_DECIMAL, BigDecimal[] will be returned; for type STRING, String[] will be returned; for type BYTES, ByteArray[] will be returned. This method is for the stats collection phase when sealing the consuming segment.
      • get

        Object get​(int dictId)
        Returns the value at the given dictId in the dictionary.

        The Object type returned for each value type:

        • INT -> Integer
        • LONG -> Long
        • FLOAT -> Float
        • DOUBLE -> Double
        • BIG_DECIMAL -> BigDecimal
        • STRING -> String
        • BYTES -> byte[]
      • getInternal

        default Object getInternal​(int dictId)
        Returns the value at the given dictId in the dictionary.

        The Object type returned for each value type:

        • INT -> Integer
        • LONG -> Long
        • FLOAT -> Float
        • DOUBLE -> Double
        • BIG_DECIMAL -> BigDecimal
        • STRING -> String
        • BYTES -> ByteArray
      • getIntValue

        int getIntValue​(int dictId)
      • getLongValue

        long getLongValue​(int dictId)
      • getFloatValue

        float getFloatValue​(int dictId)
      • getDoubleValue

        double getDoubleValue​(int dictId)
      • getBigDecimalValue

        BigDecimal getBigDecimalValue​(int dictId)
      • getStringValue

        String getStringValue​(int dictId)
      • getBytesValue

        default byte[] getBytesValue​(int dictId)
        NOTE: Should be overridden for STRING, BIG_DECIMAL and BYTES dictionary.
      • getByteArrayValue

        default ByteArray getByteArrayValue​(int dictId)
      • readIntValues

        default void readIntValues​(int[] dictIds,
                                   int length,
                                   int[] outValues)
      • readLongValues

        default void readLongValues​(int[] dictIds,
                                    int length,
                                    long[] outValues)
      • readFloatValues

        default void readFloatValues​(int[] dictIds,
                                     int length,
                                     float[] outValues)
      • readDoubleValues

        default void readDoubleValues​(int[] dictIds,
                                      int length,
                                      double[] outValues)
      • readBigDecimalValues

        default void readBigDecimalValues​(int[] dictIds,
                                          int length,
                                          BigDecimal[] outValues)
      • readStringValues

        default void readStringValues​(int[] dictIds,
                                      int length,
                                      String[] outValues)
      • readBytesValues

        default void readBytesValues​(int[] dictIds,
                                     int length,
                                     byte[][] outValues)