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 intNULL_VALUE_INDEX
-
Method Summary
Modifier and Type Method Description intcompare(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.Objectget(int dictId)Returns the value at the given dictId in the dictionary.BigDecimalgetBigDecimalValue(int dictId)default ByteArraygetByteArrayValue(int dictId)default byte[]getBytesValue(int dictId)NOTE: Should be overridden for STRING, BIG_DECIMAL and BYTES dictionary.it.unimi.dsi.fastutil.ints.IntSetgetDictIdsInRange(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.doublegetDoubleValue(int dictId)floatgetFloatValue(int dictId)default ObjectgetInternal(int dictId)Returns the value at the given dictId in the dictionary.intgetIntValue(int dictId)longgetLongValue(int dictId)ComparablegetMaxVal()Returns the maximum value in the dictionary.ComparablegetMinVal()Returns the minimum value in the dictionary.ObjectgetSortedValues()Returns a sorted array of all values in the dictionary.StringgetStringValue(int dictId)FieldSpec.DataTypegetValueType()Returns the data type of the values in the dictionary.default intindexOf(double doubleValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.default intindexOf(float floatValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.default intindexOf(int intValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.default intindexOf(long longValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.intindexOf(String stringValue)Returns the index of the string representation of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.default intindexOf(BigDecimal bigDecimalValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.default intindexOf(ByteArray bytesValue)Returns the index of the value in the dictionary, orNULL_VALUE_INDEX(-1) if the value does not exist.intinsertionIndexOf(String stringValue)Returns the insertion index of the string representation of the value in the dictionary.booleanisSorted()Returnstrueif the values in the dictionary are sorted,falseotherwise.intlength()Returns the number of values in the dictionary.default voidreadBigDecimalValues(int[] dictIds, int length, BigDecimal[] outValues)default voidreadBytesValues(int[] dictIds, int length, byte[][] outValues)default voidreadDoubleValues(int[] dictIds, int length, double[] outValues)default voidreadFloatValues(int[] dictIds, int length, float[] outValues)default voidreadIntValues(int[] dictIds, int length, int[] outValues)default voidreadLongValues(int[] dictIds, int length, long[] outValues)default voidreadStringValues(int[] dictIds, int length, String[] outValues)
-
-
-
Field Detail
-
NULL_VALUE_INDEX
static final int NULL_VALUE_INDEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isSorted
boolean isSorted()
Returnstrueif the values in the dictionary are sorted,falseotherwise.
-
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, orNULL_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, orNULL_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, orNULL_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, orNULL_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, orNULL_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, orNULL_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, orNULL_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 inArrays.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,ByteArraywill be returned. Undefined if the dictionary is empty.
-
getMaxVal
Comparable getMaxVal()
Returns the maximum value in the dictionary. For type BYTES,ByteArraywill 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)
-
-