Class BaseImmutableDictionary
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.index.readers.BaseImmutableDictionary
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Dictionary
- Direct Known Subclasses:
BigDecimalDictionary,BytesDictionary,ConstantValueBigDecimalDictionary,ConstantValueBytesDictionary,ConstantValueDoubleDictionary,ConstantValueFloatDictionary,ConstantValueIntDictionary,ConstantValueLongDictionary,ConstantValueStringDictionary,DocIdDictionary,DoubleDictionary,FloatDictionary,IntDictionary,LongDictionary,OnHeapBigDecimalDictionary,OnHeapBytesDictionary,OnHeapDoubleDictionary,OnHeapFloatDictionary,OnHeapIntDictionary,OnHeapLongDictionary,OnHeapStringDictionary,StringDictionary
public abstract class BaseImmutableDictionary extends Object implements Dictionary
Base implementation of immutable dictionary.
-
-
Field Summary
-
Fields inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
NULL_VALUE_INDEX
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseImmutableDictionary(int length)For virtual dictionary.protectedBaseImmutableDictionary(PinotDataBuffer dataBuffer, int length, int numBytesPerValue, byte paddingByte)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intbinarySearch(byte[] value)protected intbinarySearch(double value)protected intbinarySearch(float value)protected intbinarySearch(int value)protected intbinarySearch(long value)protected intbinarySearch(String value)WARNING: With non-zero padding byte, binary search result might not reflect the real insertion index for the value.protected intbinarySearch(BigDecimal value)voidclose()intcompare(int dictId1, int dictId2)protected BigDecimalgetBigDecimal(int dictId)protected byte[]getBuffer()protected byte[]getBytes(int dictId)it.unimi.dsi.fastutil.ints.IntSetgetDictIdsInRange(String lower, String upper, boolean includeLower, boolean includeUpper)protected doublegetDouble(int dictId)protected floatgetFloat(int dictId)protected intgetInt(int dictId)protected longgetLong(int dictId)ComparablegetMaxVal()ComparablegetMinVal()protected StringgetPaddedString(int dictId, byte[] buffer)ObjectgetSortedValues()protected StringgetUnpaddedString(int dictId, byte[] buffer)intindexOf(String stringValue)booleanisSorted()intlength()protected intnormalizeIndex(int index)protected StringpadString(String value)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
get, getBigDecimalValue, getByteArrayValue, getBytesValue, getDoubleValue, getFloatValue, getInternal, getIntValue, getLongValue, getStringValue, getValueType, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, insertionIndexOf, readBigDecimalValues, readBytesValues, readDoubleValues, readFloatValues, readIntValues, readLongValues, readStringValues
-
-
-
-
Constructor Detail
-
BaseImmutableDictionary
protected BaseImmutableDictionary(PinotDataBuffer dataBuffer, int length, int numBytesPerValue, byte paddingByte)
-
BaseImmutableDictionary
protected BaseImmutableDictionary(int length)
For virtual dictionary.
-
-
Method Detail
-
isSorted
public boolean isSorted()
- Specified by:
isSortedin interfaceDictionary
-
length
public int length()
- Specified by:
lengthin interfaceDictionary
-
indexOf
public int indexOf(String stringValue)
- Specified by:
indexOfin interfaceDictionary
-
normalizeIndex
protected final int normalizeIndex(int index)
-
getDictIdsInRange
public it.unimi.dsi.fastutil.ints.IntSet getDictIdsInRange(String lower, String upper, boolean includeLower, boolean includeUpper)
- Specified by:
getDictIdsInRangein interfaceDictionary
-
compare
public int compare(int dictId1, int dictId2)- Specified by:
comparein interfaceDictionary
-
getMinVal
public Comparable getMinVal()
- Specified by:
getMinValin interfaceDictionary
-
getMaxVal
public Comparable getMaxVal()
- Specified by:
getMaxValin interfaceDictionary
-
getSortedValues
public Object getSortedValues()
- Specified by:
getSortedValuesin interfaceDictionary
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
binarySearch
protected int binarySearch(int value)
-
binarySearch
protected int binarySearch(long value)
-
binarySearch
protected int binarySearch(float value)
-
binarySearch
protected int binarySearch(double value)
-
binarySearch
protected int binarySearch(BigDecimal value)
-
binarySearch
protected int binarySearch(String value)
WARNING: With non-zero padding byte, binary search result might not reflect the real insertion index for the value. E.g. with padding byte 'b', if unpadded value "aa" is in the dictionary, and stored as "aab", then unpadded value "a" will be mis-positioned after value "aa"; unpadded value "aab" will return positive value even if value "aab" is not in the dictionary. TODO: Clean up the segments with legacy non-zero padding byte, and remove the support for non-zero padding byte
-
binarySearch
protected int binarySearch(byte[] value)
-
getInt
protected int getInt(int dictId)
-
getLong
protected long getLong(int dictId)
-
getFloat
protected float getFloat(int dictId)
-
getDouble
protected double getDouble(int dictId)
-
getBigDecimal
protected BigDecimal getBigDecimal(int dictId)
-
getUnpaddedString
protected String getUnpaddedString(int dictId, byte[] buffer)
-
getPaddedString
protected String getPaddedString(int dictId, byte[] buffer)
-
getBytes
protected byte[] getBytes(int dictId)
-
getBuffer
protected byte[] getBuffer()
-
-