Class FixedIntArrayOffHeapIdMap
- java.lang.Object
-
- org.apache.pinot.segment.local.realtime.impl.dictionary.BaseOffHeapMutableDictionary
-
- org.apache.pinot.segment.local.utils.FixedIntArrayOffHeapIdMap
-
- All Implemented Interfaces:
Closeable,AutoCloseable,IdMap<FixedIntArray>,IndexReader,MutableDictionary,Dictionary
public class FixedIntArrayOffHeapIdMap extends BaseOffHeapMutableDictionary implements IdMap<FixedIntArray>
Implementation ofIdMapwithFixedIntArrayas key. This implementation extends theBaseOffHeapMutableDictionaryfor code-reuse of off-heap functionality. The dictionary related APIs are not supported.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
Dictionary.SortedBatchLookupAlgorithm
-
-
Field Summary
-
Fields inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
NULL_VALUE_INDEX
-
Fields inherited from interface org.apache.pinot.segment.local.utils.IdMap
INVALID_ID
-
-
Constructor Summary
Constructors Constructor Description FixedIntArrayOffHeapIdMap(int estimatedCardinality, int maxOverflowHashSize, int numColumns, PinotDataBufferMemoryManager memoryManager, String allocationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(int dictId1, int dictId2)voiddoClose()protected booleanequalsValueAt(int dictId, Object value, byte[] serializedValue)Objectget(int dictId)intgetAvgValueSize()BigDecimalgetBigDecimalValue(int dictId)it.unimi.dsi.fastutil.ints.IntSetgetDictIdsInRange(String lower, String upper, boolean includeLower, boolean includeUpper)doublegetDoubleValue(int dictId)floatgetFloatValue(int dictId)intgetId(FixedIntArray key)Returns the id associated with the specified key.intgetIntValue(int dictId)FixedIntArraygetKey(int id)Returns the key associated with the specified id.longgetLongValue(int dictId)ComparablegetMaxVal()ComparablegetMinVal()ObjectgetSortedValues()StringgetStringValue(int dictId)longgetTotalOffHeapMemUsed()FieldSpec.DataTypegetValueType()intindex(Object value)int[]index(Object[] values)intindexOf(String stringValue)intput(FixedIntArray key)Puts the specified key into the map.protected voidsetValue(int dictId, Object value, byte[] serializedValue)intsize()Returns the current size of the map, zero if the map is empty.-
Methods inherited from class org.apache.pinot.segment.local.realtime.impl.dictionary.BaseOffHeapMutableDictionary
close, getDictId, getNumberOfHeapBuffersUsed, getNumberOfOveflowValues, getOffHeapMemUsed, indexValue, init, length, nearestPowerOf2
-
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, getBytesValue, getDictIds, getDictIds, getInternal, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, readBigDecimalValues, readBytesValues, readDoubleValues, readDoubleValues, readFloatValues, readFloatValues, readIntValues, readIntValues, readLongValues, readLongValues, readStringValues
-
Methods inherited from interface org.apache.pinot.segment.spi.index.mutable.MutableDictionary
insertionIndexOf, isSorted
-
-
-
-
Constructor Detail
-
FixedIntArrayOffHeapIdMap
public FixedIntArrayOffHeapIdMap(int estimatedCardinality, int maxOverflowHashSize, int numColumns, PinotDataBufferMemoryManager memoryManager, String allocationContext)
-
-
Method Detail
-
put
public int put(FixedIntArray key)
Description copied from interface:IdMapPuts the specified key into the map. The id for the key is auto-generated as follows:- If key does not exist in the map, it is inserted into the map with a new id which is equal to number of
elements in the map before the key is inserted. For example, the first key inserted will have id of 0, second
will have an id of 1, and so on.
- If key already exists in the map, then it keeps its original id.
- Specified by:
putin interfaceIdMap<FixedIntArray>- Parameters:
key- Key to be inserted into the map.- Returns:
- Returns the id for the key.
-
getId
public int getId(FixedIntArray key)
Description copied from interface:IdMapReturns the id associated with the specified key.- Returns the id of the key if it exists.
- Returns
IdMap.INVALID_IDif the key does not exist in the map.- Specified by:
getIdin interfaceIdMap<FixedIntArray>- Parameters:
key- Key to get.- Returns:
- Id of the key.
-
getKey
public FixedIntArray getKey(int id)
Description copied from interface:IdMapReturns the key associated with the specified id.- Returns the id of the key if it exists.
- Returns null if the key does not exist in the map.
- Specified by:
getKeyin interfaceIdMap<FixedIntArray>- Parameters:
id- id for which to get the key.- Returns:
- Key for the id.
-
size
public int size()
Description copied from interface:IdMapReturns the current size of the map, zero if the map is empty.- Specified by:
sizein interfaceIdMap<FixedIntArray>- Returns:
- Size of the map.
-
setValue
protected void setValue(int dictId, Object value, byte[] serializedValue)- Specified by:
setValuein classBaseOffHeapMutableDictionary
-
equalsValueAt
protected boolean equalsValueAt(int dictId, Object value, byte[] serializedValue)- Specified by:
equalsValueAtin classBaseOffHeapMutableDictionary
-
doClose
public void doClose() throws IOException- Specified by:
doClosein classBaseOffHeapMutableDictionary- Throws:
IOException
-
index
public int index(Object value)
- Specified by:
indexin interfaceMutableDictionary
-
index
public int[] index(Object[] values)
- Specified by:
indexin interfaceMutableDictionary
-
compare
public int compare(int dictId1, int dictId2)- Specified by:
comparein interfaceDictionary
-
getDictIdsInRange
public it.unimi.dsi.fastutil.ints.IntSet getDictIdsInRange(String lower, String upper, boolean includeLower, boolean includeUpper)
- Specified by:
getDictIdsInRangein 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
-
getValueType
public FieldSpec.DataType getValueType()
- Specified by:
getValueTypein interfaceDictionary
-
indexOf
public int indexOf(String stringValue)
- Specified by:
indexOfin interfaceDictionary
-
get
public Object get(int dictId)
- Specified by:
getin interfaceDictionary
-
getIntValue
public int getIntValue(int dictId)
- Specified by:
getIntValuein interfaceDictionary
-
getLongValue
public long getLongValue(int dictId)
- Specified by:
getLongValuein interfaceDictionary
-
getFloatValue
public float getFloatValue(int dictId)
- Specified by:
getFloatValuein interfaceDictionary
-
getDoubleValue
public double getDoubleValue(int dictId)
- Specified by:
getDoubleValuein interfaceDictionary
-
getBigDecimalValue
public BigDecimal getBigDecimalValue(int dictId)
- Specified by:
getBigDecimalValuein interfaceDictionary
-
getStringValue
public String getStringValue(int dictId)
- Specified by:
getStringValuein interfaceDictionary
-
getAvgValueSize
public int getAvgValueSize()
- Specified by:
getAvgValueSizein classBaseOffHeapMutableDictionary
-
getTotalOffHeapMemUsed
public long getTotalOffHeapMemUsed()
- Specified by:
getTotalOffHeapMemUsedin classBaseOffHeapMutableDictionary
-
-