Package io.trino.spi.block
Class MapBlockBuilder
java.lang.Object
io.trino.spi.block.AbstractMapBlock
io.trino.spi.block.MapBlockBuilder
- All Implemented Interfaces:
Block,BlockBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionMapBlockBuilder(MapType mapType, BlockBuilderStatus blockBuilderStatus, int expectedEntries) -
Method Summary
Modifier and TypeMethodDescriptionAppends a null value to the block.Return a writer to the current entry.build()Builds the block.Close the current entry.voidDeprecated.use strict method insteadprotected voidprotected MapHashTablesprotected boolean[]protected intoffset is entry-based, not position-based.protected int[]offset is entry-based, not position-based.intReturns the number of positions in this block.protected Blockprotected BlocklongReturns the retained size of this block in memory, including over-allocations.longReturns the size of this block as if it was compacted, ignoring any over-allocations and any unloaded nested blocks.booleanIs it possible the block may have a null value? If false, the block cannot contain a null, but if true, the block may or may not have a null.newBlockBuilderLike(int expectedEntries, BlockBuilderStatus blockBuilderStatus) Creates a new block builder of the same type based on the current usage statistics of this block builder.voidretainedBytesForEachPart(ObjLongConsumer<Object> consumer) consumervisits each of the internal data container and accepts the size for it.strict()toString()Methods inherited from class io.trino.spi.block.AbstractMapBlock
copyPositions, copyRegion, fixedSizeInBytesPerPosition, getChildren, getEncodingName, getEstimatedDataSizeForStats, getMapType, getObject, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getSingleValueBlock, isHashTablesPresent, isNullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.trino.spi.block.Block
bytesCompare, bytesEqual, compareTo, copyPositions, copyRegion, equals, fixedSizeInBytesPerPosition, getByte, getChildren, getEncodingName, getEstimatedDataSizeForStats, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getObject, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isLoaded, isNull, writeBytesToMethods inherited from interface io.trino.spi.block.BlockBuilder
copyWithAppendedNull, getPositions, newBlockBuilderLike, writeByte, writeBytes, writeInt, writeLong, writeShort
-
Constructor Details
-
MapBlockBuilder
-
-
Method Details
-
strict
-
getRawKeyBlock
- Specified by:
getRawKeyBlockin classAbstractMapBlock
-
getRawValueBlock
- Specified by:
getRawValueBlockin classAbstractMapBlock
-
getHashTables
- Specified by:
getHashTablesin classAbstractMapBlock
-
getOffsets
protected int[] getOffsets()Description copied from class:AbstractMapBlockoffset is entry-based, not position-based. In other words, if offset[1] is 6, it means the first map has 6 key-value pairs, not 6 key/values (which would be 3 pairs).- Specified by:
getOffsetsin classAbstractMapBlock
-
getOffsetBase
protected int getOffsetBase()Description copied from class:AbstractMapBlockoffset is entry-based, not position-based. (see getOffsets)- Specified by:
getOffsetBasein classAbstractMapBlock
-
getMapIsNull
@Nullable protected boolean[] getMapIsNull()- Specified by:
getMapIsNullin classAbstractMapBlock
-
mayHaveNull
public boolean mayHaveNull()Description copied from interface:BlockIs it possible the block may have a null value? If false, the block cannot contain a null, but if true, the block may or may not have a null.- Specified by:
mayHaveNullin interfaceBlock
-
getPositionCount
public int getPositionCount()Description copied from interface:BlockReturns the number of positions in this block.- Specified by:
getPositionCountin interfaceBlock
-
getSizeInBytes
public long getSizeInBytes()Description copied from interface:BlockReturns the size of this block as if it was compacted, ignoring any over-allocations and any unloaded nested blocks. For example, in dictionary blocks, this only counts each dictionary entry once, rather than each time a value is referenced.- Specified by:
getSizeInBytesin interfaceBlock
-
getRetainedSizeInBytes
public long getRetainedSizeInBytes()Description copied from interface:BlockReturns the retained size of this block in memory, including over-allocations. This method is called from the inner most execution loop and must be fast.- Specified by:
getRetainedSizeInBytesin interfaceBlock
-
retainedBytesForEachPart
Description copied from interface:Blockconsumervisits each of the internal data container and accepts the size for it. This method can be helpful in cases such as memory counting for internal data structure. Also, the method should be non-recursive, only visit the elements at the top level, and specifically should not call retainedBytesForEachPart on nested blocksconsumershould be called at least once with the current block and must include the instance size of the current block- Specified by:
retainedBytesForEachPartin interfaceBlock
-
beginBlockEntry
Description copied from interface:BlockBuilderReturn a writer to the current entry. The caller can operate on the returned caller to incrementally build the object. This is generally more efficient than building the object elsewhere and call writeObject afterwards because a large chunk of memory could potentially be unnecessarily copied in this process.- Specified by:
beginBlockEntryin interfaceBlockBuilder
-
closeEntry
Description copied from interface:BlockBuilderClose the current entry.- Specified by:
closeEntryin interfaceBlockBuilder
-
closeEntryStrict
Deprecated.use strict method insteadThis method will check duplicate keys and close entry.When duplicate keys are discovered, the block is guaranteed to be in a consistent state before
DuplicateMapKeyExceptionis thrown. In other words, one can continue to use this BlockBuilder.- Throws:
DuplicateMapKeyException
-
appendNull
Description copied from interface:BlockBuilderAppends a null value to the block.- Specified by:
appendNullin interfaceBlockBuilder
-
build
Description copied from interface:BlockBuilderBuilds the block. This method can be called multiple times.- Specified by:
buildin interfaceBlockBuilder
-
toString
-
newBlockBuilderLike
Description copied from interface:BlockBuilderCreates a new block builder of the same type based on the current usage statistics of this block builder.- Specified by:
newBlockBuilderLikein interfaceBlockBuilder
-
ensureHashTableLoaded
protected void ensureHashTableLoaded()- Specified by:
ensureHashTableLoadedin classAbstractMapBlock
-