Class OffsetIndexBuilder

java.lang.Object
org.apache.parquet.internal.column.columnindex.OffsetIndexBuilder

public class OffsetIndexBuilder extends Object
Builder implementation to create OffsetIndex objects during writing a parquet file.
  • Method Details

    • getNoOpBuilder

      public static OffsetIndexBuilder getNoOpBuilder()
      Returns:
      a no-op builder that does not collect values and therefore returns null at build(long)
    • getBuilder

      public static OffsetIndexBuilder getBuilder()
      Returns:
      an OffsetIndexBuilder instance to build an OffsetIndex object
    • add

      public void add(int compressedPageSize, long rowCount)
      Adds the specified parameters to this builder. Used by the writers to building up OffsetIndex objects to be written to the Parquet file.
      Parameters:
      compressedPageSize - the size of the page (including header)
      rowCount - the number of rows in the page
    • add

      public void add(int compressedPageSize, long rowCount, Optional<Long> unencodedDataBytes)
      Adds the specified parameters to this builder. Used by the writers to building up OffsetIndex objects to be written to the Parquet file.
      Parameters:
      compressedPageSize - the size of the page (including header)
      rowCount - the number of rows in the page
      unencodedDataBytes - the number of bytes of unencoded data of BYTE_ARRAY type
    • add

      public void add(long offset, int compressedPageSize, long firstRowIndex)
      Adds the specified parameters to this builder. Used by the metadata converter to building up OffsetIndex objects read from the Parquet file.
      Parameters:
      offset - the offset of the page in the file
      compressedPageSize - the size of the page (including header)
      firstRowIndex - the index of the first row in the page (within the row group)
    • add

      public void add(long offset, int compressedPageSize, long firstRowIndex, Optional<Long> unencodedDataBytes)
      Adds the specified parameters to this builder. Used by the metadata converter to building up OffsetIndex objects read from the Parquet file.
      Parameters:
      offset - the offset of the page in the file
      compressedPageSize - the size of the page (including header)
      firstRowIndex - the index of the first row in the page (within the row group)
      unencodedDataBytes - the number of bytes of unencoded data of BYTE_ARRAY type
    • build

      public OffsetIndex build()
      Builds the offset index. Used by the metadata converter to building up OffsetIndex objects read from the Parquet file.
      Returns:
      the newly created offset index or null if the OffsetIndex object would be empty
    • fromOffsetIndex

      public OffsetIndexBuilder fromOffsetIndex(OffsetIndex offsetIndex)
    • build

      public OffsetIndex build(long shift)
      Builds the offset index. Used by the writers to building up OffsetIndex objects to be written to the Parquet file.
      Parameters:
      shift - how much to be shifted away
      Returns:
      the newly created offset index or null if the OffsetIndex object would be empty