Class ValuesReader

java.lang.Object
org.apache.parquet.column.values.ValuesReader
Direct Known Subclasses:
BinaryPlainValuesReader, BitPackingValuesReader, BooleanPlainValuesReader, ByteBitPackingValuesReader, ByteStreamSplitValuesReader, DeltaBinaryPackingValuesReader, DeltaByteArrayReader, DeltaLengthByteArrayValuesReader, DictionaryValuesReader, FixedLenByteArrayPlainValuesReader, PlainValuesReader, RunLengthBitPackingHybridValuesReader, ZeroIntegerValuesReader

public abstract class ValuesReader extends Object
Base class to implement an encoding for a given column type.

A ValuesReader is provided with a page (byte-buffer) and is responsible for deserializing the primitive values stored in that page.

Given that pages are homogeneous (store only a single type), typical subclasses will only override one of the read*() methods.

  • Constructor Details

    • ValuesReader

      public ValuesReader()
  • Method Details

    • initFromPage

      @Deprecated public void initFromPage(int valueCount, ByteBuffer page, int offset) throws IOException
      Deprecated.
      Will be removed in 2.0.0
      Called to initialize the column reader from a part of a page.

      The underlying implementation knows how much data to read, so a length is not provided.

      Each page may contain several sections:

      • repetition levels column
      • definition levels column
      • data column

      This function is called with 'offset' pointing to the beginning of one of these sections, and should return the offset to the section following it.

      Parameters:
      valueCount - count of values in this page
      page - the array to read from containing the page data (repetition levels, definition levels, data)
      offset - where to start reading from in the page
      Throws:
      IOException
    • initFromPage

      @Deprecated public void initFromPage(int valueCount, byte[] page, int offset) throws IOException
      Deprecated.
      Same functionality as method of the same name that takes a ByteBuffer instead of a byte[].

      This method is only provided for backward compatibility and will be removed in a future release. Please update any code using it as soon as possible.

      Throws:
      IOException
      See Also:
    • initFromPage

      public void initFromPage(int valueCount, org.apache.parquet.bytes.ByteBufferInputStream in) throws IOException
      Called to initialize the column reader from a part of a page.

      Implementations must consume all bytes from the input stream, leaving the stream ready to read the next section of data. The underlying implementation knows how much data to read, so a length is not provided.

      Each page may contain several sections:

      • repetition levels column
      • definition levels column
      • data column
      Parameters:
      valueCount - count of values in this page
      in - an input stream containing the page data at the correct offset
      Throws:
      IOException - if there is an exception while reading from the input stream
    • getNextOffset

      @Deprecated public int getNextOffset()
      Deprecated.
      Will be removed in 2.0.0
      Called to return offset of the next section
      Returns:
      offset of the next section
    • updateNextOffset

      protected void updateNextOffset(int bytesRead)
    • readValueDictionaryId

      public int readValueDictionaryId()
      usable when the encoding is dictionary based
      Returns:
      the id of the next value from the page
    • readBoolean

      public boolean readBoolean()
      Returns:
      the next boolean from the page
    • readBytes

      public Binary readBytes()
      Returns:
      the next Binary from the page
    • readFloat

      public float readFloat()
      Returns:
      the next float from the page
    • readDouble

      public double readDouble()
      Returns:
      the next double from the page
    • readInteger

      public int readInteger()
      Returns:
      the next integer from the page
    • readLong

      public long readLong()
      Returns:
      the next long from the page
    • skip

      public abstract void skip()
      Skips the next value in the page
    • skip

      public void skip(int n)
      Skips the next n values in the page
      Parameters:
      n - the number of values to be skipped