Class VariableWidthBlockBuilder
java.lang.Object
io.trino.spi.block.VariableWidthBlockBuilder
- All Implemented Interfaces:
BlockBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionVariableWidthBlockBuilder
(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytes) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(ValueBlock block, int position) Append the specified value.Appends a null value to the block.void
appendPositions
(ValueBlock block, int[] positions, int offset, int length) Append the values at the specified positions.void
appendRange
(ValueBlock block, int offset, int length) Append the values in the specified range.void
appendRepeated
(ValueBlock block, int position, int count) Append the specified value multiple times.build()
Builds the block.Builds a ValueBlock.int
Returns the number of positions in this block builder.long
Returns the retained size of this block in memory, including over-allocations.long
Returns 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.void
resetTo
(int position) Rolls back added data to the specified position.toString()
writeEntry
(byte[] source, int sourceIndex, int length) writeEntry
(io.airlift.slice.Slice source) writeEntry
(io.airlift.slice.Slice source, int sourceIndex, int length) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.trino.spi.block.BlockBuilder
newBlockBuilderLike
-
Constructor Details
-
VariableWidthBlockBuilder
public VariableWidthBlockBuilder(@Nullable BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytes)
-
-
Method Details
-
getPositionCount
public int getPositionCount()Description copied from interface:BlockBuilder
Returns the number of positions in this block builder.- Specified by:
getPositionCount
in interfaceBlockBuilder
-
getSizeInBytes
public long getSizeInBytes()Description copied from interface:BlockBuilder
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.- Specified by:
getSizeInBytes
in interfaceBlockBuilder
-
getRetainedSizeInBytes
public long getRetainedSizeInBytes()Description copied from interface:BlockBuilder
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.- Specified by:
getRetainedSizeInBytes
in interfaceBlockBuilder
-
writeEntry
-
writeEntry
public VariableWidthBlockBuilder writeEntry(io.airlift.slice.Slice source, int sourceIndex, int length) -
writeEntry
-
append
Description copied from interface:BlockBuilder
Append the specified value.- Specified by:
append
in interfaceBlockBuilder
-
appendRepeated
Description copied from interface:BlockBuilder
Append the specified value multiple times.- Specified by:
appendRepeated
in interfaceBlockBuilder
-
appendRange
Description copied from interface:BlockBuilder
Append the values in the specified range.- Specified by:
appendRange
in interfaceBlockBuilder
-
appendPositions
Description copied from interface:BlockBuilder
Append the values at the specified positions.- Specified by:
appendPositions
in interfaceBlockBuilder
-
appendNull
Description copied from interface:BlockBuilder
Appends a null value to the block.- Specified by:
appendNull
in interfaceBlockBuilder
-
resetTo
public void resetTo(int position) Description copied from interface:BlockBuilder
Rolls back added data to the specified position. Resetting may result in a block without nulls with the may-have-nulls flag set. The PageBuilder status will not be updated to reflect the removed data size.- Specified by:
resetTo
in interfaceBlockBuilder
-
build
Description copied from interface:BlockBuilder
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.- Specified by:
build
in interfaceBlockBuilder
-
buildValueBlock
Description copied from interface:BlockBuilder
Builds a ValueBlock. This method can be called multiple times.- Specified by:
buildValueBlock
in interfaceBlockBuilder
-
newBlockBuilderLike
Description copied from interface:BlockBuilder
Creates a new block builder of the same type based on the current usage statistics of this block builder.- Specified by:
newBlockBuilderLike
in interfaceBlockBuilder
-
toString
-