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

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

Go to download

Parquet is a columnar storage format that supports nested data. This provides all generated metadata code.

There is a newer version: 2.10.0
Show newest version
/**
 * 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;

/**
 * Description for column metadata
 */
public class ColumnMetaData 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("ColumnMetaData");

  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 ENCODINGS_FIELD_DESC = new org.apache.thrift.protocol.TField("encodings", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField PATH_IN_SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("path_in_schema", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField CODEC_FIELD_DESC = new org.apache.thrift.protocol.TField("codec", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField NUM_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("num_values", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField TOTAL_UNCOMPRESSED_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("total_uncompressed_size", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField TOTAL_COMPRESSED_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("total_compressed_size", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField KEY_VALUE_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("key_value_metadata", org.apache.thrift.protocol.TType.LIST, (short)8);
  private static final org.apache.thrift.protocol.TField DATA_PAGE_OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("data_page_offset", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField INDEX_PAGE_OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("index_page_offset", org.apache.thrift.protocol.TType.I64, (short)10);
  private static final org.apache.thrift.protocol.TField DICTIONARY_PAGE_OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("dictionary_page_offset", org.apache.thrift.protocol.TType.I64, (short)11);
  private static final org.apache.thrift.protocol.TField STATISTICS_FIELD_DESC = new org.apache.thrift.protocol.TField("statistics", org.apache.thrift.protocol.TType.STRUCT, (short)12);
  private static final org.apache.thrift.protocol.TField ENCODING_STATS_FIELD_DESC = new org.apache.thrift.protocol.TField("encoding_stats", org.apache.thrift.protocol.TType.LIST, (short)13);

  /**
   * Type of this column *
   * 
   * @see Type
   */
  public Type type; // required
  /**
   * Set of all encodings used for this column. The purpose is to validate
   * whether we can decode those pages. *
   */
  public List encodings; // required
  /**
   * Path in schema *
   */
  public List path_in_schema; // required
  /**
   * Compression codec *
   * 
   * @see CompressionCodec
   */
  public CompressionCodec codec; // required
  /**
   * Number of values in this column *
   */
  public long num_values; // required
  /**
   * total byte size of all uncompressed pages in this column chunk (including the headers) *
   */
  public long total_uncompressed_size; // required
  /**
   * total byte size of all compressed pages in this column chunk (including the headers) *
   */
  public long total_compressed_size; // required
  /**
   * Optional key/value metadata *
   */
  public List key_value_metadata; // required
  /**
   * Byte offset from beginning of file to first data page *
   */
  public long data_page_offset; // required
  /**
   * Byte offset from beginning of file to root index page *
   */
  public long index_page_offset; // required
  /**
   * Byte offset from the beginning of file to first (only) dictionary page *
   */
  public long dictionary_page_offset; // required
  /**
   * optional statistics for this column chunk
   */
  public Statistics statistics; // required
  /**
   * Set of all encodings used for pages in this column chunk.
   * This information can be used to determine if all data pages are
   * dictionary encoded for example *
   */
  public List encoding_stats; // 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 {
    /**
     * Type of this column *
     * 
     * @see Type
     */
    TYPE((short)1, "type"),
    /**
     * Set of all encodings used for this column. The purpose is to validate
     * whether we can decode those pages. *
     */
    ENCODINGS((short)2, "encodings"),
    /**
     * Path in schema *
     */
    PATH_IN_SCHEMA((short)3, "path_in_schema"),
    /**
     * Compression codec *
     * 
     * @see CompressionCodec
     */
    CODEC((short)4, "codec"),
    /**
     * Number of values in this column *
     */
    NUM_VALUES((short)5, "num_values"),
    /**
     * total byte size of all uncompressed pages in this column chunk (including the headers) *
     */
    TOTAL_UNCOMPRESSED_SIZE((short)6, "total_uncompressed_size"),
    /**
     * total byte size of all compressed pages in this column chunk (including the headers) *
     */
    TOTAL_COMPRESSED_SIZE((short)7, "total_compressed_size"),
    /**
     * Optional key/value metadata *
     */
    KEY_VALUE_METADATA((short)8, "key_value_metadata"),
    /**
     * Byte offset from beginning of file to first data page *
     */
    DATA_PAGE_OFFSET((short)9, "data_page_offset"),
    /**
     * Byte offset from beginning of file to root index page *
     */
    INDEX_PAGE_OFFSET((short)10, "index_page_offset"),
    /**
     * Byte offset from the beginning of file to first (only) dictionary page *
     */
    DICTIONARY_PAGE_OFFSET((short)11, "dictionary_page_offset"),
    /**
     * optional statistics for this column chunk
     */
    STATISTICS((short)12, "statistics"),
    /**
     * Set of all encodings used for pages in this column chunk.
     * This information can be used to determine if all data pages are
     * dictionary encoded for example *
     */
    ENCODING_STATS((short)13, "encoding_stats");

    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: // ENCODINGS
          return ENCODINGS;
        case 3: // PATH_IN_SCHEMA
          return PATH_IN_SCHEMA;
        case 4: // CODEC
          return CODEC;
        case 5: // NUM_VALUES
          return NUM_VALUES;
        case 6: // TOTAL_UNCOMPRESSED_SIZE
          return TOTAL_UNCOMPRESSED_SIZE;
        case 7: // TOTAL_COMPRESSED_SIZE
          return TOTAL_COMPRESSED_SIZE;
        case 8: // KEY_VALUE_METADATA
          return KEY_VALUE_METADATA;
        case 9: // DATA_PAGE_OFFSET
          return DATA_PAGE_OFFSET;
        case 10: // INDEX_PAGE_OFFSET
          return INDEX_PAGE_OFFSET;
        case 11: // DICTIONARY_PAGE_OFFSET
          return DICTIONARY_PAGE_OFFSET;
        case 12: // STATISTICS
          return STATISTICS;
        case 13: // ENCODING_STATS
          return ENCODING_STATS;
        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 __NUM_VALUES_ISSET_ID = 0;
  private static final int __TOTAL_UNCOMPRESSED_SIZE_ISSET_ID = 1;
  private static final int __TOTAL_COMPRESSED_SIZE_ISSET_ID = 2;
  private static final int __DATA_PAGE_OFFSET_ISSET_ID = 3;
  private static final int __INDEX_PAGE_OFFSET_ISSET_ID = 4;
  private static final int __DICTIONARY_PAGE_OFFSET_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  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, Type.class)));
    tmpMap.put(_Fields.ENCODINGS, new org.apache.thrift.meta_data.FieldMetaData("encodings", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Encoding.class))));
    tmpMap.put(_Fields.PATH_IN_SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("path_in_schema", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.CODEC, new org.apache.thrift.meta_data.FieldMetaData("codec", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CompressionCodec.class)));
    tmpMap.put(_Fields.NUM_VALUES, new org.apache.thrift.meta_data.FieldMetaData("num_values", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOTAL_UNCOMPRESSED_SIZE, new org.apache.thrift.meta_data.FieldMetaData("total_uncompressed_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOTAL_COMPRESSED_SIZE, new org.apache.thrift.meta_data.FieldMetaData("total_compressed_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.KEY_VALUE_METADATA, new org.apache.thrift.meta_data.FieldMetaData("key_value_metadata", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, KeyValue.class))));
    tmpMap.put(_Fields.DATA_PAGE_OFFSET, new org.apache.thrift.meta_data.FieldMetaData("data_page_offset", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.INDEX_PAGE_OFFSET, new org.apache.thrift.meta_data.FieldMetaData("index_page_offset", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DICTIONARY_PAGE_OFFSET, new org.apache.thrift.meta_data.FieldMetaData("dictionary_page_offset", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.STATISTICS, new org.apache.thrift.meta_data.FieldMetaData("statistics", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Statistics.class)));
    tmpMap.put(_Fields.ENCODING_STATS, new org.apache.thrift.meta_data.FieldMetaData("encoding_stats", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PageEncodingStats.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnMetaData.class, metaDataMap);
  }

  public ColumnMetaData() {
  }

  public ColumnMetaData(
    Type type,
    List encodings,
    List path_in_schema,
    CompressionCodec codec,
    long num_values,
    long total_uncompressed_size,
    long total_compressed_size,
    long data_page_offset)
  {
    this();
    this.type = type;
    this.encodings = encodings;
    this.path_in_schema = path_in_schema;
    this.codec = codec;
    this.num_values = num_values;
    setNum_valuesIsSet(true);
    this.total_uncompressed_size = total_uncompressed_size;
    setTotal_uncompressed_sizeIsSet(true);
    this.total_compressed_size = total_compressed_size;
    setTotal_compressed_sizeIsSet(true);
    this.data_page_offset = data_page_offset;
    setData_page_offsetIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public ColumnMetaData(ColumnMetaData other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetType()) {
      this.type = other.type;
    }
    if (other.isSetEncodings()) {
      List __this__encodings = new ArrayList();
      for (Encoding other_element : other.encodings) {
        __this__encodings.add(other_element);
      }
      this.encodings = __this__encodings;
    }
    if (other.isSetPath_in_schema()) {
      List __this__path_in_schema = new ArrayList();
      for (String other_element : other.path_in_schema) {
        __this__path_in_schema.add(other_element);
      }
      this.path_in_schema = __this__path_in_schema;
    }
    if (other.isSetCodec()) {
      this.codec = other.codec;
    }
    this.num_values = other.num_values;
    this.total_uncompressed_size = other.total_uncompressed_size;
    this.total_compressed_size = other.total_compressed_size;
    if (other.isSetKey_value_metadata()) {
      List __this__key_value_metadata = new ArrayList();
      for (KeyValue other_element : other.key_value_metadata) {
        __this__key_value_metadata.add(new KeyValue(other_element));
      }
      this.key_value_metadata = __this__key_value_metadata;
    }
    this.data_page_offset = other.data_page_offset;
    this.index_page_offset = other.index_page_offset;
    this.dictionary_page_offset = other.dictionary_page_offset;
    if (other.isSetStatistics()) {
      this.statistics = new Statistics(other.statistics);
    }
    if (other.isSetEncoding_stats()) {
      List __this__encoding_stats = new ArrayList();
      for (PageEncodingStats other_element : other.encoding_stats) {
        __this__encoding_stats.add(new PageEncodingStats(other_element));
      }
      this.encoding_stats = __this__encoding_stats;
    }
  }

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

  @Override
  public void clear() {
    this.type = null;
    this.encodings = null;
    this.path_in_schema = null;
    this.codec = null;
    setNum_valuesIsSet(false);
    this.num_values = 0;
    setTotal_uncompressed_sizeIsSet(false);
    this.total_uncompressed_size = 0;
    setTotal_compressed_sizeIsSet(false);
    this.total_compressed_size = 0;
    this.key_value_metadata = null;
    setData_page_offsetIsSet(false);
    this.data_page_offset = 0;
    setIndex_page_offsetIsSet(false);
    this.index_page_offset = 0;
    setDictionary_page_offsetIsSet(false);
    this.dictionary_page_offset = 0;
    this.statistics = null;
    this.encoding_stats = null;
  }

  /**
   * Type of this column *
   * 
   * @see Type
   */
  public Type getType() {
    return this.type;
  }

  /**
   * Type of this column *
   * 
   * @see Type
   */
  public ColumnMetaData setType(Type 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;
    }
  }

  public int getEncodingsSize() {
    return (this.encodings == null) ? 0 : this.encodings.size();
  }

  public java.util.Iterator getEncodingsIterator() {
    return (this.encodings == null) ? null : this.encodings.iterator();
  }

  public void addToEncodings(Encoding elem) {
    if (this.encodings == null) {
      this.encodings = new ArrayList();
    }
    this.encodings.add(elem);
  }

  /**
   * Set of all encodings used for this column. The purpose is to validate
   * whether we can decode those pages. *
   */
  public List getEncodings() {
    return this.encodings;
  }

  /**
   * Set of all encodings used for this column. The purpose is to validate
   * whether we can decode those pages. *
   */
  public ColumnMetaData setEncodings(List encodings) {
    this.encodings = encodings;
    return this;
  }

  public void unsetEncodings() {
    this.encodings = null;
  }

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

  public void setEncodingsIsSet(boolean value) {
    if (!value) {
      this.encodings = null;
    }
  }

  public int getPath_in_schemaSize() {
    return (this.path_in_schema == null) ? 0 : this.path_in_schema.size();
  }

  public java.util.Iterator getPath_in_schemaIterator() {
    return (this.path_in_schema == null) ? null : this.path_in_schema.iterator();
  }

  public void addToPath_in_schema(String elem) {
    if (this.path_in_schema == null) {
      this.path_in_schema = new ArrayList();
    }
    this.path_in_schema.add(elem);
  }

  /**
   * Path in schema *
   */
  public List getPath_in_schema() {
    return this.path_in_schema;
  }

  /**
   * Path in schema *
   */
  public ColumnMetaData setPath_in_schema(List path_in_schema) {
    this.path_in_schema = path_in_schema;
    return this;
  }

  public void unsetPath_in_schema() {
    this.path_in_schema = null;
  }

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

  public void setPath_in_schemaIsSet(boolean value) {
    if (!value) {
      this.path_in_schema = null;
    }
  }

  /**
   * Compression codec *
   * 
   * @see CompressionCodec
   */
  public CompressionCodec getCodec() {
    return this.codec;
  }

  /**
   * Compression codec *
   * 
   * @see CompressionCodec
   */
  public ColumnMetaData setCodec(CompressionCodec codec) {
    this.codec = codec;
    return this;
  }

  public void unsetCodec() {
    this.codec = null;
  }

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

  public void setCodecIsSet(boolean value) {
    if (!value) {
      this.codec = null;
    }
  }

  /**
   * Number of values in this column *
   */
  public long getNum_values() {
    return this.num_values;
  }

  /**
   * Number of values in this column *
   */
  public ColumnMetaData setNum_values(long num_values) {
    this.num_values = num_values;
    setNum_valuesIsSet(true);
    return this;
  }

  public void unsetNum_values() {
    __isset_bit_vector.clear(__NUM_VALUES_ISSET_ID);
  }

  /** Returns true if field num_values is set (has been assigned a value) and false otherwise */
  public boolean isSetNum_values() {
    return __isset_bit_vector.get(__NUM_VALUES_ISSET_ID);
  }

  public void setNum_valuesIsSet(boolean value) {
    __isset_bit_vector.set(__NUM_VALUES_ISSET_ID, value);
  }

  /**
   * total byte size of all uncompressed pages in this column chunk (including the headers) *
   */
  public long getTotal_uncompressed_size() {
    return this.total_uncompressed_size;
  }

  /**
   * total byte size of all uncompressed pages in this column chunk (including the headers) *
   */
  public ColumnMetaData setTotal_uncompressed_size(long total_uncompressed_size) {
    this.total_uncompressed_size = total_uncompressed_size;
    setTotal_uncompressed_sizeIsSet(true);
    return this;
  }

  public void unsetTotal_uncompressed_size() {
    __isset_bit_vector.clear(__TOTAL_UNCOMPRESSED_SIZE_ISSET_ID);
  }

  /** Returns true if field total_uncompressed_size is set (has been assigned a value) and false otherwise */
  public boolean isSetTotal_uncompressed_size() {
    return __isset_bit_vector.get(__TOTAL_UNCOMPRESSED_SIZE_ISSET_ID);
  }

  public void setTotal_uncompressed_sizeIsSet(boolean value) {
    __isset_bit_vector.set(__TOTAL_UNCOMPRESSED_SIZE_ISSET_ID, value);
  }

  /**
   * total byte size of all compressed pages in this column chunk (including the headers) *
   */
  public long getTotal_compressed_size() {
    return this.total_compressed_size;
  }

  /**
   * total byte size of all compressed pages in this column chunk (including the headers) *
   */
  public ColumnMetaData setTotal_compressed_size(long total_compressed_size) {
    this.total_compressed_size = total_compressed_size;
    setTotal_compressed_sizeIsSet(true);
    return this;
  }

  public void unsetTotal_compressed_size() {
    __isset_bit_vector.clear(__TOTAL_COMPRESSED_SIZE_ISSET_ID);
  }

  /** Returns true if field total_compressed_size is set (has been assigned a value) and false otherwise */
  public boolean isSetTotal_compressed_size() {
    return __isset_bit_vector.get(__TOTAL_COMPRESSED_SIZE_ISSET_ID);
  }

  public void setTotal_compressed_sizeIsSet(boolean value) {
    __isset_bit_vector.set(__TOTAL_COMPRESSED_SIZE_ISSET_ID, value);
  }

  public int getKey_value_metadataSize() {
    return (this.key_value_metadata == null) ? 0 : this.key_value_metadata.size();
  }

  public java.util.Iterator getKey_value_metadataIterator() {
    return (this.key_value_metadata == null) ? null : this.key_value_metadata.iterator();
  }

  public void addToKey_value_metadata(KeyValue elem) {
    if (this.key_value_metadata == null) {
      this.key_value_metadata = new ArrayList();
    }
    this.key_value_metadata.add(elem);
  }

  /**
   * Optional key/value metadata *
   */
  public List getKey_value_metadata() {
    return this.key_value_metadata;
  }

  /**
   * Optional key/value metadata *
   */
  public ColumnMetaData setKey_value_metadata(List key_value_metadata) {
    this.key_value_metadata = key_value_metadata;
    return this;
  }

  public void unsetKey_value_metadata() {
    this.key_value_metadata = null;
  }

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

  public void setKey_value_metadataIsSet(boolean value) {
    if (!value) {
      this.key_value_metadata = null;
    }
  }

  /**
   * Byte offset from beginning of file to first data page *
   */
  public long getData_page_offset() {
    return this.data_page_offset;
  }

  /**
   * Byte offset from beginning of file to first data page *
   */
  public ColumnMetaData setData_page_offset(long data_page_offset) {
    this.data_page_offset = data_page_offset;
    setData_page_offsetIsSet(true);
    return this;
  }

  public void unsetData_page_offset() {
    __isset_bit_vector.clear(__DATA_PAGE_OFFSET_ISSET_ID);
  }

  /** Returns true if field data_page_offset is set (has been assigned a value) and false otherwise */
  public boolean isSetData_page_offset() {
    return __isset_bit_vector.get(__DATA_PAGE_OFFSET_ISSET_ID);
  }

  public void setData_page_offsetIsSet(boolean value) {
    __isset_bit_vector.set(__DATA_PAGE_OFFSET_ISSET_ID, value);
  }

  /**
   * Byte offset from beginning of file to root index page *
   */
  public long getIndex_page_offset() {
    return this.index_page_offset;
  }

  /**
   * Byte offset from beginning of file to root index page *
   */
  public ColumnMetaData setIndex_page_offset(long index_page_offset) {
    this.index_page_offset = index_page_offset;
    setIndex_page_offsetIsSet(true);
    return this;
  }

  public void unsetIndex_page_offset() {
    __isset_bit_vector.clear(__INDEX_PAGE_OFFSET_ISSET_ID);
  }

  /** Returns true if field index_page_offset is set (has been assigned a value) and false otherwise */
  public boolean isSetIndex_page_offset() {
    return __isset_bit_vector.get(__INDEX_PAGE_OFFSET_ISSET_ID);
  }

  public void setIndex_page_offsetIsSet(boolean value) {
    __isset_bit_vector.set(__INDEX_PAGE_OFFSET_ISSET_ID, value);
  }

  /**
   * Byte offset from the beginning of file to first (only) dictionary page *
   */
  public long getDictionary_page_offset() {
    return this.dictionary_page_offset;
  }

  /**
   * Byte offset from the beginning of file to first (only) dictionary page *
   */
  public ColumnMetaData setDictionary_page_offset(long dictionary_page_offset) {
    this.dictionary_page_offset = dictionary_page_offset;
    setDictionary_page_offsetIsSet(true);
    return this;
  }

  public void unsetDictionary_page_offset() {
    __isset_bit_vector.clear(__DICTIONARY_PAGE_OFFSET_ISSET_ID);
  }

  /** Returns true if field dictionary_page_offset is set (has been assigned a value) and false otherwise */
  public boolean isSetDictionary_page_offset() {
    return __isset_bit_vector.get(__DICTIONARY_PAGE_OFFSET_ISSET_ID);
  }

  public void setDictionary_page_offsetIsSet(boolean value) {
    __isset_bit_vector.set(__DICTIONARY_PAGE_OFFSET_ISSET_ID, value);
  }

  /**
   * optional statistics for this column chunk
   */
  public Statistics getStatistics() {
    return this.statistics;
  }

  /**
   * optional statistics for this column chunk
   */
  public ColumnMetaData setStatistics(Statistics statistics) {
    this.statistics = statistics;
    return this;
  }

  public void unsetStatistics() {
    this.statistics = null;
  }

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

  public void setStatisticsIsSet(boolean value) {
    if (!value) {
      this.statistics = null;
    }
  }

  public int getEncoding_statsSize() {
    return (this.encoding_stats == null) ? 0 : this.encoding_stats.size();
  }

  public java.util.Iterator getEncoding_statsIterator() {
    return (this.encoding_stats == null) ? null : this.encoding_stats.iterator();
  }

  public void addToEncoding_stats(PageEncodingStats elem) {
    if (this.encoding_stats == null) {
      this.encoding_stats = new ArrayList();
    }
    this.encoding_stats.add(elem);
  }

  /**
   * Set of all encodings used for pages in this column chunk.
   * This information can be used to determine if all data pages are
   * dictionary encoded for example *
   */
  public List getEncoding_stats() {
    return this.encoding_stats;
  }

  /**
   * Set of all encodings used for pages in this column chunk.
   * This information can be used to determine if all data pages are
   * dictionary encoded for example *
   */
  public ColumnMetaData setEncoding_stats(List encoding_stats) {
    this.encoding_stats = encoding_stats;
    return this;
  }

  public void unsetEncoding_stats() {
    this.encoding_stats = null;
  }

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

  public void setEncoding_statsIsSet(boolean value) {
    if (!value) {
      this.encoding_stats = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((Type)value);
      }
      break;

    case ENCODINGS:
      if (value == null) {
        unsetEncodings();
      } else {
        setEncodings((List)value);
      }
      break;

    case PATH_IN_SCHEMA:
      if (value == null) {
        unsetPath_in_schema();
      } else {
        setPath_in_schema((List)value);
      }
      break;

    case CODEC:
      if (value == null) {
        unsetCodec();
      } else {
        setCodec((CompressionCodec)value);
      }
      break;

    case NUM_VALUES:
      if (value == null) {
        unsetNum_values();
      } else {
        setNum_values((Long)value);
      }
      break;

    case TOTAL_UNCOMPRESSED_SIZE:
      if (value == null) {
        unsetTotal_uncompressed_size();
      } else {
        setTotal_uncompressed_size((Long)value);
      }
      break;

    case TOTAL_COMPRESSED_SIZE:
      if (value == null) {
        unsetTotal_compressed_size();
      } else {
        setTotal_compressed_size((Long)value);
      }
      break;

    case KEY_VALUE_METADATA:
      if (value == null) {
        unsetKey_value_metadata();
      } else {
        setKey_value_metadata((List)value);
      }
      break;

    case DATA_PAGE_OFFSET:
      if (value == null) {
        unsetData_page_offset();
      } else {
        setData_page_offset((Long)value);
      }
      break;

    case INDEX_PAGE_OFFSET:
      if (value == null) {
        unsetIndex_page_offset();
      } else {
        setIndex_page_offset((Long)value);
      }
      break;

    case DICTIONARY_PAGE_OFFSET:
      if (value == null) {
        unsetDictionary_page_offset();
      } else {
        setDictionary_page_offset((Long)value);
      }
      break;

    case STATISTICS:
      if (value == null) {
        unsetStatistics();
      } else {
        setStatistics((Statistics)value);
      }
      break;

    case ENCODING_STATS:
      if (value == null) {
        unsetEncoding_stats();
      } else {
        setEncoding_stats((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case ENCODINGS:
      return getEncodings();

    case PATH_IN_SCHEMA:
      return getPath_in_schema();

    case CODEC:
      return getCodec();

    case NUM_VALUES:
      return Long.valueOf(getNum_values());

    case TOTAL_UNCOMPRESSED_SIZE:
      return Long.valueOf(getTotal_uncompressed_size());

    case TOTAL_COMPRESSED_SIZE:
      return Long.valueOf(getTotal_compressed_size());

    case KEY_VALUE_METADATA:
      return getKey_value_metadata();

    case DATA_PAGE_OFFSET:
      return Long.valueOf(getData_page_offset());

    case INDEX_PAGE_OFFSET:
      return Long.valueOf(getIndex_page_offset());

    case DICTIONARY_PAGE_OFFSET:
      return Long.valueOf(getDictionary_page_offset());

    case STATISTICS:
      return getStatistics();

    case ENCODING_STATS:
      return getEncoding_stats();

    }
    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 ENCODINGS:
      return isSetEncodings();
    case PATH_IN_SCHEMA:
      return isSetPath_in_schema();
    case CODEC:
      return isSetCodec();
    case NUM_VALUES:
      return isSetNum_values();
    case TOTAL_UNCOMPRESSED_SIZE:
      return isSetTotal_uncompressed_size();
    case TOTAL_COMPRESSED_SIZE:
      return isSetTotal_compressed_size();
    case KEY_VALUE_METADATA:
      return isSetKey_value_metadata();
    case DATA_PAGE_OFFSET:
      return isSetData_page_offset();
    case INDEX_PAGE_OFFSET:
      return isSetIndex_page_offset();
    case DICTIONARY_PAGE_OFFSET:
      return isSetDictionary_page_offset();
    case STATISTICS:
      return isSetStatistics();
    case ENCODING_STATS:
      return isSetEncoding_stats();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(ColumnMetaData 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_encodings = true && this.isSetEncodings();
    boolean that_present_encodings = true && that.isSetEncodings();
    if (this_present_encodings || that_present_encodings) {
      if (!(this_present_encodings && that_present_encodings))
        return false;
      if (!this.encodings.equals(that.encodings))
        return false;
    }

    boolean this_present_path_in_schema = true && this.isSetPath_in_schema();
    boolean that_present_path_in_schema = true && that.isSetPath_in_schema();
    if (this_present_path_in_schema || that_present_path_in_schema) {
      if (!(this_present_path_in_schema && that_present_path_in_schema))
        return false;
      if (!this.path_in_schema.equals(that.path_in_schema))
        return false;
    }

    boolean this_present_codec = true && this.isSetCodec();
    boolean that_present_codec = true && that.isSetCodec();
    if (this_present_codec || that_present_codec) {
      if (!(this_present_codec && that_present_codec))
        return false;
      if (!this.codec.equals(that.codec))
        return false;
    }

    boolean this_present_num_values = true;
    boolean that_present_num_values = true;
    if (this_present_num_values || that_present_num_values) {
      if (!(this_present_num_values && that_present_num_values))
        return false;
      if (this.num_values != that.num_values)
        return false;
    }

    boolean this_present_total_uncompressed_size = true;
    boolean that_present_total_uncompressed_size = true;
    if (this_present_total_uncompressed_size || that_present_total_uncompressed_size) {
      if (!(this_present_total_uncompressed_size && that_present_total_uncompressed_size))
        return false;
      if (this.total_uncompressed_size != that.total_uncompressed_size)
        return false;
    }

    boolean this_present_total_compressed_size = true;
    boolean that_present_total_compressed_size = true;
    if (this_present_total_compressed_size || that_present_total_compressed_size) {
      if (!(this_present_total_compressed_size && that_present_total_compressed_size))
        return false;
      if (this.total_compressed_size != that.total_compressed_size)
        return false;
    }

    boolean this_present_key_value_metadata = true && this.isSetKey_value_metadata();
    boolean that_present_key_value_metadata = true && that.isSetKey_value_metadata();
    if (this_present_key_value_metadata || that_present_key_value_metadata) {
      if (!(this_present_key_value_metadata && that_present_key_value_metadata))
        return false;
      if (!this.key_value_metadata.equals(that.key_value_metadata))
        return false;
    }

    boolean this_present_data_page_offset = true;
    boolean that_present_data_page_offset = true;
    if (this_present_data_page_offset || that_present_data_page_offset) {
      if (!(this_present_data_page_offset && that_present_data_page_offset))
        return false;
      if (this.data_page_offset != that.data_page_offset)
        return false;
    }

    boolean this_present_index_page_offset = true && this.isSetIndex_page_offset();
    boolean that_present_index_page_offset = true && that.isSetIndex_page_offset();
    if (this_present_index_page_offset || that_present_index_page_offset) {
      if (!(this_present_index_page_offset && that_present_index_page_offset))
        return false;
      if (this.index_page_offset != that.index_page_offset)
        return false;
    }

    boolean this_present_dictionary_page_offset = true && this.isSetDictionary_page_offset();
    boolean that_present_dictionary_page_offset = true && that.isSetDictionary_page_offset();
    if (this_present_dictionary_page_offset || that_present_dictionary_page_offset) {
      if (!(this_present_dictionary_page_offset && that_present_dictionary_page_offset))
        return false;
      if (this.dictionary_page_offset != that.dictionary_page_offset)
        return false;
    }

    boolean this_present_statistics = true && this.isSetStatistics();
    boolean that_present_statistics = true && that.isSetStatistics();
    if (this_present_statistics || that_present_statistics) {
      if (!(this_present_statistics && that_present_statistics))
        return false;
      if (!this.statistics.equals(that.statistics))
        return false;
    }

    boolean this_present_encoding_stats = true && this.isSetEncoding_stats();
    boolean that_present_encoding_stats = true && that.isSetEncoding_stats();
    if (this_present_encoding_stats || that_present_encoding_stats) {
      if (!(this_present_encoding_stats && that_present_encoding_stats))
        return false;
      if (!this.encoding_stats.equals(that.encoding_stats))
        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_encodings = true && (isSetEncodings());
    builder.append(present_encodings);
    if (present_encodings)
      builder.append(encodings);

    boolean present_path_in_schema = true && (isSetPath_in_schema());
    builder.append(present_path_in_schema);
    if (present_path_in_schema)
      builder.append(path_in_schema);

    boolean present_codec = true && (isSetCodec());
    builder.append(present_codec);
    if (present_codec)
      builder.append(codec.getValue());

    boolean present_num_values = true;
    builder.append(present_num_values);
    if (present_num_values)
      builder.append(num_values);

    boolean present_total_uncompressed_size = true;
    builder.append(present_total_uncompressed_size);
    if (present_total_uncompressed_size)
      builder.append(total_uncompressed_size);

    boolean present_total_compressed_size = true;
    builder.append(present_total_compressed_size);
    if (present_total_compressed_size)
      builder.append(total_compressed_size);

    boolean present_key_value_metadata = true && (isSetKey_value_metadata());
    builder.append(present_key_value_metadata);
    if (present_key_value_metadata)
      builder.append(key_value_metadata);

    boolean present_data_page_offset = true;
    builder.append(present_data_page_offset);
    if (present_data_page_offset)
      builder.append(data_page_offset);

    boolean present_index_page_offset = true && (isSetIndex_page_offset());
    builder.append(present_index_page_offset);
    if (present_index_page_offset)
      builder.append(index_page_offset);

    boolean present_dictionary_page_offset = true && (isSetDictionary_page_offset());
    builder.append(present_dictionary_page_offset);
    if (present_dictionary_page_offset)
      builder.append(dictionary_page_offset);

    boolean present_statistics = true && (isSetStatistics());
    builder.append(present_statistics);
    if (present_statistics)
      builder.append(statistics);

    boolean present_encoding_stats = true && (isSetEncoding_stats());
    builder.append(present_encoding_stats);
    if (present_encoding_stats)
      builder.append(encoding_stats);

    return builder.toHashCode();
  }

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

    int lastComparison = 0;
    ColumnMetaData typedOther = (ColumnMetaData)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(isSetEncodings()).compareTo(typedOther.isSetEncodings());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEncodings()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.encodings, typedOther.encodings);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPath_in_schema()).compareTo(typedOther.isSetPath_in_schema());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPath_in_schema()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path_in_schema, typedOther.path_in_schema);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCodec()).compareTo(typedOther.isSetCodec());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCodec()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.codec, typedOther.codec);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNum_values()).compareTo(typedOther.isSetNum_values());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNum_values()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_values, typedOther.num_values);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotal_uncompressed_size()).compareTo(typedOther.isSetTotal_uncompressed_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotal_uncompressed_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_uncompressed_size, typedOther.total_uncompressed_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotal_compressed_size()).compareTo(typedOther.isSetTotal_compressed_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotal_compressed_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_compressed_size, typedOther.total_compressed_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetKey_value_metadata()).compareTo(typedOther.isSetKey_value_metadata());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKey_value_metadata()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key_value_metadata, typedOther.key_value_metadata);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetData_page_offset()).compareTo(typedOther.isSetData_page_offset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetData_page_offset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_page_offset, typedOther.data_page_offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIndex_page_offset()).compareTo(typedOther.isSetIndex_page_offset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndex_page_offset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_page_offset, typedOther.index_page_offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDictionary_page_offset()).compareTo(typedOther.isSetDictionary_page_offset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDictionary_page_offset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dictionary_page_offset, typedOther.dictionary_page_offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatistics()).compareTo(typedOther.isSetStatistics());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatistics()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statistics, typedOther.statistics);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEncoding_stats()).compareTo(typedOther.isSetEncoding_stats());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEncoding_stats()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.encoding_stats, typedOther.encoding_stats);
      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 = Type.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ENCODINGS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
              this.encodings = new ArrayList(_list0.size);
              for (int _i1 = 0; _i1 < _list0.size; ++_i1)
              {
                Encoding _elem2; // required
                _elem2 = Encoding.findByValue(iprot.readI32());
                this.encodings.add(_elem2);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // PATH_IN_SCHEMA
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
              this.path_in_schema = new ArrayList(_list3.size);
              for (int _i4 = 0; _i4 < _list3.size; ++_i4)
              {
                String _elem5; // required
                _elem5 = iprot.readString();
                this.path_in_schema.add(_elem5);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CODEC
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.codec = CompressionCodec.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // NUM_VALUES
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.num_values = iprot.readI64();
            setNum_valuesIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // TOTAL_UNCOMPRESSED_SIZE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.total_uncompressed_size = iprot.readI64();
            setTotal_uncompressed_sizeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // TOTAL_COMPRESSED_SIZE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.total_compressed_size = iprot.readI64();
            setTotal_compressed_sizeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // KEY_VALUE_METADATA
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list6 = iprot.readListBegin();
              this.key_value_metadata = new ArrayList(_list6.size);
              for (int _i7 = 0; _i7 < _list6.size; ++_i7)
              {
                KeyValue _elem8; // required
                _elem8 = new KeyValue();
                _elem8.read(iprot);
                this.key_value_metadata.add(_elem8);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // DATA_PAGE_OFFSET
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.data_page_offset = iprot.readI64();
            setData_page_offsetIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // INDEX_PAGE_OFFSET
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.index_page_offset = iprot.readI64();
            setIndex_page_offsetIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // DICTIONARY_PAGE_OFFSET
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.dictionary_page_offset = iprot.readI64();
            setDictionary_page_offsetIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 12: // STATISTICS
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.statistics = new Statistics();
            this.statistics.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 13: // ENCODING_STATS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list9 = iprot.readListBegin();
              this.encoding_stats = new ArrayList(_list9.size);
              for (int _i10 = 0; _i10 < _list9.size; ++_i10)
              {
                PageEncodingStats _elem11; // required
                _elem11 = new PageEncodingStats();
                _elem11.read(iprot);
                this.encoding_stats.add(_elem11);
              }
              iprot.readListEnd();
            }
          } 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 (!isSetNum_values()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'num_values' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetTotal_uncompressed_size()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'total_uncompressed_size' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetTotal_compressed_size()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'total_compressed_size' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetData_page_offset()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'data_page_offset' 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();
    }
    if (this.encodings != null) {
      oprot.writeFieldBegin(ENCODINGS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, this.encodings.size()));
        for (Encoding _iter12 : this.encodings)
        {
          oprot.writeI32(_iter12.getValue());
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.path_in_schema != null) {
      oprot.writeFieldBegin(PATH_IN_SCHEMA_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.path_in_schema.size()));
        for (String _iter13 : this.path_in_schema)
        {
          oprot.writeString(_iter13);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.codec != null) {
      oprot.writeFieldBegin(CODEC_FIELD_DESC);
      oprot.writeI32(this.codec.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(NUM_VALUES_FIELD_DESC);
    oprot.writeI64(this.num_values);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_UNCOMPRESSED_SIZE_FIELD_DESC);
    oprot.writeI64(this.total_uncompressed_size);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_COMPRESSED_SIZE_FIELD_DESC);
    oprot.writeI64(this.total_compressed_size);
    oprot.writeFieldEnd();
    if (this.key_value_metadata != null) {
      if (isSetKey_value_metadata()) {
        oprot.writeFieldBegin(KEY_VALUE_METADATA_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.key_value_metadata.size()));
          for (KeyValue _iter14 : this.key_value_metadata)
          {
            _iter14.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldBegin(DATA_PAGE_OFFSET_FIELD_DESC);
    oprot.writeI64(this.data_page_offset);
    oprot.writeFieldEnd();
    if (isSetIndex_page_offset()) {
      oprot.writeFieldBegin(INDEX_PAGE_OFFSET_FIELD_DESC);
      oprot.writeI64(this.index_page_offset);
      oprot.writeFieldEnd();
    }
    if (isSetDictionary_page_offset()) {
      oprot.writeFieldBegin(DICTIONARY_PAGE_OFFSET_FIELD_DESC);
      oprot.writeI64(this.dictionary_page_offset);
      oprot.writeFieldEnd();
    }
    if (this.statistics != null) {
      if (isSetStatistics()) {
        oprot.writeFieldBegin(STATISTICS_FIELD_DESC);
        this.statistics.write(oprot);
        oprot.writeFieldEnd();
      }
    }
    if (this.encoding_stats != null) {
      if (isSetEncoding_stats()) {
        oprot.writeFieldBegin(ENCODING_STATS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.encoding_stats.size()));
          for (PageEncodingStats _iter15 : this.encoding_stats)
          {
            _iter15.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ColumnMetaData(");
    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("encodings:");
    if (this.encodings == null) {
      sb.append("null");
    } else {
      sb.append(this.encodings);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("path_in_schema:");
    if (this.path_in_schema == null) {
      sb.append("null");
    } else {
      sb.append(this.path_in_schema);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("codec:");
    if (this.codec == null) {
      sb.append("null");
    } else {
      sb.append(this.codec);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("num_values:");
    sb.append(this.num_values);
    first = false;
    if (!first) sb.append(", ");
    sb.append("total_uncompressed_size:");
    sb.append(this.total_uncompressed_size);
    first = false;
    if (!first) sb.append(", ");
    sb.append("total_compressed_size:");
    sb.append(this.total_compressed_size);
    first = false;
    if (isSetKey_value_metadata()) {
      if (!first) sb.append(", ");
      sb.append("key_value_metadata:");
      if (this.key_value_metadata == null) {
        sb.append("null");
      } else {
        sb.append(this.key_value_metadata);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("data_page_offset:");
    sb.append(this.data_page_offset);
    first = false;
    if (isSetIndex_page_offset()) {
      if (!first) sb.append(", ");
      sb.append("index_page_offset:");
      sb.append(this.index_page_offset);
      first = false;
    }
    if (isSetDictionary_page_offset()) {
      if (!first) sb.append(", ");
      sb.append("dictionary_page_offset:");
      sb.append(this.dictionary_page_offset);
      first = false;
    }
    if (isSetStatistics()) {
      if (!first) sb.append(", ");
      sb.append("statistics:");
      if (this.statistics == null) {
        sb.append("null");
      } else {
        sb.append(this.statistics);
      }
      first = false;
    }
    if (isSetEncoding_stats()) {
      if (!first) sb.append(", ");
      sb.append("encoding_stats:");
      if (this.encoding_stats == null) {
        sb.append("null");
      } else {
        sb.append(this.encoding_stats);
      }
      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());
    }
    if (encodings == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'encodings' was not present! Struct: " + toString());
    }
    if (path_in_schema == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'path_in_schema' was not present! Struct: " + toString());
    }
    if (codec == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'codec' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'num_values' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'total_uncompressed_size' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'total_compressed_size' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'data_page_offset' 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);
    }
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy