PageHeader.java
/**
* Autogenerated by Thrift Compiler (0.16.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.16.0)", date = "2026-05-14")
public class PageHeader implements org.apache.thrift.TBase<PageHeader, PageHeader._Fields>, java.io.Serializable, Cloneable, Comparable<PageHeader> {
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 checksum for the page, to be be calculated as follows:
*
* The standard CRC32 algorithm is used (with polynomial 0x04C11DB7,
* the same as in e.g. GZip).
* All page types can have a CRC (v1 and v2 data pages, dictionary pages,
* etc.).
* The CRC is computed on the serialization binary representation of the page
* (as written to disk), excluding the page header. For example, for v1
* data pages, the CRC is computed on the concatenation of repetition levels,
* definition levels and column values (optionally compressed, optionally
* encrypted).
* The CRC computation therefore takes place after any compression
* and encryption steps, if any.
*
* 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 checksum for the page, to be be calculated as follows:
*
* The standard CRC32 algorithm is used (with polynomial 0x04C11DB7,
* the same as in e.g. GZip).
* All page types can have a CRC (v1 and v2 data pages, dictionary pages,
* etc.).
* The CRC is computed on the serialization binary representation of the page
* (as written to disk), excluding the page header. For example, for v1
* data pages, the CRC is computed on the concatenation of repetition levels,
* definition levels and column values (optionally compressed, optionally
* encrypted).
* The CRC computation therefore takes place after any compression
* and encryption steps, if any.
*
* 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<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
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;
setUncompressedPageSizeIsSet(true);
this.compressed_page_size = compressed_page_size;
setCompressedPageSizeIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
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.isSetDataPageHeader()) {
this.data_page_header = new DataPageHeader(other.data_page_header);
}
if (other.isSetIndexPageHeader()) {
this.index_page_header = new IndexPageHeader(other.index_page_header);
}
if (other.isSetDictionaryPageHeader()) {
this.dictionary_page_header = new DictionaryPageHeader(other.dictionary_page_header);
}
if (other.isSetDataPageHeaderV2()) {
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;
setUncompressedPageSizeIsSet(false);
this.uncompressed_page_size = 0;
setCompressedPageSizeIsSet(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 getUncompressedPageSize() {
return this.uncompressed_page_size;
}
/**
* Uncompressed page size in bytes (not including this header) *
*/
public PageHeader setUncompressedPageSize(int uncompressed_page_size) {
this.uncompressed_page_size = uncompressed_page_size;
setUncompressedPageSizeIsSet(true);
return this;
}
public void unsetUncompressedPageSize() {
__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 isSetUncompressedPageSize() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __UNCOMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setUncompressedPageSizeIsSet(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 getCompressedPageSize() {
return this.compressed_page_size;
}
/**
* Compressed (and potentially encrypted) page size in bytes, not including this header *
*/
public PageHeader setCompressedPageSize(int compressed_page_size) {
this.compressed_page_size = compressed_page_size;
setCompressedPageSizeIsSet(true);
return this;
}
public void unsetCompressedPageSize() {
__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 isSetCompressedPageSize() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setCompressedPageSizeIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID, value);
}
/**
* The 32bit CRC checksum for the page, to be be calculated as follows:
*
* The standard CRC32 algorithm is used (with polynomial 0x04C11DB7,
* the same as in e.g. GZip).
* All page types can have a CRC (v1 and v2 data pages, dictionary pages,
* etc.).
* The CRC is computed on the serialization binary representation of the page
* (as written to disk), excluding the page header. For example, for v1
* data pages, the CRC is computed on the concatenation of repetition levels,
* definition levels and column values (optionally compressed, optionally
* encrypted).
* The CRC computation therefore takes place after any compression
* and encryption steps, if any.
*
* 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 checksum for the page, to be be calculated as follows:
*
* The standard CRC32 algorithm is used (with polynomial 0x04C11DB7,
* the same as in e.g. GZip).
* All page types can have a CRC (v1 and v2 data pages, dictionary pages,
* etc.).
* The CRC is computed on the serialization binary representation of the page
* (as written to disk), excluding the page header. For example, for v1
* data pages, the CRC is computed on the concatenation of repetition levels,
* definition levels and column values (optionally compressed, optionally
* encrypted).
* The CRC computation therefore takes place after any compression
* and encryption steps, if any.
*
* 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 getDataPageHeader() {
return this.data_page_header;
}
public PageHeader setDataPageHeader(@org.apache.thrift.annotation.Nullable DataPageHeader data_page_header) {
this.data_page_header = data_page_header;
return this;
}
public void unsetDataPageHeader() {
this.data_page_header = null;
}
/** Returns true if field data_page_header is set (has been assigned a value) and false otherwise */
public boolean isSetDataPageHeader() {
return this.data_page_header != null;
}
public void setDataPageHeaderIsSet(boolean value) {
if (!value) {
this.data_page_header = null;
}
}
@org.apache.thrift.annotation.Nullable
public IndexPageHeader getIndexPageHeader() {
return this.index_page_header;
}
public PageHeader setIndexPageHeader(@org.apache.thrift.annotation.Nullable IndexPageHeader index_page_header) {
this.index_page_header = index_page_header;
return this;
}
public void unsetIndexPageHeader() {
this.index_page_header = null;
}
/** Returns true if field index_page_header is set (has been assigned a value) and false otherwise */
public boolean isSetIndexPageHeader() {
return this.index_page_header != null;
}
public void setIndexPageHeaderIsSet(boolean value) {
if (!value) {
this.index_page_header = null;
}
}
@org.apache.thrift.annotation.Nullable
public DictionaryPageHeader getDictionaryPageHeader() {
return this.dictionary_page_header;
}
public PageHeader setDictionaryPageHeader(@org.apache.thrift.annotation.Nullable DictionaryPageHeader dictionary_page_header) {
this.dictionary_page_header = dictionary_page_header;
return this;
}
public void unsetDictionaryPageHeader() {
this.dictionary_page_header = null;
}
/** Returns true if field dictionary_page_header is set (has been assigned a value) and false otherwise */
public boolean isSetDictionaryPageHeader() {
return this.dictionary_page_header != null;
}
public void setDictionaryPageHeaderIsSet(boolean value) {
if (!value) {
this.dictionary_page_header = null;
}
}
@org.apache.thrift.annotation.Nullable
public DataPageHeaderV2 getDataPageHeaderV2() {
return this.data_page_header_v2;
}
public PageHeader setDataPageHeaderV2(@org.apache.thrift.annotation.Nullable DataPageHeaderV2 data_page_header_v2) {
this.data_page_header_v2 = data_page_header_v2;
return this;
}
public void unsetDataPageHeaderV2() {
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 isSetDataPageHeaderV2() {
return this.data_page_header_v2 != null;
}
public void setDataPageHeaderV2IsSet(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) {
unsetUncompressedPageSize();
} else {
setUncompressedPageSize((java.lang.Integer)value);
}
break;
case COMPRESSED_PAGE_SIZE:
if (value == null) {
unsetCompressedPageSize();
} else {
setCompressedPageSize((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) {
unsetDataPageHeader();
} else {
setDataPageHeader((DataPageHeader)value);
}
break;
case INDEX_PAGE_HEADER:
if (value == null) {
unsetIndexPageHeader();
} else {
setIndexPageHeader((IndexPageHeader)value);
}
break;
case DICTIONARY_PAGE_HEADER:
if (value == null) {
unsetDictionaryPageHeader();
} else {
setDictionaryPageHeader((DictionaryPageHeader)value);
}
break;
case DATA_PAGE_HEADER_V2:
if (value == null) {
unsetDataPageHeaderV2();
} else {
setDataPageHeaderV2((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 getUncompressedPageSize();
case COMPRESSED_PAGE_SIZE:
return getCompressedPageSize();
case CRC:
return getCrc();
case DATA_PAGE_HEADER:
return getDataPageHeader();
case INDEX_PAGE_HEADER:
return getIndexPageHeader();
case DICTIONARY_PAGE_HEADER:
return getDictionaryPageHeader();
case DATA_PAGE_HEADER_V2:
return getDataPageHeaderV2();
}
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 isSetUncompressedPageSize();
case COMPRESSED_PAGE_SIZE:
return isSetCompressedPageSize();
case CRC:
return isSetCrc();
case DATA_PAGE_HEADER:
return isSetDataPageHeader();
case INDEX_PAGE_HEADER:
return isSetIndexPageHeader();
case DICTIONARY_PAGE_HEADER:
return isSetDictionaryPageHeader();
case DATA_PAGE_HEADER_V2:
return isSetDataPageHeaderV2();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
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.isSetDataPageHeader();
boolean that_present_data_page_header = true && that.isSetDataPageHeader();
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.isSetIndexPageHeader();
boolean that_present_index_page_header = true && that.isSetIndexPageHeader();
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.isSetDictionaryPageHeader();
boolean that_present_dictionary_page_header = true && that.isSetDictionaryPageHeader();
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.isSetDataPageHeaderV2();
boolean that_present_data_page_header_v2 = true && that.isSetDataPageHeaderV2();
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 + ((isSetDataPageHeader()) ? 131071 : 524287);
if (isSetDataPageHeader())
hashCode = hashCode * 8191 + data_page_header.hashCode();
hashCode = hashCode * 8191 + ((isSetIndexPageHeader()) ? 131071 : 524287);
if (isSetIndexPageHeader())
hashCode = hashCode * 8191 + index_page_header.hashCode();
hashCode = hashCode * 8191 + ((isSetDictionaryPageHeader()) ? 131071 : 524287);
if (isSetDictionaryPageHeader())
hashCode = hashCode * 8191 + dictionary_page_header.hashCode();
hashCode = hashCode * 8191 + ((isSetDataPageHeaderV2()) ? 131071 : 524287);
if (isSetDataPageHeaderV2())
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.compare(isSetType(), 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.compare(isSetUncompressedPageSize(), other.isSetUncompressedPageSize());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUncompressedPageSize()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uncompressed_page_size, other.uncompressed_page_size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetCompressedPageSize(), other.isSetCompressedPageSize());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCompressedPageSize()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compressed_page_size, other.compressed_page_size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetCrc(), 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.compare(isSetDataPageHeader(), other.isSetDataPageHeader());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDataPageHeader()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_page_header, other.data_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetIndexPageHeader(), other.isSetIndexPageHeader());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndexPageHeader()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_page_header, other.index_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetDictionaryPageHeader(), other.isSetDictionaryPageHeader());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDictionaryPageHeader()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dictionary_page_header, other.dictionary_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetDataPageHeaderV2(), other.isSetDataPageHeaderV2());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDataPageHeaderV2()) {
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 (isSetDataPageHeader()) {
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 (isSetIndexPageHeader()) {
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 (isSetDictionaryPageHeader()) {
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 (isSetDataPageHeaderV2()) {
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<PageHeader> {
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.setUncompressedPageSizeIsSet(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.setCompressedPageSizeIsSet(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.setDataPageHeaderIsSet(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.setIndexPageHeaderIsSet(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.setDictionaryPageHeaderIsSet(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.setDataPageHeaderV2IsSet(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.isSetUncompressedPageSize()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'uncompressed_page_size' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetCompressedPageSize()) {
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.isSetDataPageHeader()) {
oprot.writeFieldBegin(DATA_PAGE_HEADER_FIELD_DESC);
struct.data_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.index_page_header != null) {
if (struct.isSetIndexPageHeader()) {
oprot.writeFieldBegin(INDEX_PAGE_HEADER_FIELD_DESC);
struct.index_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.dictionary_page_header != null) {
if (struct.isSetDictionaryPageHeader()) {
oprot.writeFieldBegin(DICTIONARY_PAGE_HEADER_FIELD_DESC);
struct.dictionary_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.data_page_header_v2 != null) {
if (struct.isSetDataPageHeaderV2()) {
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<PageHeader> {
@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.isSetDataPageHeader()) {
optionals.set(1);
}
if (struct.isSetIndexPageHeader()) {
optionals.set(2);
}
if (struct.isSetDictionaryPageHeader()) {
optionals.set(3);
}
if (struct.isSetDataPageHeaderV2()) {
optionals.set(4);
}
oprot.writeBitSet(optionals, 5);
if (struct.isSetCrc()) {
oprot.writeI32(struct.crc);
}
if (struct.isSetDataPageHeader()) {
struct.data_page_header.write(oprot);
}
if (struct.isSetIndexPageHeader()) {
struct.index_page_header.write(oprot);
}
if (struct.isSetDictionaryPageHeader()) {
struct.dictionary_page_header.write(oprot);
}
if (struct.isSetDataPageHeaderV2()) {
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.setUncompressedPageSizeIsSet(true);
struct.compressed_page_size = iprot.readI32();
struct.setCompressedPageSizeIsSet(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.setDataPageHeaderIsSet(true);
}
if (incoming.get(2)) {
struct.index_page_header = new IndexPageHeader();
struct.index_page_header.read(iprot);
struct.setIndexPageHeaderIsSet(true);
}
if (incoming.get(3)) {
struct.dictionary_page_header = new DictionaryPageHeader();
struct.dictionary_page_header.read(iprot);
struct.setDictionaryPageHeaderIsSet(true);
}
if (incoming.get(4)) {
struct.data_page_header_v2 = new DataPageHeaderV2();
struct.data_page_header_v2.read(iprot);
struct.setDataPageHeaderV2IsSet(true);
}
}
}
private static <S extends org.apache.thrift.scheme.IScheme> 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();
}
}