Class AbstractVariableWidthBlock

java.lang.Object
io.trino.spi.block.AbstractVariableWidthBlock
All Implemented Interfaces:
Block
Direct Known Subclasses:
VariableWidthBlock, VariableWidthBlockBuilder

public abstract class AbstractVariableWidthBlock extends Object implements Block
  • Constructor Details

    • AbstractVariableWidthBlock

      public AbstractVariableWidthBlock()
  • Method Details

    • getRawSlice

      protected abstract io.airlift.slice.Slice getRawSlice(int position)
    • getPositionOffset

      protected abstract int getPositionOffset(int position)
    • isEntryNull

      protected abstract boolean isEntryNull(int position)
    • getEncodingName

      public String getEncodingName()
      Description copied from interface: Block
      Get the encoding for this block.
      Specified by:
      getEncodingName in interface Block
    • getByte

      public byte getByte(int position, int offset)
      Description copied from interface: Block
      Gets a byte at offset in the value at position.
      Specified by:
      getByte in interface Block
    • getShort

      public short getShort(int position, int offset)
      Description copied from interface: Block
      Gets a little endian short at offset in the value at position.
      Specified by:
      getShort in interface Block
    • getInt

      public int getInt(int position, int offset)
      Description copied from interface: Block
      Gets a little endian int at offset in the value at position.
      Specified by:
      getInt in interface Block
    • getLong

      public long getLong(int position, int offset)
      Description copied from interface: Block
      Gets a little endian long at offset in the value at position.
      Specified by:
      getLong in interface Block
    • getSlice

      public io.airlift.slice.Slice getSlice(int position, int offset, int length)
      Description copied from interface: Block
      Gets a slice at offset in the value at position.
      Specified by:
      getSlice in interface Block
    • equals

      public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length)
      Description copied from interface: Block
      Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in the value at otherPosition in otherBlock. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      equals in interface Block
    • bytesEqual

      public boolean bytesEqual(int position, int offset, io.airlift.slice.Slice otherSlice, int otherOffset, int length)
      Description copied from interface: Block
      Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in otherSlice. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      bytesEqual in interface Block
    • hash

      public long hash(int position, int offset, int length)
      Description copied from interface: Block
      Calculates the hash code the byte sequences at offset in the value at position. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      hash in interface Block
    • compareTo

      public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
      Description copied from interface: Block
      Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in the value at otherPosition in otherBlock. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      compareTo in interface Block
    • bytesCompare

      public int bytesCompare(int position, int offset, int length, io.airlift.slice.Slice otherSlice, int otherOffset, int otherLength)
      Description copied from interface: Block
      Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in otherSlice. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      bytesCompare in interface Block
    • writeBytesTo

      public void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder)
      Description copied from interface: Block
      Appends the byte sequences at offset in the value at position to blockBuilder. This method must be implemented if @{code getSlice} is implemented.
      Specified by:
      writeBytesTo in interface Block
    • getSingleValueBlock

      public Block getSingleValueBlock(int position)
      Description copied from interface: Block
      Gets the value at the specified position as a single element block. The method must copy the data into a new block.

      This method is useful for operators that hold on to a single value without holding on to the entire block.

      Specified by:
      getSingleValueBlock in interface Block
    • getEstimatedDataSizeForStats

      public long getEstimatedDataSizeForStats(int position)
      Description copied from interface: Block
      Returns the estimated in memory data size for stats of position. Do not use it for other purpose.
      Specified by:
      getEstimatedDataSizeForStats in interface Block
    • isNull

      public boolean isNull(int position)
      Description copied from interface: Block
      Is the specified position null?
      Specified by:
      isNull in interface Block