Class VariableWidthBlockBuilder

java.lang.Object
io.trino.spi.block.VariableWidthBlockBuilder
All Implemented Interfaces:
BlockBuilder

public class VariableWidthBlockBuilder extends Object implements BlockBuilder
  • 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 interface BlockBuilder
    • 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 interface BlockBuilder
    • 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 interface BlockBuilder
    • writeEntry

      public VariableWidthBlockBuilder writeEntry(io.airlift.slice.Slice source)
    • writeEntry

      public VariableWidthBlockBuilder writeEntry(io.airlift.slice.Slice source, int sourceIndex, int length)
    • writeEntry

      public VariableWidthBlockBuilder writeEntry(byte[] source, int sourceIndex, int length)
    • append

      public void append(ValueBlock block, int position)
      Description copied from interface: BlockBuilder
      Append the specified value.
      Specified by:
      append in interface BlockBuilder
    • appendRepeated

      public void appendRepeated(ValueBlock block, int position, int count)
      Description copied from interface: BlockBuilder
      Append the specified value multiple times.
      Specified by:
      appendRepeated in interface BlockBuilder
    • appendRange

      public void appendRange(ValueBlock block, int offset, int length)
      Description copied from interface: BlockBuilder
      Append the values in the specified range.
      Specified by:
      appendRange in interface BlockBuilder
    • appendPositions

      public void appendPositions(ValueBlock block, int[] positions, int offset, int length)
      Description copied from interface: BlockBuilder
      Append the values at the specified positions.
      Specified by:
      appendPositions in interface BlockBuilder
    • appendNull

      public BlockBuilder appendNull()
      Description copied from interface: BlockBuilder
      Appends a null value to the block.
      Specified by:
      appendNull in interface BlockBuilder
    • 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 interface BlockBuilder
    • build

      public Block 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 interface BlockBuilder
    • buildValueBlock

      public VariableWidthBlock buildValueBlock()
      Description copied from interface: BlockBuilder
      Builds a ValueBlock. This method can be called multiple times.
      Specified by:
      buildValueBlock in interface BlockBuilder
    • newBlockBuilderLike

      public BlockBuilder newBlockBuilderLike(int expectedEntries, BlockBuilderStatus blockBuilderStatus)
      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 interface BlockBuilder
    • toString

      public String toString()
      Overrides:
      toString in class Object