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.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.parquet.format;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-10-17")
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 Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new PageHeaderStandardSchemeFactory());
schemes.put(TupleScheme.class, new PageHeaderTupleSchemeFactory());
}
/**
* 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; // optional
public DataPageHeader data_page_header; // optional
public IndexPageHeader index_page_header; // optional
public DictionaryPageHeader dictionary_page_header; // optional
public 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 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 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 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_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
*/
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_bitfield = 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 EncodingUtils.testBit(__isset_bitfield, __UNCOMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setUncompressed_page_sizeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __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_bitfield = 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 EncodingUtils.testBit(__isset_bitfield, __COMPRESSED_PAGE_SIZE_ISSET_ID);
}
public void setCompressed_page_sizeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __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_bitfield = 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 EncodingUtils.testBit(__isset_bitfield, __CRC_ISSET_ID);
}
public void setCrcIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __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 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 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() {
List