org.apache.parquet.format.PageHeader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parquet-format Show documentation
Show all versions of parquet-format Show documentation
Parquet is a columnar storage format that supports nested data. This provides all generated metadata code.
/**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.parquet.format;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PageHeader implements org.apache.thrift.TBase, java.io.Serializable, Cloneable {
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);
/**
* the type of the page: indicates which of the *_header fields is set *
*
* @see PageType
*/
public PageType type; // required
/**
* Uncompressed page size in bytes (not including this header) *
*/
public int uncompressed_page_size; // required
/**
* Compressed page size in bytes (not including this header) *
*/
public int compressed_page_size; // required
/**
* 32bit crc for the data below. This allows for disabling checksumming in HDFS
* if only a few pages needs to be read
*
*/
public int crc; // required
public DataPageHeader data_page_header; // required
public IndexPageHeader index_page_header; // required
public DictionaryPageHeader dictionary_page_header; // required
public DataPageHeaderV2 data_page_header_v2; // required
/** 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 page size in bytes (not including this header) *
*/
COMPRESSED_PAGE_SIZE((short)3, "compressed_page_size"),
/**
* 32bit crc for the data below. This allows for disabling checksumming in HDFS
* if only a few pages needs 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 Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public 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 BitSet __isset_bit_vector = new BitSet(3);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new 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 = 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_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
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
*/
public PageType getType() {
return this.type;
}
/**
* the type of the page: indicates which of the *_header fields is set *
*
* @see PageType
*/
public PageHeader setType(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_bit_vector.clear(__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 __isset_bit_vector.get(__UNCOMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setUncompressed_page_sizeIsSet(boolean value) {
__isset_bit_vector.set(__UNCOMPRESSED_PAGE_SIZE_ISSET_ID, value);
}
/**
* Compressed page size in bytes (not including this header) *
*/
public int getCompressed_page_size() {
return this.compressed_page_size;
}
/**
* Compressed 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_bit_vector.clear(__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 __isset_bit_vector.get(__COMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setCompressed_page_sizeIsSet(boolean value) {
__isset_bit_vector.set(__COMPRESSED_PAGE_SIZE_ISSET_ID, value);
}
/**
* 32bit crc for the data below. This allows for disabling checksumming in HDFS
* if only a few pages needs to be read
*
*/
public int getCrc() {
return this.crc;
}
/**
* 32bit crc for the data below. This allows for disabling checksumming in HDFS
* if only a few pages needs to be read
*
*/
public PageHeader setCrc(int crc) {
this.crc = crc;
setCrcIsSet(true);
return this;
}
public void unsetCrc() {
__isset_bit_vector.clear(__CRC_ISSET_ID);
}
/** Returns true if field crc is set (has been assigned a value) and false otherwise */
public boolean isSetCrc() {
return __isset_bit_vector.get(__CRC_ISSET_ID);
}
public void setCrcIsSet(boolean value) {
__isset_bit_vector.set(__CRC_ISSET_ID, value);
}
public DataPageHeader getData_page_header() {
return this.data_page_header;
}
public PageHeader setData_page_header(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;
}
}
public IndexPageHeader getIndex_page_header() {
return this.index_page_header;
}
public PageHeader setIndex_page_header(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;
}
}
public DictionaryPageHeader getDictionary_page_header() {
return this.dictionary_page_header;
}
public PageHeader setDictionary_page_header(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;
}
}
public DataPageHeaderV2 getData_page_header_v2() {
return this.data_page_header_v2;
}
public PageHeader setData_page_header_v2(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, 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((Integer)value);
}
break;
case COMPRESSED_PAGE_SIZE:
if (value == null) {
unsetCompressed_page_size();
} else {
setCompressed_page_size((Integer)value);
}
break;
case CRC:
if (value == null) {
unsetCrc();
} else {
setCrc((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;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TYPE:
return getType();
case UNCOMPRESSED_PAGE_SIZE:
return Integer.valueOf(getUncompressed_page_size());
case COMPRESSED_PAGE_SIZE:
return Integer.valueOf(getCompressed_page_size());
case CRC:
return Integer.valueOf(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 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 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 IllegalStateException();
}
@Override
public boolean equals(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;
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() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_type = true && (isSetType());
builder.append(present_type);
if (present_type)
builder.append(type.getValue());
boolean present_uncompressed_page_size = true;
builder.append(present_uncompressed_page_size);
if (present_uncompressed_page_size)
builder.append(uncompressed_page_size);
boolean present_compressed_page_size = true;
builder.append(present_compressed_page_size);
if (present_compressed_page_size)
builder.append(compressed_page_size);
boolean present_crc = true && (isSetCrc());
builder.append(present_crc);
if (present_crc)
builder.append(crc);
boolean present_data_page_header = true && (isSetData_page_header());
builder.append(present_data_page_header);
if (present_data_page_header)
builder.append(data_page_header);
boolean present_index_page_header = true && (isSetIndex_page_header());
builder.append(present_index_page_header);
if (present_index_page_header)
builder.append(index_page_header);
boolean present_dictionary_page_header = true && (isSetDictionary_page_header());
builder.append(present_dictionary_page_header);
if (present_dictionary_page_header)
builder.append(dictionary_page_header);
boolean present_data_page_header_v2 = true && (isSetData_page_header_v2());
builder.append(present_data_page_header_v2);
if (present_data_page_header_v2)
builder.append(data_page_header_v2);
return builder.toHashCode();
}
public int compareTo(PageHeader other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
PageHeader typedOther = (PageHeader)other;
lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUncompressed_page_size()).compareTo(typedOther.isSetUncompressed_page_size());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUncompressed_page_size()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uncompressed_page_size, typedOther.uncompressed_page_size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCompressed_page_size()).compareTo(typedOther.isSetCompressed_page_size());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCompressed_page_size()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compressed_page_size, typedOther.compressed_page_size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCrc()).compareTo(typedOther.isSetCrc());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCrc()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.crc, typedOther.crc);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetData_page_header()).compareTo(typedOther.isSetData_page_header());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetData_page_header()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_page_header, typedOther.data_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetIndex_page_header()).compareTo(typedOther.isSetIndex_page_header());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndex_page_header()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_page_header, typedOther.index_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDictionary_page_header()).compareTo(typedOther.isSetDictionary_page_header());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDictionary_page_header()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dictionary_page_header, typedOther.dictionary_page_header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetData_page_header_v2()).compareTo(typedOther.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, typedOther.data_page_header_v2);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // TYPE
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.type = PageType.findByValue(iprot.readI32());
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // UNCOMPRESSED_PAGE_SIZE
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.uncompressed_page_size = iprot.readI32();
setUncompressed_page_sizeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // COMPRESSED_PAGE_SIZE
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.compressed_page_size = iprot.readI32();
setCompressed_page_sizeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // CRC
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.crc = iprot.readI32();
setCrcIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 5: // DATA_PAGE_HEADER
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
this.data_page_header = new DataPageHeader();
this.data_page_header.read(iprot);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 6: // INDEX_PAGE_HEADER
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
this.index_page_header = new IndexPageHeader();
this.index_page_header.read(iprot);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 7: // DICTIONARY_PAGE_HEADER
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
this.dictionary_page_header = new DictionaryPageHeader();
this.dictionary_page_header.read(iprot);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 8: // DATA_PAGE_HEADER_V2
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
this.data_page_header_v2 = new DataPageHeaderV2();
this.data_page_header_v2.read(iprot);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!isSetUncompressed_page_size()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'uncompressed_page_size' was not found in serialized data! Struct: " + toString());
}
if (!isSetCompressed_page_size()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'compressed_page_size' was not found in serialized data! Struct: " + toString());
}
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(this.type.getValue());
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(UNCOMPRESSED_PAGE_SIZE_FIELD_DESC);
oprot.writeI32(this.uncompressed_page_size);
oprot.writeFieldEnd();
oprot.writeFieldBegin(COMPRESSED_PAGE_SIZE_FIELD_DESC);
oprot.writeI32(this.compressed_page_size);
oprot.writeFieldEnd();
if (isSetCrc()) {
oprot.writeFieldBegin(CRC_FIELD_DESC);
oprot.writeI32(this.crc);
oprot.writeFieldEnd();
}
if (this.data_page_header != null) {
if (isSetData_page_header()) {
oprot.writeFieldBegin(DATA_PAGE_HEADER_FIELD_DESC);
this.data_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (this.index_page_header != null) {
if (isSetIndex_page_header()) {
oprot.writeFieldBegin(INDEX_PAGE_HEADER_FIELD_DESC);
this.index_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (this.dictionary_page_header != null) {
if (isSetDictionary_page_header()) {
oprot.writeFieldBegin(DICTIONARY_PAGE_HEADER_FIELD_DESC);
this.dictionary_page_header.write(oprot);
oprot.writeFieldEnd();
}
}
if (this.data_page_header_v2 != null) {
if (isSetData_page_header_v2()) {
oprot.writeFieldBegin(DATA_PAGE_HEADER_V2_FIELD_DESC);
this.data_page_header_v2.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new 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.
}
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, 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_bit_vector = new BitSet(1);
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);
}
}
}