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

org.apache.parquet.format.FileMetaData 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.6.0
Show newest version
/**
 * 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"})
/**
 * Description for file metadata
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-10-17")
public class FileMetaData 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("FileMetaData");

  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("schema", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField NUM_ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("num_rows", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField ROW_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("row_groups", org.apache.thrift.protocol.TType.LIST, (short)4);
  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)5);
  private static final org.apache.thrift.protocol.TField CREATED_BY_FIELD_DESC = new org.apache.thrift.protocol.TField("created_by", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField COLUMN_ORDERS_FIELD_DESC = new org.apache.thrift.protocol.TField("column_orders", org.apache.thrift.protocol.TType.LIST, (short)7);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new FileMetaDataStandardSchemeFactory());
    schemes.put(TupleScheme.class, new FileMetaDataTupleSchemeFactory());
  }

  /**
   * Version of this file *
   */
  public int version; // required
  /**
   * Parquet schema for this file.  This schema contains metadata for all the columns.
   * The schema is represented as a tree with a single root.  The nodes of the tree
   * are flattened to a list by doing a depth-first traversal.
   * The column metadata contains the path in the schema for that column which can be
   * used to map columns to nodes in the schema.
   * The first element is the root *
   */
  public List schema; // required
  /**
   * Number of rows in this file *
   */
  public long num_rows; // required
  /**
   * Row groups in this file *
   */
  public List row_groups; // required
  /**
   * Optional key/value metadata *
   */
  public List key_value_metadata; // optional
  /**
   * String for application that wrote this file.  This should be in the format
   *  version  (build ).
   * e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
   * 
   */
  public String created_by; // optional
  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Each sort order corresponds to one column, determined by its
   * position in the list, matching the position of the column in the schema.
   * 
   * Without column_orders, the meaning of the min_value and max_value fields is
   * undefined. To ensure well-defined behaviour, if min_value and max_value are
   * written to a Parquet file, column_orders must be written as well.
   * 
   * The obsolete min and max fields are always sorted by signed comparison
   * regardless of column_orders.
   */
  public List column_orders; // 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 {
    /**
     * Version of this file *
     */
    VERSION((short)1, "version"),
    /**
     * Parquet schema for this file.  This schema contains metadata for all the columns.
     * The schema is represented as a tree with a single root.  The nodes of the tree
     * are flattened to a list by doing a depth-first traversal.
     * The column metadata contains the path in the schema for that column which can be
     * used to map columns to nodes in the schema.
     * The first element is the root *
     */
    SCHEMA((short)2, "schema"),
    /**
     * Number of rows in this file *
     */
    NUM_ROWS((short)3, "num_rows"),
    /**
     * Row groups in this file *
     */
    ROW_GROUPS((short)4, "row_groups"),
    /**
     * Optional key/value metadata *
     */
    KEY_VALUE_METADATA((short)5, "key_value_metadata"),
    /**
     * String for application that wrote this file.  This should be in the format
     *  version  (build ).
     * e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
     * 
     */
    CREATED_BY((short)6, "created_by"),
    /**
     * Sort order used for the min_value and max_value fields of each column in
     * this file. Each sort order corresponds to one column, determined by its
     * position in the list, matching the position of the column in the schema.
     * 
     * Without column_orders, the meaning of the min_value and max_value fields is
     * undefined. To ensure well-defined behaviour, if min_value and max_value are
     * written to a Parquet file, column_orders must be written as well.
     * 
     * The obsolete min and max fields are always sorted by signed comparison
     * regardless of column_orders.
     */
    COLUMN_ORDERS((short)7, "column_orders");

    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: // VERSION
          return VERSION;
        case 2: // SCHEMA
          return SCHEMA;
        case 3: // NUM_ROWS
          return NUM_ROWS;
        case 4: // ROW_GROUPS
          return ROW_GROUPS;
        case 5: // KEY_VALUE_METADATA
          return KEY_VALUE_METADATA;
        case 6: // CREATED_BY
          return CREATED_BY;
        case 7: // COLUMN_ORDERS
          return COLUMN_ORDERS;
        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 __VERSION_ISSET_ID = 0;
  private static final int __NUM_ROWS_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.KEY_VALUE_METADATA,_Fields.CREATED_BY,_Fields.COLUMN_ORDERS};
  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.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SchemaElement.class))));
    tmpMap.put(_Fields.NUM_ROWS, new org.apache.thrift.meta_data.FieldMetaData("num_rows", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ROW_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("row_groups", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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, RowGroup.class))));
    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.CREATED_BY, new org.apache.thrift.meta_data.FieldMetaData("created_by", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.COLUMN_ORDERS, new org.apache.thrift.meta_data.FieldMetaData("column_orders", 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, ColumnOrder.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FileMetaData.class, metaDataMap);
  }

  public FileMetaData() {
  }

  public FileMetaData(
    int version,
    List schema,
    long num_rows,
    List row_groups)
  {
    this();
    this.version = version;
    setVersionIsSet(true);
    this.schema = schema;
    this.num_rows = num_rows;
    setNum_rowsIsSet(true);
    this.row_groups = row_groups;
  }

  /**
   * Performs a deep copy on other.
   */
  public FileMetaData(FileMetaData other) {
    __isset_bitfield = other.__isset_bitfield;
    this.version = other.version;
    if (other.isSetSchema()) {
      List __this__schema = new ArrayList(other.schema.size());
      for (SchemaElement other_element : other.schema) {
        __this__schema.add(new SchemaElement(other_element));
      }
      this.schema = __this__schema;
    }
    this.num_rows = other.num_rows;
    if (other.isSetRow_groups()) {
      List __this__row_groups = new ArrayList(other.row_groups.size());
      for (RowGroup other_element : other.row_groups) {
        __this__row_groups.add(new RowGroup(other_element));
      }
      this.row_groups = __this__row_groups;
    }
    if (other.isSetKey_value_metadata()) {
      List __this__key_value_metadata = new ArrayList(other.key_value_metadata.size());
      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;
    }
    if (other.isSetCreated_by()) {
      this.created_by = other.created_by;
    }
    if (other.isSetColumn_orders()) {
      List __this__column_orders = new ArrayList(other.column_orders.size());
      for (ColumnOrder other_element : other.column_orders) {
        __this__column_orders.add(new ColumnOrder(other_element));
      }
      this.column_orders = __this__column_orders;
    }
  }

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

  @Override
  public void clear() {
    setVersionIsSet(false);
    this.version = 0;
    this.schema = null;
    setNum_rowsIsSet(false);
    this.num_rows = 0;
    this.row_groups = null;
    this.key_value_metadata = null;
    this.created_by = null;
    this.column_orders = null;
  }

  /**
   * Version of this file *
   */
  public int getVersion() {
    return this.version;
  }

  /**
   * Version of this file *
   */
  public FileMetaData setVersion(int version) {
    this.version = version;
    setVersionIsSet(true);
    return this;
  }

  public void unsetVersion() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  /** Returns true if field version is set (has been assigned a value) and false otherwise */
  public boolean isSetVersion() {
    return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  public void setVersionIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
  }

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

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

  public void addToSchema(SchemaElement elem) {
    if (this.schema == null) {
      this.schema = new ArrayList();
    }
    this.schema.add(elem);
  }

  /**
   * Parquet schema for this file.  This schema contains metadata for all the columns.
   * The schema is represented as a tree with a single root.  The nodes of the tree
   * are flattened to a list by doing a depth-first traversal.
   * The column metadata contains the path in the schema for that column which can be
   * used to map columns to nodes in the schema.
   * The first element is the root *
   */
  public List getSchema() {
    return this.schema;
  }

  /**
   * Parquet schema for this file.  This schema contains metadata for all the columns.
   * The schema is represented as a tree with a single root.  The nodes of the tree
   * are flattened to a list by doing a depth-first traversal.
   * The column metadata contains the path in the schema for that column which can be
   * used to map columns to nodes in the schema.
   * The first element is the root *
   */
  public FileMetaData setSchema(List schema) {
    this.schema = schema;
    return this;
  }

  public void unsetSchema() {
    this.schema = null;
  }

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

  public void setSchemaIsSet(boolean value) {
    if (!value) {
      this.schema = null;
    }
  }

  /**
   * Number of rows in this file *
   */
  public long getNum_rows() {
    return this.num_rows;
  }

  /**
   * Number of rows in this file *
   */
  public FileMetaData setNum_rows(long num_rows) {
    this.num_rows = num_rows;
    setNum_rowsIsSet(true);
    return this;
  }

  public void unsetNum_rows() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_ROWS_ISSET_ID);
  }

  /** Returns true if field num_rows is set (has been assigned a value) and false otherwise */
  public boolean isSetNum_rows() {
    return EncodingUtils.testBit(__isset_bitfield, __NUM_ROWS_ISSET_ID);
  }

  public void setNum_rowsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_ROWS_ISSET_ID, value);
  }

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

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

  public void addToRow_groups(RowGroup elem) {
    if (this.row_groups == null) {
      this.row_groups = new ArrayList();
    }
    this.row_groups.add(elem);
  }

  /**
   * Row groups in this file *
   */
  public List getRow_groups() {
    return this.row_groups;
  }

  /**
   * Row groups in this file *
   */
  public FileMetaData setRow_groups(List row_groups) {
    this.row_groups = row_groups;
    return this;
  }

  public void unsetRow_groups() {
    this.row_groups = null;
  }

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

  public void setRow_groupsIsSet(boolean value) {
    if (!value) {
      this.row_groups = null;
    }
  }

  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 FileMetaData 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;
    }
  }

  /**
   * String for application that wrote this file.  This should be in the format
   *  version  (build ).
   * e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
   * 
   */
  public String getCreated_by() {
    return this.created_by;
  }

  /**
   * String for application that wrote this file.  This should be in the format
   *  version  (build ).
   * e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
   * 
   */
  public FileMetaData setCreated_by(String created_by) {
    this.created_by = created_by;
    return this;
  }

  public void unsetCreated_by() {
    this.created_by = null;
  }

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

  public void setCreated_byIsSet(boolean value) {
    if (!value) {
      this.created_by = null;
    }
  }

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

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

  public void addToColumn_orders(ColumnOrder elem) {
    if (this.column_orders == null) {
      this.column_orders = new ArrayList();
    }
    this.column_orders.add(elem);
  }

  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Each sort order corresponds to one column, determined by its
   * position in the list, matching the position of the column in the schema.
   * 
   * Without column_orders, the meaning of the min_value and max_value fields is
   * undefined. To ensure well-defined behaviour, if min_value and max_value are
   * written to a Parquet file, column_orders must be written as well.
   * 
   * The obsolete min and max fields are always sorted by signed comparison
   * regardless of column_orders.
   */
  public List getColumn_orders() {
    return this.column_orders;
  }

  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Each sort order corresponds to one column, determined by its
   * position in the list, matching the position of the column in the schema.
   * 
   * Without column_orders, the meaning of the min_value and max_value fields is
   * undefined. To ensure well-defined behaviour, if min_value and max_value are
   * written to a Parquet file, column_orders must be written as well.
   * 
   * The obsolete min and max fields are always sorted by signed comparison
   * regardless of column_orders.
   */
  public FileMetaData setColumn_orders(List column_orders) {
    this.column_orders = column_orders;
    return this;
  }

  public void unsetColumn_orders() {
    this.column_orders = null;
  }

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

  public void setColumn_ordersIsSet(boolean value) {
    if (!value) {
      this.column_orders = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((Integer)value);
      }
      break;

    case SCHEMA:
      if (value == null) {
        unsetSchema();
      } else {
        setSchema((List)value);
      }
      break;

    case NUM_ROWS:
      if (value == null) {
        unsetNum_rows();
      } else {
        setNum_rows((Long)value);
      }
      break;

    case ROW_GROUPS:
      if (value == null) {
        unsetRow_groups();
      } else {
        setRow_groups((List)value);
      }
      break;

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

    case CREATED_BY:
      if (value == null) {
        unsetCreated_by();
      } else {
        setCreated_by((String)value);
      }
      break;

    case COLUMN_ORDERS:
      if (value == null) {
        unsetColumn_orders();
      } else {
        setColumn_orders((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case VERSION:
      return getVersion();

    case SCHEMA:
      return getSchema();

    case NUM_ROWS:
      return getNum_rows();

    case ROW_GROUPS:
      return getRow_groups();

    case KEY_VALUE_METADATA:
      return getKey_value_metadata();

    case CREATED_BY:
      return getCreated_by();

    case COLUMN_ORDERS:
      return getColumn_orders();

    }
    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 VERSION:
      return isSetVersion();
    case SCHEMA:
      return isSetSchema();
    case NUM_ROWS:
      return isSetNum_rows();
    case ROW_GROUPS:
      return isSetRow_groups();
    case KEY_VALUE_METADATA:
      return isSetKey_value_metadata();
    case CREATED_BY:
      return isSetCreated_by();
    case COLUMN_ORDERS:
      return isSetColumn_orders();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(FileMetaData that) {
    if (that == null)
      return false;

    boolean this_present_version = true;
    boolean that_present_version = true;
    if (this_present_version || that_present_version) {
      if (!(this_present_version && that_present_version))
        return false;
      if (this.version != that.version)
        return false;
    }

    boolean this_present_schema = true && this.isSetSchema();
    boolean that_present_schema = true && that.isSetSchema();
    if (this_present_schema || that_present_schema) {
      if (!(this_present_schema && that_present_schema))
        return false;
      if (!this.schema.equals(that.schema))
        return false;
    }

    boolean this_present_num_rows = true;
    boolean that_present_num_rows = true;
    if (this_present_num_rows || that_present_num_rows) {
      if (!(this_present_num_rows && that_present_num_rows))
        return false;
      if (this.num_rows != that.num_rows)
        return false;
    }

    boolean this_present_row_groups = true && this.isSetRow_groups();
    boolean that_present_row_groups = true && that.isSetRow_groups();
    if (this_present_row_groups || that_present_row_groups) {
      if (!(this_present_row_groups && that_present_row_groups))
        return false;
      if (!this.row_groups.equals(that.row_groups))
        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_created_by = true && this.isSetCreated_by();
    boolean that_present_created_by = true && that.isSetCreated_by();
    if (this_present_created_by || that_present_created_by) {
      if (!(this_present_created_by && that_present_created_by))
        return false;
      if (!this.created_by.equals(that.created_by))
        return false;
    }

    boolean this_present_column_orders = true && this.isSetColumn_orders();
    boolean that_present_column_orders = true && that.isSetColumn_orders();
    if (this_present_column_orders || that_present_column_orders) {
      if (!(this_present_column_orders && that_present_column_orders))
        return false;
      if (!this.column_orders.equals(that.column_orders))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_version = true;
    list.add(present_version);
    if (present_version)
      list.add(version);

    boolean present_schema = true && (isSetSchema());
    list.add(present_schema);
    if (present_schema)
      list.add(schema);

    boolean present_num_rows = true;
    list.add(present_num_rows);
    if (present_num_rows)
      list.add(num_rows);

    boolean present_row_groups = true && (isSetRow_groups());
    list.add(present_row_groups);
    if (present_row_groups)
      list.add(row_groups);

    boolean present_key_value_metadata = true && (isSetKey_value_metadata());
    list.add(present_key_value_metadata);
    if (present_key_value_metadata)
      list.add(key_value_metadata);

    boolean present_created_by = true && (isSetCreated_by());
    list.add(present_created_by);
    if (present_created_by)
      list.add(created_by);

    boolean present_column_orders = true && (isSetColumn_orders());
    list.add(present_column_orders);
    if (present_column_orders)
      list.add(column_orders);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSchema()).compareTo(other.isSetSchema());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSchema()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schema, other.schema);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNum_rows()).compareTo(other.isSetNum_rows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNum_rows()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_rows, other.num_rows);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRow_groups()).compareTo(other.isSetRow_groups());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRow_groups()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row_groups, other.row_groups);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetKey_value_metadata()).compareTo(other.isSetKey_value_metadata());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKey_value_metadata()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key_value_metadata, other.key_value_metadata);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreated_by()).compareTo(other.isSetCreated_by());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreated_by()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.created_by, other.created_by);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColumn_orders()).compareTo(other.isSetColumn_orders());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumn_orders()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_orders, other.column_orders);
      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 {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("FileMetaData(");
    boolean first = true;

    sb.append("version:");
    sb.append(this.version);
    first = false;
    if (!first) sb.append(", ");
    sb.append("schema:");
    if (this.schema == null) {
      sb.append("null");
    } else {
      sb.append(this.schema);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("num_rows:");
    sb.append(this.num_rows);
    first = false;
    if (!first) sb.append(", ");
    sb.append("row_groups:");
    if (this.row_groups == null) {
      sb.append("null");
    } else {
      sb.append(this.row_groups);
    }
    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 (isSetCreated_by()) {
      if (!first) sb.append(", ");
      sb.append("created_by:");
      if (this.created_by == null) {
        sb.append("null");
      } else {
        sb.append(this.created_by);
      }
      first = false;
    }
    if (isSetColumn_orders()) {
      if (!first) sb.append(", ");
      sb.append("column_orders:");
      if (this.column_orders == null) {
        sb.append("null");
      } else {
        sb.append(this.column_orders);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

  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_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class FileMetaDataStandardSchemeFactory implements SchemeFactory {
    public FileMetaDataStandardScheme getScheme() {
      return new FileMetaDataStandardScheme();
    }
  }

  private static class FileMetaDataStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FileMetaData struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.version = iprot.readI32();
              struct.setVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SCHEMA
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list88 = iprot.readListBegin();
                struct.schema = new ArrayList(_list88.size);
                SchemaElement _elem89;
                for (int _i90 = 0; _i90 < _list88.size; ++_i90)
                {
                  _elem89 = new SchemaElement();
                  _elem89.read(iprot);
                  struct.schema.add(_elem89);
                }
                iprot.readListEnd();
              }
              struct.setSchemaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NUM_ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.num_rows = iprot.readI64();
              struct.setNum_rowsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ROW_GROUPS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list91 = iprot.readListBegin();
                struct.row_groups = new ArrayList(_list91.size);
                RowGroup _elem92;
                for (int _i93 = 0; _i93 < _list91.size; ++_i93)
                {
                  _elem92 = new RowGroup();
                  _elem92.read(iprot);
                  struct.row_groups.add(_elem92);
                }
                iprot.readListEnd();
              }
              struct.setRow_groupsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // KEY_VALUE_METADATA
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list94 = iprot.readListBegin();
                struct.key_value_metadata = new ArrayList(_list94.size);
                KeyValue _elem95;
                for (int _i96 = 0; _i96 < _list94.size; ++_i96)
                {
                  _elem95 = new KeyValue();
                  _elem95.read(iprot);
                  struct.key_value_metadata.add(_elem95);
                }
                iprot.readListEnd();
              }
              struct.setKey_value_metadataIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // CREATED_BY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.created_by = iprot.readString();
              struct.setCreated_byIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // COLUMN_ORDERS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list97 = iprot.readListBegin();
                struct.column_orders = new ArrayList(_list97.size);
                ColumnOrder _elem98;
                for (int _i99 = 0; _i99 < _list97.size; ++_i99)
                {
                  _elem98 = new ColumnOrder();
                  _elem98.read(iprot);
                  struct.column_orders.add(_elem98);
                }
                iprot.readListEnd();
              }
              struct.setColumn_ordersIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(VERSION_FIELD_DESC);
      oprot.writeI32(struct.version);
      oprot.writeFieldEnd();
      if (struct.schema != null) {
        oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.schema.size()));
          for (SchemaElement _iter100 : struct.schema)
          {
            _iter100.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(NUM_ROWS_FIELD_DESC);
      oprot.writeI64(struct.num_rows);
      oprot.writeFieldEnd();
      if (struct.row_groups != null) {
        oprot.writeFieldBegin(ROW_GROUPS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.row_groups.size()));
          for (RowGroup _iter101 : struct.row_groups)
          {
            _iter101.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.key_value_metadata != null) {
        if (struct.isSetKey_value_metadata()) {
          oprot.writeFieldBegin(KEY_VALUE_METADATA_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.key_value_metadata.size()));
            for (KeyValue _iter102 : struct.key_value_metadata)
            {
              _iter102.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.created_by != null) {
        if (struct.isSetCreated_by()) {
          oprot.writeFieldBegin(CREATED_BY_FIELD_DESC);
          oprot.writeString(struct.created_by);
          oprot.writeFieldEnd();
        }
      }
      if (struct.column_orders != null) {
        if (struct.isSetColumn_orders()) {
          oprot.writeFieldBegin(COLUMN_ORDERS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.column_orders.size()));
            for (ColumnOrder _iter103 : struct.column_orders)
            {
              _iter103.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FileMetaDataTupleSchemeFactory implements SchemeFactory {
    public FileMetaDataTupleScheme getScheme() {
      return new FileMetaDataTupleScheme();
    }
  }

  private static class FileMetaDataTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FileMetaData struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI32(struct.version);
      {
        oprot.writeI32(struct.schema.size());
        for (SchemaElement _iter104 : struct.schema)
        {
          _iter104.write(oprot);
        }
      }
      oprot.writeI64(struct.num_rows);
      {
        oprot.writeI32(struct.row_groups.size());
        for (RowGroup _iter105 : struct.row_groups)
        {
          _iter105.write(oprot);
        }
      }
      BitSet optionals = new BitSet();
      if (struct.isSetKey_value_metadata()) {
        optionals.set(0);
      }
      if (struct.isSetCreated_by()) {
        optionals.set(1);
      }
      if (struct.isSetColumn_orders()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetKey_value_metadata()) {
        {
          oprot.writeI32(struct.key_value_metadata.size());
          for (KeyValue _iter106 : struct.key_value_metadata)
          {
            _iter106.write(oprot);
          }
        }
      }
      if (struct.isSetCreated_by()) {
        oprot.writeString(struct.created_by);
      }
      if (struct.isSetColumn_orders()) {
        {
          oprot.writeI32(struct.column_orders.size());
          for (ColumnOrder _iter107 : struct.column_orders)
          {
            _iter107.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FileMetaData struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.version = iprot.readI32();
      struct.setVersionIsSet(true);
      {
        org.apache.thrift.protocol.TList _list108 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
        struct.schema = new ArrayList(_list108.size);
        SchemaElement _elem109;
        for (int _i110 = 0; _i110 < _list108.size; ++_i110)
        {
          _elem109 = new SchemaElement();
          _elem109.read(iprot);
          struct.schema.add(_elem109);
        }
      }
      struct.setSchemaIsSet(true);
      struct.num_rows = iprot.readI64();
      struct.setNum_rowsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list111 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
        struct.row_groups = new ArrayList(_list111.size);
        RowGroup _elem112;
        for (int _i113 = 0; _i113 < _list111.size; ++_i113)
        {
          _elem112 = new RowGroup();
          _elem112.read(iprot);
          struct.row_groups.add(_elem112);
        }
      }
      struct.setRow_groupsIsSet(true);
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list114 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.key_value_metadata = new ArrayList(_list114.size);
          KeyValue _elem115;
          for (int _i116 = 0; _i116 < _list114.size; ++_i116)
          {
            _elem115 = new KeyValue();
            _elem115.read(iprot);
            struct.key_value_metadata.add(_elem115);
          }
        }
        struct.setKey_value_metadataIsSet(true);
      }
      if (incoming.get(1)) {
        struct.created_by = iprot.readString();
        struct.setCreated_byIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list117 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.column_orders = new ArrayList(_list117.size);
          ColumnOrder _elem118;
          for (int _i119 = 0; _i119 < _list117.size; ++_i119)
          {
            _elem118 = new ColumnOrder();
            _elem118.read(iprot);
            struct.column_orders.add(_elem118);
          }
        }
        struct.setColumn_ordersIsSet(true);
      }
    }
  }

}