Package io.trino.spi.block
Interface BlockBuilder
- All Known Implementing Classes:
ArrayBlockBuilder,ByteArrayBlockBuilder,Fixed12BlockBuilder,Int128ArrayBlockBuilder,IntArrayBlockBuilder,LongArrayBlockBuilder,MapBlockBuilder,RowBlockBuilder,ShortArrayBlockBuilder,VariableWidthBlockBuilder
public interface BlockBuilder
-
Method Summary
Modifier and TypeMethodDescriptionvoidappend(ValueBlock block, int position) Append the specified value.Appends a null value to the block.voidappendPositions(ValueBlock block, int[] positions, int offset, int length) Append the values at the specified positions.voidappendRange(ValueBlock block, int offset, int length) Append the values in the specified range.voidappendRepeated(ValueBlock block, int position, int count) Append the specified value multiple times.build()Builds the block.Builds a ValueBlock.intReturns the number of positions in this block builder.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.default BlockBuildernewBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
-
Method Details
-
getPositionCount
int getPositionCount()Returns the number of positions in this block builder. -
getSizeInBytes
long getSizeInBytes()Returns 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. -
getRetainedSizeInBytes
long getRetainedSizeInBytes()Returns the retained size of this block in memory, including over-allocations. This method is called from the innermost execution loop and must be fast. -
append
Append the specified value. -
appendRepeated
Append the specified value multiple times. -
appendRange
Append the values in the specified range. -
appendPositions
Append the values at the specified positions. -
appendNull
BlockBuilder appendNull()Appends a null value to the block. -
build
Block build()Builds the block. This method can be called multiple times. The return value may be a block such as RLE to allow for optimizations when all block values are the same. -
buildValueBlock
ValueBlock buildValueBlock()Builds a ValueBlock. 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
-