Class OnHeapStringDictionary
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.index.readers.BaseImmutableDictionary
-
- org.apache.pinot.segment.local.segment.index.readers.OnHeapStringDictionary
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Dictionary
public class OnHeapStringDictionary extends BaseImmutableDictionary
Implementation of String dictionary that cache all values on-heap.This is useful for String columns that:
- Has low cardinality string dictionary where memory footprint on-heap is acceptably small
- Is heavily queried
This helps avoid creation of String from byte[], which is expensive as well as creates garbage.
-
-
Field Summary
-
Fields inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
NULL_VALUE_INDEX
-
-
Constructor Summary
Constructors Constructor Description OnHeapStringDictionary(PinotDataBuffer dataBuffer, int length, int numBytesPerValue, byte paddingByte)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget(int dictId)BigDecimalgetBigDecimalValue(int dictId)byte[]getBytesValue(int dictId)doublegetDoubleValue(int dictId)floatgetFloatValue(int dictId)intgetIntValue(int dictId)longgetLongValue(int dictId)StringgetStringValue(int dictId)FieldSpec.DataTypegetValueType()intindexOf(String stringValue)intinsertionIndexOf(String stringValue)WARNING: With non-zero padding byte, binary search result might not reflect the real insertion index for the value.-
Methods inherited from class org.apache.pinot.segment.local.segment.index.readers.BaseImmutableDictionary
binarySearch, binarySearch, binarySearch, binarySearch, binarySearch, binarySearch, binarySearch, close, compare, getBigDecimal, getBuffer, getBytes, getDictIdsInRange, getDouble, getFloat, getInt, getLong, getMaxVal, getMinVal, getPaddedString, getSortedValues, getUnpaddedString, isSorted, length, normalizeIndex, padString
-
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
getByteArrayValue, getInternal, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, readBigDecimalValues, readBytesValues, readDoubleValues, readFloatValues, readIntValues, readLongValues, readStringValues
-
-
-
-
Constructor Detail
-
OnHeapStringDictionary
public OnHeapStringDictionary(PinotDataBuffer dataBuffer, int length, int numBytesPerValue, byte paddingByte)
-
-
Method Detail
-
getValueType
public FieldSpec.DataType getValueType()
-
indexOf
public int indexOf(String stringValue)
- Specified by:
indexOfin interfaceDictionary- Overrides:
indexOfin classBaseImmutableDictionary
-
insertionIndexOf
public int insertionIndexOf(String stringValue)
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
-
get
public String get(int dictId)
-
getIntValue
public int getIntValue(int dictId)
-
getLongValue
public long getLongValue(int dictId)
-
getFloatValue
public float getFloatValue(int dictId)
-
getDoubleValue
public double getDoubleValue(int dictId)
-
getBigDecimalValue
public BigDecimal getBigDecimalValue(int dictId)
-
getStringValue
public String getStringValue(int dictId)
-
getBytesValue
public byte[] getBytesValue(int dictId)
-
-