Class BinaryBuffer

java.lang.Object
io.trino.parquet.reader.flat.BinaryBuffer

public class BinaryBuffer extends Object
A structure holding lazily populated binary data and offsets array.

The data is stored as a list of Slices that are joined together when needed. This approach performs better if the slices are as big as possible. That is why the cases when the size of the resulting array is known beforehand it is more performant to add a single big byte array to this object rather than add slices one by one. The offset array is compatible with VariableWidthBlock.offsets field, i.e., the first value is always 0 and the last (number of positions + 1) is equal to the last offset + lest position length.

  • Constructor Details

    • BinaryBuffer

      public BinaryBuffer(int valueCount)
  • Method Details

    • withTemporaryOffsets

      public BinaryBuffer withTemporaryOffsets(int offset, int offsetCount)
      Returns a shallow copy of this buffer with empty offsets array. The first offset is set to the value of the last one in the original buffer. It can be used to add data to the original object while offsets land in temporary array
    • add

      public void add(byte[] source, int offset)
    • add

      public void add(io.airlift.slice.Slice slice, int offset)
    • addChunk

      public void addChunk(io.airlift.slice.Slice slice)
    • asSlice

      public io.airlift.slice.Slice asSlice()
    • getOffsets

      public int[] getOffsets()
    • getValueCount

      public int getValueCount()
    • getRetainedSize

      public long getRetainedSize()