All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.parquet.format.PageHeader Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.13.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.parquet.format;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-09-30")
public class PageHeader implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PageHeader");

  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField UNCOMPRESSED_PAGE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("uncompressed_page_size", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField COMPRESSED_PAGE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("compressed_page_size", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField CRC_FIELD_DESC = new org.apache.thrift.protocol.TField("crc", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField DATA_PAGE_HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("data_page_header", org.apache.thrift.protocol.TType.STRUCT, (short)5);
  private static final org.apache.thrift.protocol.TField INDEX_PAGE_HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("index_page_header", org.apache.thrift.protocol.TType.STRUCT, (short)6);
  private static final org.apache.thrift.protocol.TField DICTIONARY_PAGE_HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("dictionary_page_header", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField DATA_PAGE_HEADER_V2_FIELD_DESC = new org.apache.thrift.protocol.TField("data_page_header_v2", org.apache.thrift.protocol.TType.STRUCT, (short)8);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new PageHeaderStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new PageHeaderTupleSchemeFactory();

  /**
   * the type of the page: indicates which of the *_header fields is set *
   * 
   * @see PageType
   */
  public @org.apache.thrift.annotation.Nullable PageType type; // required
  /**
   * Uncompressed page size in bytes (not including this header) *
   */
  public int uncompressed_page_size; // required
  /**
   * Compressed (and potentially encrypted) page size in bytes, not including this header *
   */
  public int compressed_page_size; // required
  /**
   * The 32bit CRC for the page, to be be calculated as follows:
   * - Using the standard CRC32 algorithm
   * - On the data only, i.e. this header should not be included. 'Data'
   *   hereby refers to the concatenation of the repetition levels, the
   *   definition levels and the column value, in this exact order.
   * - On the encoded versions of the repetition levels, definition levels and
   *   column values
   * - On the compressed versions of the repetition levels, definition levels
   *   and column values where possible;
   *   - For v1 data pages, the repetition levels, definition levels and column
   *     values are always compressed together. If a compression scheme is
   *     specified, the CRC shall be calculated on the compressed version of
   *     this concatenation. If no compression scheme is specified, the CRC
   *     shall be calculated on the uncompressed version of this concatenation.
   *   - For v2 data pages, the repetition levels and definition levels are
   *     handled separately from the data and are never compressed (only
   *     encoded). If a compression scheme is specified, the CRC shall be
   *     calculated on the concatenation of the uncompressed repetition levels,
   *     uncompressed definition levels and the compressed column values.
   *     If no compression scheme is specified, the CRC shall be calculated on
   *     the uncompressed concatenation.
   * If enabled, this allows for disabling checksumming in HDFS if only a few
   * pages need to be read.
   * 
   */
  public int crc; // optional
  public @org.apache.thrift.annotation.Nullable DataPageHeader data_page_header; // optional
  public @org.apache.thrift.annotation.Nullable IndexPageHeader index_page_header; // optional
  public @org.apache.thrift.annotation.Nullable DictionaryPageHeader dictionary_page_header; // optional
  public @org.apache.thrift.annotation.Nullable DataPageHeaderV2 data_page_header_v2; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     * the type of the page: indicates which of the *_header fields is set *
     * 
     * @see PageType
     */
    TYPE((short)1, "type"),
    /**
     * Uncompressed page size in bytes (not including this header) *
     */
    UNCOMPRESSED_PAGE_SIZE((short)2, "uncompressed_page_size"),
    /**
     * Compressed (and potentially encrypted) page size in bytes, not including this header *
     */
    COMPRESSED_PAGE_SIZE((short)3, "compressed_page_size"),
    /**
     * The 32bit CRC for the page, to be be calculated as follows:
     * - Using the standard CRC32 algorithm
     * - On the data only, i.e. this header should not be included. 'Data'
     *   hereby refers to the concatenation of the repetition levels, the
     *   definition levels and the column value, in this exact order.
     * - On the encoded versions of the repetition levels, definition levels and
     *   column values
     * - On the compressed versions of the repetition levels, definition levels
     *   and column values where possible;
     *   - For v1 data pages, the repetition levels, definition levels and column
     *     values are always compressed together. If a compression scheme is
     *     specified, the CRC shall be calculated on the compressed version of
     *     this concatenation. If no compression scheme is specified, the CRC
     *     shall be calculated on the uncompressed version of this concatenation.
     *   - For v2 data pages, the repetition levels and definition levels are
     *     handled separately from the data and are never compressed (only
     *     encoded). If a compression scheme is specified, the CRC shall be
     *     calculated on the concatenation of the uncompressed repetition levels,
     *     uncompressed definition levels and the compressed column values.
     *     If no compression scheme is specified, the CRC shall be calculated on
     *     the uncompressed concatenation.
     * If enabled, this allows for disabling checksumming in HDFS if only a few
     * pages need to be read.
     * 
     */
    CRC((short)4, "crc"),
    DATA_PAGE_HEADER((short)5, "data_page_header"),
    INDEX_PAGE_HEADER((short)6, "index_page_header"),
    DICTIONARY_PAGE_HEADER((short)7, "dictionary_page_header"),
    DATA_PAGE_HEADER_V2((short)8, "data_page_header_v2");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // TYPE
          return TYPE;
        case 2: // UNCOMPRESSED_PAGE_SIZE
          return UNCOMPRESSED_PAGE_SIZE;
        case 3: // COMPRESSED_PAGE_SIZE
          return COMPRESSED_PAGE_SIZE;
        case 4: // CRC
          return CRC;
        case 5: // DATA_PAGE_HEADER
          return DATA_PAGE_HEADER;
        case 6: // INDEX_PAGE_HEADER
          return INDEX_PAGE_HEADER;
        case 7: // DICTIONARY_PAGE_HEADER
          return DICTIONARY_PAGE_HEADER;
        case 8: // DATA_PAGE_HEADER_V2
          return DATA_PAGE_HEADER_V2;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __UNCOMPRESSED_PAGE_SIZE_ISSET_ID = 0;
  private static final int __COMPRESSED_PAGE_SIZE_ISSET_ID = 1;
  private static final int __CRC_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.CRC,_Fields.DATA_PAGE_HEADER,_Fields.INDEX_PAGE_HEADER,_Fields.DICTIONARY_PAGE_HEADER,_Fields.DATA_PAGE_HEADER_V2};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PageType.class)));
    tmpMap.put(_Fields.UNCOMPRESSED_PAGE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("uncompressed_page_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.COMPRESSED_PAGE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("compressed_page_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.CRC, new org.apache.thrift.meta_data.FieldMetaData("crc", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.DATA_PAGE_HEADER, new org.apache.thrift.meta_data.FieldMetaData("data_page_header", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataPageHeader.class)));
    tmpMap.put(_Fields.INDEX_PAGE_HEADER, new org.apache.thrift.meta_data.FieldMetaData("index_page_header", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IndexPageHeader.class)));
    tmpMap.put(_Fields.DICTIONARY_PAGE_HEADER, new org.apache.thrift.meta_data.FieldMetaData("dictionary_page_header", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DictionaryPageHeader.class)));
    tmpMap.put(_Fields.DATA_PAGE_HEADER_V2, new org.apache.thrift.meta_data.FieldMetaData("data_page_header_v2", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataPageHeaderV2.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PageHeader.class, metaDataMap);
  }

  public PageHeader() {
  }

  public PageHeader(
    PageType type,
    int uncompressed_page_size,
    int compressed_page_size)
  {
    this();
    this.type = type;
    this.uncompressed_page_size = uncompressed_page_size;
    setUncompressed_page_sizeIsSet(true);
    this.compressed_page_size = compressed_page_size;
    setCompressed_page_sizeIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public PageHeader(PageHeader other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetType()) {
      this.type = other.type;
    }
    this.uncompressed_page_size = other.uncompressed_page_size;
    this.compressed_page_size = other.compressed_page_size;
    this.crc = other.crc;
    if (other.isSetData_page_header()) {
      this.data_page_header = new DataPageHeader(other.data_page_header);
    }
    if (other.isSetIndex_page_header()) {
      this.index_page_header = new IndexPageHeader(other.index_page_header);
    }
    if (other.isSetDictionary_page_header()) {
      this.dictionary_page_header = new DictionaryPageHeader(other.dictionary_page_header);
    }
    if (other.isSetData_page_header_v2()) {
      this.data_page_header_v2 = new DataPageHeaderV2(other.data_page_header_v2);
    }
  }

  public PageHeader deepCopy() {
    return new PageHeader(this);
  }

  @Override
  public void clear() {
    this.type = null;
    setUncompressed_page_sizeIsSet(false);
    this.uncompressed_page_size = 0;
    setCompressed_page_sizeIsSet(false);
    this.compressed_page_size = 0;
    setCrcIsSet(false);
    this.crc = 0;
    this.data_page_header = null;
    this.index_page_header = null;
    this.dictionary_page_header = null;
    this.data_page_header_v2 = null;
  }

  /**
   * the type of the page: indicates which of the *_header fields is set *
   * 
   * @see PageType
   */
  @org.apache.thrift.annotation.Nullable
  public PageType getType() {
    return this.type;
  }

  /**
   * the type of the page: indicates which of the *_header fields is set *
   * 
   * @see PageType
   */
  public PageHeader setType(@org.apache.thrift.annotation.Nullable PageType type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

  /** Returns true if field type is set (has been assigned a value) and false otherwise */
  public boolean isSetType() {
    return this.type != null;
  }

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  /**
   * Uncompressed page size in bytes (not including this header) *
   */
  public int getUncompressed_page_size() {
    return this.uncompressed_page_size;
  }

  /**
   * Uncompressed page size in bytes (not including this header) *
   */
  public PageHeader setUncompressed_page_size(int uncompressed_page_size) {
    this.uncompressed_page_size = uncompressed_page_size;
    setUncompressed_page_sizeIsSet(true);
    return this;
  }

  public void unsetUncompressed_page_size() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __UNCOMPRESSED_PAGE_SIZE_ISSET_ID);
  }

  /** Returns true if field uncompressed_page_size is set (has been assigned a value) and false otherwise */
  public boolean isSetUncompressed_page_size() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __UNCOMPRESSED_PAGE_SIZE_ISSET_ID);
  }

  public void setUncompressed_page_sizeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __UNCOMPRESSED_PAGE_SIZE_ISSET_ID, value);
  }

  /**
   * Compressed (and potentially encrypted) page size in bytes, not including this header *
   */
  public int getCompressed_page_size() {
    return this.compressed_page_size;
  }

  /**
   * Compressed (and potentially encrypted) page size in bytes, not including this header *
   */
  public PageHeader setCompressed_page_size(int compressed_page_size) {
    this.compressed_page_size = compressed_page_size;
    setCompressed_page_sizeIsSet(true);
    return this;
  }

  public void unsetCompressed_page_size() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID);
  }

  /** Returns true if field compressed_page_size is set (has been assigned a value) and false otherwise */
  public boolean isSetCompressed_page_size() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID);
  }

  public void setCompressed_page_sizeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID, value);
  }

  /**
   * The 32bit CRC for the page, to be be calculated as follows:
   * - Using the standard CRC32 algorithm
   * - On the data only, i.e. this header should not be included. 'Data'
   *   hereby refers to the concatenation of the repetition levels, the
   *   definition levels and the column value, in this exact order.
   * - On the encoded versions of the repetition levels, definition levels and
   *   column values
   * - On the compressed versions of the repetition levels, definition levels
   *   and column values where possible;
   *   - For v1 data pages, the repetition levels, definition levels and column
   *     values are always compressed together. If a compression scheme is
   *     specified, the CRC shall be calculated on the compressed version of
   *     this concatenation. If no compression scheme is specified, the CRC
   *     shall be calculated on the uncompressed version of this concatenation.
   *   - For v2 data pages, the repetition levels and definition levels are
   *     handled separately from the data and are never compressed (only
   *     encoded). If a compression scheme is specified, the CRC shall be
   *     calculated on the concatenation of the uncompressed repetition levels,
   *     uncompressed definition levels and the compressed column values.
   *     If no compression scheme is specified, the CRC shall be calculated on
   *     the uncompressed concatenation.
   * If enabled, this allows for disabling checksumming in HDFS if only a few
   * pages need to be read.
   * 
   */
  public int getCrc() {
    return this.crc;
  }

  /**
   * The 32bit CRC for the page, to be be calculated as follows:
   * - Using the standard CRC32 algorithm
   * - On the data only, i.e. this header should not be included. 'Data'
   *   hereby refers to the concatenation of the repetition levels, the
   *   definition levels and the column value, in this exact order.
   * - On the encoded versions of the repetition levels, definition levels and
   *   column values
   * - On the compressed versions of the repetition levels, definition levels
   *   and column values where possible;
   *   - For v1 data pages, the repetition levels, definition levels and column
   *     values are always compressed together. If a compression scheme is
   *     specified, the CRC shall be calculated on the compressed version of
   *     this concatenation. If no compression scheme is specified, the CRC
   *     shall be calculated on the uncompressed version of this concatenation.
   *   - For v2 data pages, the repetition levels and definition levels are
   *     handled separately from the data and are never compressed (only
   *     encoded). If a compression scheme is specified, the CRC shall be
   *     calculated on the concatenation of the uncompressed repetition levels,
   *     uncompressed definition levels and the compressed column values.
   *     If no compression scheme is specified, the CRC shall be calculated on
   *     the uncompressed concatenation.
   * If enabled, this allows for disabling checksumming in HDFS if only a few
   * pages need to be read.
   * 
   */
  public PageHeader setCrc(int crc) {
    this.crc = crc;
    setCrcIsSet(true);
    return this;
  }

  public void unsetCrc() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CRC_ISSET_ID);
  }

  /** Returns true if field crc is set (has been assigned a value) and false otherwise */
  public boolean isSetCrc() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CRC_ISSET_ID);
  }

  public void setCrcIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CRC_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public DataPageHeader getData_page_header() {
    return this.data_page_header;
  }

  public PageHeader setData_page_header(@org.apache.thrift.annotation.Nullable DataPageHeader data_page_header) {
    this.data_page_header = data_page_header;
    return this;
  }

  public void unsetData_page_header() {
    this.data_page_header = null;
  }

  /** Returns true if field data_page_header is set (has been assigned a value) and false otherwise */
  public boolean isSetData_page_header() {
    return this.data_page_header != null;
  }

  public void setData_page_headerIsSet(boolean value) {
    if (!value) {
      this.data_page_header = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public IndexPageHeader getIndex_page_header() {
    return this.index_page_header;
  }

  public PageHeader setIndex_page_header(@org.apache.thrift.annotation.Nullable IndexPageHeader index_page_header) {
    this.index_page_header = index_page_header;
    return this;
  }

  public void unsetIndex_page_header() {
    this.index_page_header = null;
  }

  /** Returns true if field index_page_header is set (has been assigned a value) and false otherwise */
  public boolean isSetIndex_page_header() {
    return this.index_page_header != null;
  }

  public void setIndex_page_headerIsSet(boolean value) {
    if (!value) {
      this.index_page_header = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public DictionaryPageHeader getDictionary_page_header() {
    return this.dictionary_page_header;
  }

  public PageHeader setDictionary_page_header(@org.apache.thrift.annotation.Nullable DictionaryPageHeader dictionary_page_header) {
    this.dictionary_page_header = dictionary_page_header;
    return this;
  }

  public void unsetDictionary_page_header() {
    this.dictionary_page_header = null;
  }

  /** Returns true if field dictionary_page_header is set (has been assigned a value) and false otherwise */
  public boolean isSetDictionary_page_header() {
    return this.dictionary_page_header != null;
  }

  public void setDictionary_page_headerIsSet(boolean value) {
    if (!value) {
      this.dictionary_page_header = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public DataPageHeaderV2 getData_page_header_v2() {
    return this.data_page_header_v2;
  }

  public PageHeader setData_page_header_v2(@org.apache.thrift.annotation.Nullable DataPageHeaderV2 data_page_header_v2) {
    this.data_page_header_v2 = data_page_header_v2;
    return this;
  }

  public void unsetData_page_header_v2() {
    this.data_page_header_v2 = null;
  }

  /** Returns true if field data_page_header_v2 is set (has been assigned a value) and false otherwise */
  public boolean isSetData_page_header_v2() {
    return this.data_page_header_v2 != null;
  }

  public void setData_page_header_v2IsSet(boolean value) {
    if (!value) {
      this.data_page_header_v2 = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((PageType)value);
      }
      break;

    case UNCOMPRESSED_PAGE_SIZE:
      if (value == null) {
        unsetUncompressed_page_size();
      } else {
        setUncompressed_page_size((java.lang.Integer)value);
      }
      break;

    case COMPRESSED_PAGE_SIZE:
      if (value == null) {
        unsetCompressed_page_size();
      } else {
        setCompressed_page_size((java.lang.Integer)value);
      }
      break;

    case CRC:
      if (value == null) {
        unsetCrc();
      } else {
        setCrc((java.lang.Integer)value);
      }
      break;

    case DATA_PAGE_HEADER:
      if (value == null) {
        unsetData_page_header();
      } else {
        setData_page_header((DataPageHeader)value);
      }
      break;

    case INDEX_PAGE_HEADER:
      if (value == null) {
        unsetIndex_page_header();
      } else {
        setIndex_page_header((IndexPageHeader)value);
      }
      break;

    case DICTIONARY_PAGE_HEADER:
      if (value == null) {
        unsetDictionary_page_header();
      } else {
        setDictionary_page_header((DictionaryPageHeader)value);
      }
      break;

    case DATA_PAGE_HEADER_V2:
      if (value == null) {
        unsetData_page_header_v2();
      } else {
        setData_page_header_v2((DataPageHeaderV2)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case UNCOMPRESSED_PAGE_SIZE:
      return getUncompressed_page_size();

    case COMPRESSED_PAGE_SIZE:
      return getCompressed_page_size();

    case CRC:
      return getCrc();

    case DATA_PAGE_HEADER:
      return getData_page_header();

    case INDEX_PAGE_HEADER:
      return getIndex_page_header();

    case DICTIONARY_PAGE_HEADER:
      return getDictionary_page_header();

    case DATA_PAGE_HEADER_V2:
      return getData_page_header_v2();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case TYPE:
      return isSetType();
    case UNCOMPRESSED_PAGE_SIZE:
      return isSetUncompressed_page_size();
    case COMPRESSED_PAGE_SIZE:
      return isSetCompressed_page_size();
    case CRC:
      return isSetCrc();
    case DATA_PAGE_HEADER:
      return isSetData_page_header();
    case INDEX_PAGE_HEADER:
      return isSetIndex_page_header();
    case DICTIONARY_PAGE_HEADER:
      return isSetDictionary_page_header();
    case DATA_PAGE_HEADER_V2:
      return isSetData_page_header_v2();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that == null)
      return false;
    if (that instanceof PageHeader)
      return this.equals((PageHeader)that);
    return false;
  }

  public boolean equals(PageHeader that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_uncompressed_page_size = true;
    boolean that_present_uncompressed_page_size = true;
    if (this_present_uncompressed_page_size || that_present_uncompressed_page_size) {
      if (!(this_present_uncompressed_page_size && that_present_uncompressed_page_size))
        return false;
      if (this.uncompressed_page_size != that.uncompressed_page_size)
        return false;
    }

    boolean this_present_compressed_page_size = true;
    boolean that_present_compressed_page_size = true;
    if (this_present_compressed_page_size || that_present_compressed_page_size) {
      if (!(this_present_compressed_page_size && that_present_compressed_page_size))
        return false;
      if (this.compressed_page_size != that.compressed_page_size)
        return false;
    }

    boolean this_present_crc = true && this.isSetCrc();
    boolean that_present_crc = true && that.isSetCrc();
    if (this_present_crc || that_present_crc) {
      if (!(this_present_crc && that_present_crc))
        return false;
      if (this.crc != that.crc)
        return false;
    }

    boolean this_present_data_page_header = true && this.isSetData_page_header();
    boolean that_present_data_page_header = true && that.isSetData_page_header();
    if (this_present_data_page_header || that_present_data_page_header) {
      if (!(this_present_data_page_header && that_present_data_page_header))
        return false;
      if (!this.data_page_header.equals(that.data_page_header))
        return false;
    }

    boolean this_present_index_page_header = true && this.isSetIndex_page_header();
    boolean that_present_index_page_header = true && that.isSetIndex_page_header();
    if (this_present_index_page_header || that_present_index_page_header) {
      if (!(this_present_index_page_header && that_present_index_page_header))
        return false;
      if (!this.index_page_header.equals(that.index_page_header))
        return false;
    }

    boolean this_present_dictionary_page_header = true && this.isSetDictionary_page_header();
    boolean that_present_dictionary_page_header = true && that.isSetDictionary_page_header();
    if (this_present_dictionary_page_header || that_present_dictionary_page_header) {
      if (!(this_present_dictionary_page_header && that_present_dictionary_page_header))
        return false;
      if (!this.dictionary_page_header.equals(that.dictionary_page_header))
        return false;
    }

    boolean this_present_data_page_header_v2 = true && this.isSetData_page_header_v2();
    boolean that_present_data_page_header_v2 = true && that.isSetData_page_header_v2();
    if (this_present_data_page_header_v2 || that_present_data_page_header_v2) {
      if (!(this_present_data_page_header_v2 && that_present_data_page_header_v2))
        return false;
      if (!this.data_page_header_v2.equals(that.data_page_header_v2))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + uncompressed_page_size;

    hashCode = hashCode * 8191 + compressed_page_size;

    hashCode = hashCode * 8191 + ((isSetCrc()) ? 131071 : 524287);
    if (isSetCrc())
      hashCode = hashCode * 8191 + crc;

    hashCode = hashCode * 8191 + ((isSetData_page_header()) ? 131071 : 524287);
    if (isSetData_page_header())
      hashCode = hashCode * 8191 + data_page_header.hashCode();

    hashCode = hashCode * 8191 + ((isSetIndex_page_header()) ? 131071 : 524287);
    if (isSetIndex_page_header())
      hashCode = hashCode * 8191 + index_page_header.hashCode();

    hashCode = hashCode * 8191 + ((isSetDictionary_page_header()) ? 131071 : 524287);
    if (isSetDictionary_page_header())
      hashCode = hashCode * 8191 + dictionary_page_header.hashCode();

    hashCode = hashCode * 8191 + ((isSetData_page_header_v2()) ? 131071 : 524287);
    if (isSetData_page_header_v2())
      hashCode = hashCode * 8191 + data_page_header_v2.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(PageHeader other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetType()).compareTo(other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetUncompressed_page_size()).compareTo(other.isSetUncompressed_page_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUncompressed_page_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uncompressed_page_size, other.uncompressed_page_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetCompressed_page_size()).compareTo(other.isSetCompressed_page_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCompressed_page_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compressed_page_size, other.compressed_page_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetCrc()).compareTo(other.isSetCrc());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCrc()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.crc, other.crc);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetData_page_header()).compareTo(other.isSetData_page_header());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetData_page_header()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_page_header, other.data_page_header);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetIndex_page_header()).compareTo(other.isSetIndex_page_header());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndex_page_header()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_page_header, other.index_page_header);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetDictionary_page_header()).compareTo(other.isSetDictionary_page_header());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDictionary_page_header()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dictionary_page_header, other.dictionary_page_header);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetData_page_header_v2()).compareTo(other.isSetData_page_header_v2());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetData_page_header_v2()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_page_header_v2, other.data_page_header_v2);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("PageHeader(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("uncompressed_page_size:");
    sb.append(this.uncompressed_page_size);
    first = false;
    if (!first) sb.append(", ");
    sb.append("compressed_page_size:");
    sb.append(this.compressed_page_size);
    first = false;
    if (isSetCrc()) {
      if (!first) sb.append(", ");
      sb.append("crc:");
      sb.append(this.crc);
      first = false;
    }
    if (isSetData_page_header()) {
      if (!first) sb.append(", ");
      sb.append("data_page_header:");
      if (this.data_page_header == null) {
        sb.append("null");
      } else {
        sb.append(this.data_page_header);
      }
      first = false;
    }
    if (isSetIndex_page_header()) {
      if (!first) sb.append(", ");
      sb.append("index_page_header:");
      if (this.index_page_header == null) {
        sb.append("null");
      } else {
        sb.append(this.index_page_header);
      }
      first = false;
    }
    if (isSetDictionary_page_header()) {
      if (!first) sb.append(", ");
      sb.append("dictionary_page_header:");
      if (this.dictionary_page_header == null) {
        sb.append("null");
      } else {
        sb.append(this.dictionary_page_header);
      }
      first = false;
    }
    if (isSetData_page_header_v2()) {
      if (!first) sb.append(", ");
      sb.append("data_page_header_v2:");
      if (this.data_page_header_v2 == null) {
        sb.append("null");
      } else {
        sb.append(this.data_page_header_v2);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'uncompressed_page_size' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'compressed_page_size' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
    if (data_page_header != null) {
      data_page_header.validate();
    }
    if (index_page_header != null) {
      index_page_header.validate();
    }
    if (dictionary_page_header != null) {
      dictionary_page_header.validate();
    }
    if (data_page_header_v2 != null) {
      data_page_header_v2.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class PageHeaderStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public PageHeaderStandardScheme getScheme() {
      return new PageHeaderStandardScheme();
    }
  }

  private static class PageHeaderStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, PageHeader struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.parquet.format.PageType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // UNCOMPRESSED_PAGE_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.uncompressed_page_size = iprot.readI32();
              struct.setUncompressed_page_sizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // COMPRESSED_PAGE_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.compressed_page_size = iprot.readI32();
              struct.setCompressed_page_sizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // CRC
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.crc = iprot.readI32();
              struct.setCrcIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // DATA_PAGE_HEADER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.data_page_header = new DataPageHeader();
              struct.data_page_header.read(iprot);
              struct.setData_page_headerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // INDEX_PAGE_HEADER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.index_page_header = new IndexPageHeader();
              struct.index_page_header.read(iprot);
              struct.setIndex_page_headerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // DICTIONARY_PAGE_HEADER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.dictionary_page_header = new DictionaryPageHeader();
              struct.dictionary_page_header.read(iprot);
              struct.setDictionary_page_headerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // DATA_PAGE_HEADER_V2
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.data_page_header_v2 = new DataPageHeaderV2();
              struct.data_page_header_v2.read(iprot);
              struct.setData_page_header_v2IsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetUncompressed_page_size()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'uncompressed_page_size' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetCompressed_page_size()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'compressed_page_size' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, PageHeader struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(UNCOMPRESSED_PAGE_SIZE_FIELD_DESC);
      oprot.writeI32(struct.uncompressed_page_size);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(COMPRESSED_PAGE_SIZE_FIELD_DESC);
      oprot.writeI32(struct.compressed_page_size);
      oprot.writeFieldEnd();
      if (struct.isSetCrc()) {
        oprot.writeFieldBegin(CRC_FIELD_DESC);
        oprot.writeI32(struct.crc);
        oprot.writeFieldEnd();
      }
      if (struct.data_page_header != null) {
        if (struct.isSetData_page_header()) {
          oprot.writeFieldBegin(DATA_PAGE_HEADER_FIELD_DESC);
          struct.data_page_header.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.index_page_header != null) {
        if (struct.isSetIndex_page_header()) {
          oprot.writeFieldBegin(INDEX_PAGE_HEADER_FIELD_DESC);
          struct.index_page_header.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.dictionary_page_header != null) {
        if (struct.isSetDictionary_page_header()) {
          oprot.writeFieldBegin(DICTIONARY_PAGE_HEADER_FIELD_DESC);
          struct.dictionary_page_header.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.data_page_header_v2 != null) {
        if (struct.isSetData_page_header_v2()) {
          oprot.writeFieldBegin(DATA_PAGE_HEADER_V2_FIELD_DESC);
          struct.data_page_header_v2.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class PageHeaderTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public PageHeaderTupleScheme getScheme() {
      return new PageHeaderTupleScheme();
    }
  }

  private static class PageHeaderTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, PageHeader struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.type.getValue());
      oprot.writeI32(struct.uncompressed_page_size);
      oprot.writeI32(struct.compressed_page_size);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetCrc()) {
        optionals.set(0);
      }
      if (struct.isSetData_page_header()) {
        optionals.set(1);
      }
      if (struct.isSetIndex_page_header()) {
        optionals.set(2);
      }
      if (struct.isSetDictionary_page_header()) {
        optionals.set(3);
      }
      if (struct.isSetData_page_header_v2()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetCrc()) {
        oprot.writeI32(struct.crc);
      }
      if (struct.isSetData_page_header()) {
        struct.data_page_header.write(oprot);
      }
      if (struct.isSetIndex_page_header()) {
        struct.index_page_header.write(oprot);
      }
      if (struct.isSetDictionary_page_header()) {
        struct.dictionary_page_header.write(oprot);
      }
      if (struct.isSetData_page_header_v2()) {
        struct.data_page_header_v2.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, PageHeader struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.type = org.apache.parquet.format.PageType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      struct.uncompressed_page_size = iprot.readI32();
      struct.setUncompressed_page_sizeIsSet(true);
      struct.compressed_page_size = iprot.readI32();
      struct.setCompressed_page_sizeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.crc = iprot.readI32();
        struct.setCrcIsSet(true);
      }
      if (incoming.get(1)) {
        struct.data_page_header = new DataPageHeader();
        struct.data_page_header.read(iprot);
        struct.setData_page_headerIsSet(true);
      }
      if (incoming.get(2)) {
        struct.index_page_header = new IndexPageHeader();
        struct.index_page_header.read(iprot);
        struct.setIndex_page_headerIsSet(true);
      }
      if (incoming.get(3)) {
        struct.dictionary_page_header = new DictionaryPageHeader();
        struct.dictionary_page_header.read(iprot);
        struct.setDictionary_page_headerIsSet(true);
      }
      if (incoming.get(4)) {
        struct.data_page_header_v2 = new DataPageHeaderV2();
        struct.data_page_header_v2.read(iprot);
        struct.setData_page_header_v2IsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy