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

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

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.parquet.format;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
/**
 * Description for file metadata
 */
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2023-05-12")
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 org.apache.thrift.protocol.TField ENCRYPTION_ALGORITHM_FIELD_DESC = new org.apache.thrift.protocol.TField("encryption_algorithm", org.apache.thrift.protocol.TType.STRUCT, (short)8);
  private static final org.apache.thrift.protocol.TField FOOTER_SIGNING_KEY_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("footer_signing_key_metadata", org.apache.thrift.protocol.TType.STRING, (short)9);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new FileMetaDataStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = 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 @org.apache.thrift.annotation.Nullable java.util.List schema; // required
  /**
   * Number of rows in this file *
   */
  public long num_rows; // required
  /**
   * Row groups in this file *
   */
  public @org.apache.thrift.annotation.Nullable java.util.List row_groups; // required
  /**
   * Optional key/value metadata *
   */
  public @org.apache.thrift.annotation.Nullable java.util.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 @org.apache.thrift.annotation.Nullable java.lang.String created_by; // optional
  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Sort orders are listed in the order matching the columns in the
   * schema. The indexes are not necessary the same though, because only leaf
   * nodes of the schema are represented in the list of sort orders.
   * 
   * 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 @org.apache.thrift.annotation.Nullable java.util.List column_orders; // optional
  /**
   * Encryption algorithm. This field is set only in encrypted files
   * with plaintext footer. Files with encrypted footer store algorithm id
   * in FileCryptoMetaData structure.
   */
  public @org.apache.thrift.annotation.Nullable EncryptionAlgorithm encryption_algorithm; // optional
  /**
   * Retrieval metadata of key used for signing the footer.
   * Used only in encrypted files with plaintext footer.
   */
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer footer_signing_key_metadata; // 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. Sort orders are listed in the order matching the columns in the
     * schema. The indexes are not necessary the same though, because only leaf
     * nodes of the schema are represented in the list of sort orders.
     * 
     * 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"),
    /**
     * Encryption algorithm. This field is set only in encrypted files
     * with plaintext footer. Files with encrypted footer store algorithm id
     * in FileCryptoMetaData structure.
     */
    ENCRYPTION_ALGORITHM((short)8, "encryption_algorithm"),
    /**
     * Retrieval metadata of key used for signing the footer.
     * Used only in encrypted files with plaintext footer.
     */
    FOOTER_SIGNING_KEY_METADATA((short)9, "footer_signing_key_metadata");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // 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;
        case 8: // ENCRYPTION_ALGORITHM
          return ENCRYPTION_ALGORITHM;
        case 9: // FOOTER_SIGNING_KEY_METADATA
          return FOOTER_SIGNING_KEY_METADATA;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __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,_Fields.ENCRYPTION_ALGORITHM,_Fields.FOOTER_SIGNING_KEY_METADATA};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.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))));
    tmpMap.put(_Fields.ENCRYPTION_ALGORITHM, new org.apache.thrift.meta_data.FieldMetaData("encryption_algorithm", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, EncryptionAlgorithm.class)));
    tmpMap.put(_Fields.FOOTER_SIGNING_KEY_METADATA, new org.apache.thrift.meta_data.FieldMetaData("footer_signing_key_metadata", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FileMetaData.class, metaDataMap);
  }

  public FileMetaData() {
  }

  public FileMetaData(
    int version,
    java.util.List schema,
    long num_rows,
    java.util.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()) {
      java.util.List __this__schema = new java.util.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()) {
      java.util.List __this__row_groups = new java.util.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()) {
      java.util.List __this__key_value_metadata = new java.util.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()) {
      java.util.List __this__column_orders = new java.util.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;
    }
    if (other.isSetEncryption_algorithm()) {
      this.encryption_algorithm = new EncryptionAlgorithm(other.encryption_algorithm);
    }
    if (other.isSetFooter_signing_key_metadata()) {
      this.footer_signing_key_metadata = org.apache.thrift.TBaseHelper.copyBinary(other.footer_signing_key_metadata);
    }
  }

  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;
    this.encryption_algorithm = null;
    this.footer_signing_key_metadata = 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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

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

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

  @org.apache.thrift.annotation.Nullable
  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 java.util.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 *
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.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(@org.apache.thrift.annotation.Nullable java.util.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM_ROWS_ISSET_ID);
  }

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

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

  @org.apache.thrift.annotation.Nullable
  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 java.util.ArrayList();
    }
    this.row_groups.add(elem);
  }

  /**
   * Row groups in this file *
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List getRow_groups() {
    return this.row_groups;
  }

  /**
   * Row groups in this file *
   */
  public FileMetaData setRow_groups(@org.apache.thrift.annotation.Nullable java.util.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();
  }

  @org.apache.thrift.annotation.Nullable
  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 java.util.ArrayList();
    }
    this.key_value_metadata.add(elem);
  }

  /**
   * Optional key/value metadata *
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List getKey_value_metadata() {
    return this.key_value_metadata;
  }

  /**
   * Optional key/value metadata *
   */
  public FileMetaData setKey_value_metadata(@org.apache.thrift.annotation.Nullable java.util.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)
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.lang.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(@org.apache.thrift.annotation.Nullable java.lang.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();
  }

  @org.apache.thrift.annotation.Nullable
  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 java.util.ArrayList();
    }
    this.column_orders.add(elem);
  }

  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Sort orders are listed in the order matching the columns in the
   * schema. The indexes are not necessary the same though, because only leaf
   * nodes of the schema are represented in the list of sort orders.
   * 
   * 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.
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List getColumn_orders() {
    return this.column_orders;
  }

  /**
   * Sort order used for the min_value and max_value fields of each column in
   * this file. Sort orders are listed in the order matching the columns in the
   * schema. The indexes are not necessary the same though, because only leaf
   * nodes of the schema are represented in the list of sort orders.
   * 
   * 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(@org.apache.thrift.annotation.Nullable java.util.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;
    }
  }

  /**
   * Encryption algorithm. This field is set only in encrypted files
   * with plaintext footer. Files with encrypted footer store algorithm id
   * in FileCryptoMetaData structure.
   */
  @org.apache.thrift.annotation.Nullable
  public EncryptionAlgorithm getEncryption_algorithm() {
    return this.encryption_algorithm;
  }

  /**
   * Encryption algorithm. This field is set only in encrypted files
   * with plaintext footer. Files with encrypted footer store algorithm id
   * in FileCryptoMetaData structure.
   */
  public FileMetaData setEncryption_algorithm(@org.apache.thrift.annotation.Nullable EncryptionAlgorithm encryption_algorithm) {
    this.encryption_algorithm = encryption_algorithm;
    return this;
  }

  public void unsetEncryption_algorithm() {
    this.encryption_algorithm = null;
  }

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

  public void setEncryption_algorithmIsSet(boolean value) {
    if (!value) {
      this.encryption_algorithm = null;
    }
  }

  /**
   * Retrieval metadata of key used for signing the footer.
   * Used only in encrypted files with plaintext footer.
   */
  public byte[] getFooter_signing_key_metadata() {
    setFooter_signing_key_metadata(org.apache.thrift.TBaseHelper.rightSize(footer_signing_key_metadata));
    return footer_signing_key_metadata == null ? null : footer_signing_key_metadata.array();
  }

  public java.nio.ByteBuffer bufferForFooter_signing_key_metadata() {
    return org.apache.thrift.TBaseHelper.copyBinary(footer_signing_key_metadata);
  }

  /**
   * Retrieval metadata of key used for signing the footer.
   * Used only in encrypted files with plaintext footer.
   */
  public FileMetaData setFooter_signing_key_metadata(byte[] footer_signing_key_metadata) {
    this.footer_signing_key_metadata = footer_signing_key_metadata == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(footer_signing_key_metadata.clone());
    return this;
  }

  public FileMetaData setFooter_signing_key_metadata(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer footer_signing_key_metadata) {
    this.footer_signing_key_metadata = org.apache.thrift.TBaseHelper.copyBinary(footer_signing_key_metadata);
    return this;
  }

  public void unsetFooter_signing_key_metadata() {
    this.footer_signing_key_metadata = null;
  }

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

  public void setFooter_signing_key_metadataIsSet(boolean value) {
    if (!value) {
      this.footer_signing_key_metadata = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((java.lang.Integer)value);
      }
      break;

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

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

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

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

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

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

    case ENCRYPTION_ALGORITHM:
      if (value == null) {
        unsetEncryption_algorithm();
      } else {
        setEncryption_algorithm((EncryptionAlgorithm)value);
      }
      break;

    case FOOTER_SIGNING_KEY_METADATA:
      if (value == null) {
        unsetFooter_signing_key_metadata();
      } else {
        if (value instanceof byte[]) {
          setFooter_signing_key_metadata((byte[])value);
        } else {
          setFooter_signing_key_metadata((java.nio.ByteBuffer)value);
        }
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.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();

    case ENCRYPTION_ALGORITHM:
      return getEncryption_algorithm();

    case FOOTER_SIGNING_KEY_METADATA:
      return getFooter_signing_key_metadata();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case 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();
    case ENCRYPTION_ALGORITHM:
      return isSetEncryption_algorithm();
    case FOOTER_SIGNING_KEY_METADATA:
      return isSetFooter_signing_key_metadata();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

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

    boolean this_present_encryption_algorithm = true && this.isSetEncryption_algorithm();
    boolean that_present_encryption_algorithm = true && that.isSetEncryption_algorithm();
    if (this_present_encryption_algorithm || that_present_encryption_algorithm) {
      if (!(this_present_encryption_algorithm && that_present_encryption_algorithm))
        return false;
      if (!this.encryption_algorithm.equals(that.encryption_algorithm))
        return false;
    }

    boolean this_present_footer_signing_key_metadata = true && this.isSetFooter_signing_key_metadata();
    boolean that_present_footer_signing_key_metadata = true && that.isSetFooter_signing_key_metadata();
    if (this_present_footer_signing_key_metadata || that_present_footer_signing_key_metadata) {
      if (!(this_present_footer_signing_key_metadata && that_present_footer_signing_key_metadata))
        return false;
      if (!this.footer_signing_key_metadata.equals(that.footer_signing_key_metadata))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + version;

    hashCode = hashCode * 8191 + ((isSetSchema()) ? 131071 : 524287);
    if (isSetSchema())
      hashCode = hashCode * 8191 + schema.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(num_rows);

    hashCode = hashCode * 8191 + ((isSetRow_groups()) ? 131071 : 524287);
    if (isSetRow_groups())
      hashCode = hashCode * 8191 + row_groups.hashCode();

    hashCode = hashCode * 8191 + ((isSetKey_value_metadata()) ? 131071 : 524287);
    if (isSetKey_value_metadata())
      hashCode = hashCode * 8191 + key_value_metadata.hashCode();

    hashCode = hashCode * 8191 + ((isSetCreated_by()) ? 131071 : 524287);
    if (isSetCreated_by())
      hashCode = hashCode * 8191 + created_by.hashCode();

    hashCode = hashCode * 8191 + ((isSetColumn_orders()) ? 131071 : 524287);
    if (isSetColumn_orders())
      hashCode = hashCode * 8191 + column_orders.hashCode();

    hashCode = hashCode * 8191 + ((isSetEncryption_algorithm()) ? 131071 : 524287);
    if (isSetEncryption_algorithm())
      hashCode = hashCode * 8191 + encryption_algorithm.hashCode();

    hashCode = hashCode * 8191 + ((isSetFooter_signing_key_metadata()) ? 131071 : 524287);
    if (isSetFooter_signing_key_metadata())
      hashCode = hashCode * 8191 + footer_signing_key_metadata.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetVersion(), 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 = java.lang.Boolean.compare(isSetSchema(), 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 = java.lang.Boolean.compare(isSetNum_rows(), 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 = java.lang.Boolean.compare(isSetRow_groups(), 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 = java.lang.Boolean.compare(isSetKey_value_metadata(), 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 = java.lang.Boolean.compare(isSetCreated_by(), 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 = java.lang.Boolean.compare(isSetColumn_orders(), 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;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEncryption_algorithm(), other.isSetEncryption_algorithm());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEncryption_algorithm()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.encryption_algorithm, other.encryption_algorithm);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFooter_signing_key_metadata(), other.isSetFooter_signing_key_metadata());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFooter_signing_key_metadata()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.footer_signing_key_metadata, other.footer_signing_key_metadata);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

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

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("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;
    }
    if (isSetEncryption_algorithm()) {
      if (!first) sb.append(", ");
      sb.append("encryption_algorithm:");
      if (this.encryption_algorithm == null) {
        sb.append("null");
      } else {
        sb.append(this.encryption_algorithm);
      }
      first = false;
    }
    if (isSetFooter_signing_key_metadata()) {
      if (!first) sb.append(", ");
      sb.append("footer_signing_key_metadata:");
      if (this.footer_signing_key_metadata == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.footer_signing_key_metadata, sb);
      }
      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, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class FileMetaDataStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FileMetaDataStandardScheme getScheme() {
      return new FileMetaDataStandardScheme();
    }
  }

  private static class FileMetaDataStandardScheme extends org.apache.thrift.scheme.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 _list96 = iprot.readListBegin();
                struct.schema = new java.util.ArrayList(_list96.size);
                @org.apache.thrift.annotation.Nullable SchemaElement _elem97;
                for (int _i98 = 0; _i98 < _list96.size; ++_i98)
                {
                  _elem97 = new SchemaElement();
                  _elem97.read(iprot);
                  struct.schema.add(_elem97);
                }
                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 _list99 = iprot.readListBegin();
                struct.row_groups = new java.util.ArrayList(_list99.size);
                @org.apache.thrift.annotation.Nullable RowGroup _elem100;
                for (int _i101 = 0; _i101 < _list99.size; ++_i101)
                {
                  _elem100 = new RowGroup();
                  _elem100.read(iprot);
                  struct.row_groups.add(_elem100);
                }
                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 _list102 = iprot.readListBegin();
                struct.key_value_metadata = new java.util.ArrayList(_list102.size);
                @org.apache.thrift.annotation.Nullable KeyValue _elem103;
                for (int _i104 = 0; _i104 < _list102.size; ++_i104)
                {
                  _elem103 = new KeyValue();
                  _elem103.read(iprot);
                  struct.key_value_metadata.add(_elem103);
                }
                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 _list105 = iprot.readListBegin();
                struct.column_orders = new java.util.ArrayList(_list105.size);
                @org.apache.thrift.annotation.Nullable ColumnOrder _elem106;
                for (int _i107 = 0; _i107 < _list105.size; ++_i107)
                {
                  _elem106 = new ColumnOrder();
                  _elem106.read(iprot);
                  struct.column_orders.add(_elem106);
                }
                iprot.readListEnd();
              }
              struct.setColumn_ordersIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // ENCRYPTION_ALGORITHM
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.encryption_algorithm = new EncryptionAlgorithm();
              struct.encryption_algorithm.read(iprot);
              struct.setEncryption_algorithmIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // FOOTER_SIGNING_KEY_METADATA
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.footer_signing_key_metadata = iprot.readBinary();
              struct.setFooter_signing_key_metadataIsSet(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 _iter108 : struct.schema)
          {
            _iter108.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 _iter109 : struct.row_groups)
          {
            _iter109.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 _iter110 : struct.key_value_metadata)
            {
              _iter110.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 _iter111 : struct.column_orders)
            {
              _iter111.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.encryption_algorithm != null) {
        if (struct.isSetEncryption_algorithm()) {
          oprot.writeFieldBegin(ENCRYPTION_ALGORITHM_FIELD_DESC);
          struct.encryption_algorithm.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.footer_signing_key_metadata != null) {
        if (struct.isSetFooter_signing_key_metadata()) {
          oprot.writeFieldBegin(FOOTER_SIGNING_KEY_METADATA_FIELD_DESC);
          oprot.writeBinary(struct.footer_signing_key_metadata);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FileMetaDataTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FileMetaDataTupleScheme getScheme() {
      return new FileMetaDataTupleScheme();
    }
  }

  private static class FileMetaDataTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FileMetaData struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.version);
      {
        oprot.writeI32(struct.schema.size());
        for (SchemaElement _iter112 : struct.schema)
        {
          _iter112.write(oprot);
        }
      }
      oprot.writeI64(struct.num_rows);
      {
        oprot.writeI32(struct.row_groups.size());
        for (RowGroup _iter113 : struct.row_groups)
        {
          _iter113.write(oprot);
        }
      }
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetKey_value_metadata()) {
        optionals.set(0);
      }
      if (struct.isSetCreated_by()) {
        optionals.set(1);
      }
      if (struct.isSetColumn_orders()) {
        optionals.set(2);
      }
      if (struct.isSetEncryption_algorithm()) {
        optionals.set(3);
      }
      if (struct.isSetFooter_signing_key_metadata()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetKey_value_metadata()) {
        {
          oprot.writeI32(struct.key_value_metadata.size());
          for (KeyValue _iter114 : struct.key_value_metadata)
          {
            _iter114.write(oprot);
          }
        }
      }
      if (struct.isSetCreated_by()) {
        oprot.writeString(struct.created_by);
      }
      if (struct.isSetColumn_orders()) {
        {
          oprot.writeI32(struct.column_orders.size());
          for (ColumnOrder _iter115 : struct.column_orders)
          {
            _iter115.write(oprot);
          }
        }
      }
      if (struct.isSetEncryption_algorithm()) {
        struct.encryption_algorithm.write(oprot);
      }
      if (struct.isSetFooter_signing_key_metadata()) {
        oprot.writeBinary(struct.footer_signing_key_metadata);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FileMetaData struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.version = iprot.readI32();
      struct.setVersionIsSet(true);
      {
        org.apache.thrift.protocol.TList _list116 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.schema = new java.util.ArrayList(_list116.size);
        @org.apache.thrift.annotation.Nullable SchemaElement _elem117;
        for (int _i118 = 0; _i118 < _list116.size; ++_i118)
        {
          _elem117 = new SchemaElement();
          _elem117.read(iprot);
          struct.schema.add(_elem117);
        }
      }
      struct.setSchemaIsSet(true);
      struct.num_rows = iprot.readI64();
      struct.setNum_rowsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list119 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.row_groups = new java.util.ArrayList(_list119.size);
        @org.apache.thrift.annotation.Nullable RowGroup _elem120;
        for (int _i121 = 0; _i121 < _list119.size; ++_i121)
        {
          _elem120 = new RowGroup();
          _elem120.read(iprot);
          struct.row_groups.add(_elem120);
        }
      }
      struct.setRow_groupsIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list122 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.key_value_metadata = new java.util.ArrayList(_list122.size);
          @org.apache.thrift.annotation.Nullable KeyValue _elem123;
          for (int _i124 = 0; _i124 < _list122.size; ++_i124)
          {
            _elem123 = new KeyValue();
            _elem123.read(iprot);
            struct.key_value_metadata.add(_elem123);
          }
        }
        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 _list125 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.column_orders = new java.util.ArrayList(_list125.size);
          @org.apache.thrift.annotation.Nullable ColumnOrder _elem126;
          for (int _i127 = 0; _i127 < _list125.size; ++_i127)
          {
            _elem126 = new ColumnOrder();
            _elem126.read(iprot);
            struct.column_orders.add(_elem126);
          }
        }
        struct.setColumn_ordersIsSet(true);
      }
      if (incoming.get(3)) {
        struct.encryption_algorithm = new EncryptionAlgorithm();
        struct.encryption_algorithm.read(iprot);
        struct.setEncryption_algorithmIsSet(true);
      }
      if (incoming.get(4)) {
        struct.footer_signing_key_metadata = iprot.readBinary();
        struct.setFooter_signing_key_metadataIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy