Package io.trino.spi.block
Interface BlockBuilder
- All Superinterfaces:
Block
- All Known Implementing Classes:
ArrayBlockBuilder,ByteArrayBlockBuilder,Fixed12BlockBuilder,Int128ArrayBlockBuilder,IntArrayBlockBuilder,LongArrayBlockBuilder,MapBlockBuilder,RowBlockBuilder,ShortArrayBlockBuilder,SingleArrayBlockWriter,SingleMapBlockWriter,SingleRowBlockWriter,VariableWidthBlockBuilder
-
Method Summary
Modifier and TypeMethodDescriptionAppends a null value to the block.default BlockBuilderReturn a writer to the current entry.build()Builds the block.Close the current entry.default BlockThis method is not expected to be implemented forBlockBuilderimplementations, the methodappendNull()should be used instead.default BlockgetPositions(int[] visiblePositions, int offset, int length) Create a new block from the current materialized block by keeping the same elements only with respect tovisiblePositions.newBlockBuilderLike(int expectedEntries, BlockBuilderStatus blockBuilderStatus) Creates a new block builder of the same type based on the current usage statistics of this block builder.default BlockBuildernewBlockBuilderLike(BlockBuilderStatus blockBuilderStatus) default BlockBuilderwriteByte(int value) Write a byte to the current entry;default BlockBuilderwriteBytes(io.airlift.slice.Slice source, int sourceIndex, int length) Write a byte sequences to the current entry;default BlockBuilderwriteInt(int value) Write a int to the current entry;default BlockBuilderwriteLong(long value) Write a long to the current entry;default BlockBuilderwriteShort(int value) Write a short to the current entry;Methods inherited from interface io.trino.spi.block.Block
bytesCompare, bytesEqual, compareTo, copyPositions, copyRegion, equals, fixedSizeInBytesPerPosition, getByte, getChildren, getEncodingName, getEstimatedDataSizeForStats, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getObject, getPositionCount, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getRetainedSizeInBytes, getShort, getSingleValueBlock, getSizeInBytes, getSlice, getSliceLength, hash, isLoaded, isNull, mayHaveNull, retainedBytesForEachPart, writeBytesTo
-
Method Details
-
writeByte
Write a byte to the current entry; -
writeShort
Write a short to the current entry; -
writeInt
Write a int to the current entry; -
writeLong
Write a long to the current entry; -
writeBytes
Write a byte sequences to the current entry; -
beginBlockEntry
Return 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. -
getPositions
Create a new block from the current materialized block by keeping the same elements only with respect tovisiblePositions.- Specified by:
getPositionsin interfaceBlock
-
closeEntry
BlockBuilder closeEntry()Close the current entry. -
appendNull
BlockBuilder appendNull()Appends a null value to the block. -
build
Block build()Builds the block. This method can be called multiple times. -
newBlockBuilderLike
Creates a new block builder of the same type based on the current usage statistics of this block builder. -
newBlockBuilderLike
-
copyWithAppendedNull
This method is not expected to be implemented forBlockBuilderimplementations, the methodappendNull()should be used instead.- Specified by:
copyWithAppendedNullin interfaceBlock
-