Package io.trino.spi.block
Class SingleArrayBlockWriter
java.lang.Object
io.trino.spi.block.AbstractSingleArrayBlock
io.trino.spi.block.SingleArrayBlockWriter
- All Implemented Interfaces:
Block,BlockBuilder
-
Field Summary
Fields inherited from class io.trino.spi.block.AbstractSingleArrayBlock
start -
Constructor Summary
Constructors -
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.Returns the number of bytes (in terms ofBlock.getSizeInBytes()) required per position that this block contains, assuming that the number of bytes required is a known static quantity and not dependent on any particular specific position.protected BlockgetBlock()intReturns the number of positions in this block.longReturns 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.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.toString()writeByte(int value) Write a byte to the current entry;writeBytes(io.airlift.slice.Slice source, int sourceIndex, int length) Write a byte sequences to the current entry;writeInt(int value) Write a int to the current entry;writeLong(long value) Write a long to the current entry;writeShort(int value) Write a short to the current entry;Methods inherited from class io.trino.spi.block.AbstractSingleArrayBlock
bytesCompare, bytesEqual, compareTo, copyPositions, copyRegion, equals, getByte, getChildren, getEncodingName, getEstimatedDataSizeForStats, getInt, getLong, getObject, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isNull, writeBytesToMethods 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, getByte, getChildren, getEncodingName, getEstimatedDataSizeForStats, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getObject, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isLoaded, isNull, mayHaveNull, writeBytesToMethods inherited from interface io.trino.spi.block.BlockBuilder
copyWithAppendedNull, getPositions, newBlockBuilderLike
-
Constructor Details
-
SingleArrayBlockWriter
-
-
Method Details
-
getBlock
- Specified by:
getBlockin classAbstractSingleArrayBlock
-
fixedSizeInBytesPerPosition
Description copied from interface:BlockReturns the number of bytes (in terms ofBlock.getSizeInBytes()) required per position that this block contains, assuming that the number of bytes required is a known static quantity and not dependent on any particular specific position. This allows for some complex block wrappings to potentially avoid having to callBlock.getPositionsSizeInBytes(boolean[], int)which would require computing the specific positions selected- Specified by:
fixedSizeInBytesPerPositionin interfaceBlock- Returns:
- The size in bytes, per position, if this block type does not require specific position information to compute its size
-
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
-
writeByte
Description copied from interface:BlockBuilderWrite a byte to the current entry;- Specified by:
writeBytein interfaceBlockBuilder
-
writeShort
Description copied from interface:BlockBuilderWrite a short to the current entry;- Specified by:
writeShortin interfaceBlockBuilder
-
writeInt
Description copied from interface:BlockBuilderWrite a int to the current entry;- Specified by:
writeIntin interfaceBlockBuilder
-
writeLong
Description copied from interface:BlockBuilderWrite a long to the current entry;- Specified by:
writeLongin interfaceBlockBuilder
-
writeBytes
Description copied from interface:BlockBuilderWrite a byte sequences to the current entry;- Specified by:
writeBytesin interfaceBlockBuilder
-
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
-
appendNull
Description copied from interface:BlockBuilderAppends a null value to the block.- Specified by:
appendNullin interfaceBlockBuilder
-
closeEntry
Description copied from interface:BlockBuilderClose the current entry.- Specified by:
closeEntryin interfaceBlockBuilder
-
getPositionCount
public int getPositionCount()Description copied from interface:BlockReturns the number of positions in this block.- Specified by:
getPositionCountin interfaceBlock
-
build
Description copied from interface:BlockBuilderBuilds the block. This method can be called multiple times.- Specified by:
buildin interfaceBlockBuilder
-
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
-
toString
-