SchemaElement.java

/**
 * 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"})
/**
 * Represents a element inside a schema definition.
 *   if it is a group (inner node) then type is undefined and num_children is defined
 *   if it is a primitive type (leaf) then type is defined and num_children is undefined
 * the nodes are listed in depth first traversal order.
 */
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class SchemaElement implements org.apache.thrift.TBase<SchemaElement, SchemaElement._Fields>, java.io.Serializable, Cloneable, Comparable<SchemaElement> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SchemaElement");

  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField TYPE_LENGTH_FIELD_DESC = new org.apache.thrift.protocol.TField("type_length", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField REPETITION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("repetition_type", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField NUM_CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("num_children", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField CONVERTED_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("converted_type", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField SCALE_FIELD_DESC = new org.apache.thrift.protocol.TField("scale", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField PRECISION_FIELD_DESC = new org.apache.thrift.protocol.TField("precision", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField FIELD_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("field_id", org.apache.thrift.protocol.TType.I32, (short)9);
  private static final org.apache.thrift.protocol.TField LOGICAL_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("logicalType", org.apache.thrift.protocol.TType.STRUCT, (short)10);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SchemaElementStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new SchemaElementTupleSchemeFactory();

  /**
   * Data type for this field. Not set if the current element is a nonleaf node
   * 
   * @see Type
   */
  public @org.apache.thrift.annotation.Nullable Type type; // optional
  /**
   * If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values.
   * Otherwise, if specified, this is the maximum bit length to store any of the values.
   * (e.g. a low cardinality INT col could have this set to 3).  Note that this is
   * in the schema, and therefore fixed for the entire file.
   */
  public int type_length; // optional
  /**
   * repetition of the field. The root of the schema does not have a repetition_type.
   * All other nodes must have one
   * 
   * @see FieldRepetitionType
   */
  public @org.apache.thrift.annotation.Nullable FieldRepetitionType repetition_type; // optional
  /**
   * Name of the field in the schema
   */
  public @org.apache.thrift.annotation.Nullable java.lang.String name; // required
  /**
   * Nested fields.  Since thrift does not support nested fields,
   * the nesting is flattened to a single list by a depthfirst traversal.
   * The children count is used to construct the nested relationship.
   * This field is not set when the element is a primitive type
   */
  public int num_children; // optional
  /**
   * DEPRECATED: When the schema is the result of a conversion from another model.
   * Used to record the original type to help with cross conversion.
   * 
   * This is superseded by logicalType.
   * 
   * @see ConvertedType
   */
  public @org.apache.thrift.annotation.Nullable ConvertedType converted_type; // optional
  /**
   * DEPRECATED: Used when this column contains decimal data.
   * See the DECIMAL converted type for more details.
   * 
   * This is superseded by using the DecimalType annotation in logicalType.
   */
  public int scale; // optional
  public int precision; // optional
  /**
   * When the original schema supports field ids, this will save the
   * original field id in the parquet schema
   */
  public int field_id; // optional
  /**
   * The logical type of this SchemaElement
   * 
   * LogicalType replaces ConvertedType, but ConvertedType is still required
   * for some logical types to ensure forwardcompatibility in format v1.
   */
  public @org.apache.thrift.annotation.Nullable LogicalType logicalType; // 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 {
    /**
     * Data type for this field. Not set if the current element is a nonleaf node
     * 
     * @see Type
     */
    TYPE((short)1, "type"),
    /**
     * If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values.
     * Otherwise, if specified, this is the maximum bit length to store any of the values.
     * (e.g. a low cardinality INT col could have this set to 3).  Note that this is
     * in the schema, and therefore fixed for the entire file.
     */
    TYPE_LENGTH((short)2, "type_length"),
    /**
     * repetition of the field. The root of the schema does not have a repetition_type.
     * All other nodes must have one
     * 
     * @see FieldRepetitionType
     */
    REPETITION_TYPE((short)3, "repetition_type"),
    /**
     * Name of the field in the schema
     */
    NAME((short)4, "name"),
    /**
     * Nested fields.  Since thrift does not support nested fields,
     * the nesting is flattened to a single list by a depthfirst traversal.
     * The children count is used to construct the nested relationship.
     * This field is not set when the element is a primitive type
     */
    NUM_CHILDREN((short)5, "num_children"),
    /**
     * DEPRECATED: When the schema is the result of a conversion from another model.
     * Used to record the original type to help with cross conversion.
     * 
     * This is superseded by logicalType.
     * 
     * @see ConvertedType
     */
    CONVERTED_TYPE((short)6, "converted_type"),
    /**
     * DEPRECATED: Used when this column contains decimal data.
     * See the DECIMAL converted type for more details.
     * 
     * This is superseded by using the DecimalType annotation in logicalType.
     */
    SCALE((short)7, "scale"),
    PRECISION((short)8, "precision"),
    /**
     * When the original schema supports field ids, this will save the
     * original field id in the parquet schema
     */
    FIELD_ID((short)9, "field_id"),
    /**
     * The logical type of this SchemaElement
     * 
     * LogicalType replaces ConvertedType, but ConvertedType is still required
     * for some logical types to ensure forwardcompatibility in format v1.
     */
    LOGICAL_TYPE((short)10, "logicalType");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    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: // TYPE
          return TYPE;
        case 2: // TYPE_LENGTH
          return TYPE_LENGTH;
        case 3: // REPETITION_TYPE
          return REPETITION_TYPE;
        case 4: // NAME
          return NAME;
        case 5: // NUM_CHILDREN
          return NUM_CHILDREN;
        case 6: // CONVERTED_TYPE
          return CONVERTED_TYPE;
        case 7: // SCALE
          return SCALE;
        case 8: // PRECISION
          return PRECISION;
        case 9: // FIELD_ID
          return FIELD_ID;
        case 10: // LOGICAL_TYPE
          return LOGICAL_TYPE;
        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 __TYPE_LENGTH_ISSET_ID = 0;
  private static final int __NUM_CHILDREN_ISSET_ID = 1;
  private static final int __SCALE_ISSET_ID = 2;
  private static final int __PRECISION_ISSET_ID = 3;
  private static final int __FIELD_ID_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TYPE,_Fields.TYPE_LENGTH,_Fields.REPETITION_TYPE,_Fields.NUM_CHILDREN,_Fields.CONVERTED_TYPE,_Fields.SCALE,_Fields.PRECISION,_Fields.FIELD_ID,_Fields.LOGICAL_TYPE};
  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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Type.class)));
    tmpMap.put(_Fields.TYPE_LENGTH, new org.apache.thrift.meta_data.FieldMetaData("type_length", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.REPETITION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("repetition_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, FieldRepetitionType.class)));
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NUM_CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("num_children", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.CONVERTED_TYPE, new org.apache.thrift.meta_data.FieldMetaData("converted_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ConvertedType.class)));
    tmpMap.put(_Fields.SCALE, new org.apache.thrift.meta_data.FieldMetaData("scale", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.PRECISION, new org.apache.thrift.meta_data.FieldMetaData("precision", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.FIELD_ID, new org.apache.thrift.meta_data.FieldMetaData("field_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LOGICAL_TYPE, new org.apache.thrift.meta_data.FieldMetaData("logicalType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LogicalType.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SchemaElement.class, metaDataMap);
  }

  public SchemaElement() {
  }

  public SchemaElement(
    java.lang.String name)
  {
    this();
    this.name = name;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SchemaElement(SchemaElement other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetType()) {
      this.type = other.type;
    }
    this.type_length = other.type_length;
    if (other.isSetRepetitionType()) {
      this.repetition_type = other.repetition_type;
    }
    if (other.isSetName()) {
      this.name = other.name;
    }
    this.num_children = other.num_children;
    if (other.isSetConvertedType()) {
      this.converted_type = other.converted_type;
    }
    this.scale = other.scale;
    this.precision = other.precision;
    this.field_id = other.field_id;
    if (other.isSetLogicalType()) {
      this.logicalType = new LogicalType(other.logicalType);
    }
  }

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

  @Override
  public void clear() {
    this.type = null;
    setTypeLengthIsSet(false);
    this.type_length = 0;
    this.repetition_type = null;
    this.name = null;
    setNumChildrenIsSet(false);
    this.num_children = 0;
    this.converted_type = null;
    setScaleIsSet(false);
    this.scale = 0;
    setPrecisionIsSet(false);
    this.precision = 0;
    setFieldIdIsSet(false);
    this.field_id = 0;
    this.logicalType = null;
  }

  /**
   * Data type for this field. Not set if the current element is a nonleaf node
   * 
   * @see Type
   */
  @org.apache.thrift.annotation.Nullable
  public Type getType() {
    return this.type;
  }

  /**
   * Data type for this field. Not set if the current element is a nonleaf node
   * 
   * @see Type
   */
  public SchemaElement setType(@org.apache.thrift.annotation.Nullable Type type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

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

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  /**
   * If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values.
   * Otherwise, if specified, this is the maximum bit length to store any of the values.
   * (e.g. a low cardinality INT col could have this set to 3).  Note that this is
   * in the schema, and therefore fixed for the entire file.
   */
  public int getTypeLength() {
    return this.type_length;
  }

  /**
   * If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values.
   * Otherwise, if specified, this is the maximum bit length to store any of the values.
   * (e.g. a low cardinality INT col could have this set to 3).  Note that this is
   * in the schema, and therefore fixed for the entire file.
   */
  public SchemaElement setTypeLength(int type_length) {
    this.type_length = type_length;
    setTypeLengthIsSet(true);
    return this;
  }

  public void unsetTypeLength() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TYPE_LENGTH_ISSET_ID);
  }

  /** Returns true if field type_length is set (has been assigned a value) and false otherwise */
  public boolean isSetTypeLength() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TYPE_LENGTH_ISSET_ID);
  }

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

  /**
   * repetition of the field. The root of the schema does not have a repetition_type.
   * All other nodes must have one
   * 
   * @see FieldRepetitionType
   */
  @org.apache.thrift.annotation.Nullable
  public FieldRepetitionType getRepetitionType() {
    return this.repetition_type;
  }

  /**
   * repetition of the field. The root of the schema does not have a repetition_type.
   * All other nodes must have one
   * 
   * @see FieldRepetitionType
   */
  public SchemaElement setRepetitionType(@org.apache.thrift.annotation.Nullable FieldRepetitionType repetition_type) {
    this.repetition_type = repetition_type;
    return this;
  }

  public void unsetRepetitionType() {
    this.repetition_type = null;
  }

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

  public void setRepetitionTypeIsSet(boolean value) {
    if (!value) {
      this.repetition_type = null;
    }
  }

  /**
   * Name of the field in the schema
   */
  @org.apache.thrift.annotation.Nullable
  public java.lang.String getName() {
    return this.name;
  }

  /**
   * Name of the field in the schema
   */
  public SchemaElement setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
    this.name = name;
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

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

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

  /**
   * Nested fields.  Since thrift does not support nested fields,
   * the nesting is flattened to a single list by a depthfirst traversal.
   * The children count is used to construct the nested relationship.
   * This field is not set when the element is a primitive type
   */
  public int getNumChildren() {
    return this.num_children;
  }

  /**
   * Nested fields.  Since thrift does not support nested fields,
   * the nesting is flattened to a single list by a depthfirst traversal.
   * The children count is used to construct the nested relationship.
   * This field is not set when the element is a primitive type
   */
  public SchemaElement setNumChildren(int num_children) {
    this.num_children = num_children;
    setNumChildrenIsSet(true);
    return this;
  }

  public void unsetNumChildren() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM_CHILDREN_ISSET_ID);
  }

  /** Returns true if field num_children is set (has been assigned a value) and false otherwise */
  public boolean isSetNumChildren() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM_CHILDREN_ISSET_ID);
  }

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

  /**
   * DEPRECATED: When the schema is the result of a conversion from another model.
   * Used to record the original type to help with cross conversion.
   * 
   * This is superseded by logicalType.
   * 
   * @see ConvertedType
   */
  @org.apache.thrift.annotation.Nullable
  public ConvertedType getConvertedType() {
    return this.converted_type;
  }

  /**
   * DEPRECATED: When the schema is the result of a conversion from another model.
   * Used to record the original type to help with cross conversion.
   * 
   * This is superseded by logicalType.
   * 
   * @see ConvertedType
   */
  public SchemaElement setConvertedType(@org.apache.thrift.annotation.Nullable ConvertedType converted_type) {
    this.converted_type = converted_type;
    return this;
  }

  public void unsetConvertedType() {
    this.converted_type = null;
  }

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

  public void setConvertedTypeIsSet(boolean value) {
    if (!value) {
      this.converted_type = null;
    }
  }

  /**
   * DEPRECATED: Used when this column contains decimal data.
   * See the DECIMAL converted type for more details.
   * 
   * This is superseded by using the DecimalType annotation in logicalType.
   */
  public int getScale() {
    return this.scale;
  }

  /**
   * DEPRECATED: Used when this column contains decimal data.
   * See the DECIMAL converted type for more details.
   * 
   * This is superseded by using the DecimalType annotation in logicalType.
   */
  public SchemaElement setScale(int scale) {
    this.scale = scale;
    setScaleIsSet(true);
    return this;
  }

  public void unsetScale() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SCALE_ISSET_ID);
  }

  /** Returns true if field scale is set (has been assigned a value) and false otherwise */
  public boolean isSetScale() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SCALE_ISSET_ID);
  }

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

  public int getPrecision() {
    return this.precision;
  }

  public SchemaElement setPrecision(int precision) {
    this.precision = precision;
    setPrecisionIsSet(true);
    return this;
  }

  public void unsetPrecision() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __PRECISION_ISSET_ID);
  }

  /** Returns true if field precision is set (has been assigned a value) and false otherwise */
  public boolean isSetPrecision() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __PRECISION_ISSET_ID);
  }

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

  /**
   * When the original schema supports field ids, this will save the
   * original field id in the parquet schema
   */
  public int getFieldId() {
    return this.field_id;
  }

  /**
   * When the original schema supports field ids, this will save the
   * original field id in the parquet schema
   */
  public SchemaElement setFieldId(int field_id) {
    this.field_id = field_id;
    setFieldIdIsSet(true);
    return this;
  }

  public void unsetFieldId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __FIELD_ID_ISSET_ID);
  }

  /** Returns true if field field_id is set (has been assigned a value) and false otherwise */
  public boolean isSetFieldId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __FIELD_ID_ISSET_ID);
  }

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

  /**
   * The logical type of this SchemaElement
   * 
   * LogicalType replaces ConvertedType, but ConvertedType is still required
   * for some logical types to ensure forwardcompatibility in format v1.
   */
  @org.apache.thrift.annotation.Nullable
  public LogicalType getLogicalType() {
    return this.logicalType;
  }

  /**
   * The logical type of this SchemaElement
   * 
   * LogicalType replaces ConvertedType, but ConvertedType is still required
   * for some logical types to ensure forwardcompatibility in format v1.
   */
  public SchemaElement setLogicalType(@org.apache.thrift.annotation.Nullable LogicalType logicalType) {
    this.logicalType = logicalType;
    return this;
  }

  public void unsetLogicalType() {
    this.logicalType = null;
  }

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

  public void setLogicalTypeIsSet(boolean value) {
    if (!value) {
      this.logicalType = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((Type)value);
      }
      break;

    case TYPE_LENGTH:
      if (value == null) {
        unsetTypeLength();
      } else {
        setTypeLength((java.lang.Integer)value);
      }
      break;

    case REPETITION_TYPE:
      if (value == null) {
        unsetRepetitionType();
      } else {
        setRepetitionType((FieldRepetitionType)value);
      }
      break;

    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((java.lang.String)value);
      }
      break;

    case NUM_CHILDREN:
      if (value == null) {
        unsetNumChildren();
      } else {
        setNumChildren((java.lang.Integer)value);
      }
      break;

    case CONVERTED_TYPE:
      if (value == null) {
        unsetConvertedType();
      } else {
        setConvertedType((ConvertedType)value);
      }
      break;

    case SCALE:
      if (value == null) {
        unsetScale();
      } else {
        setScale((java.lang.Integer)value);
      }
      break;

    case PRECISION:
      if (value == null) {
        unsetPrecision();
      } else {
        setPrecision((java.lang.Integer)value);
      }
      break;

    case FIELD_ID:
      if (value == null) {
        unsetFieldId();
      } else {
        setFieldId((java.lang.Integer)value);
      }
      break;

    case LOGICAL_TYPE:
      if (value == null) {
        unsetLogicalType();
      } else {
        setLogicalType((LogicalType)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case TYPE_LENGTH:
      return getTypeLength();

    case REPETITION_TYPE:
      return getRepetitionType();

    case NAME:
      return getName();

    case NUM_CHILDREN:
      return getNumChildren();

    case CONVERTED_TYPE:
      return getConvertedType();

    case SCALE:
      return getScale();

    case PRECISION:
      return getPrecision();

    case FIELD_ID:
      return getFieldId();

    case LOGICAL_TYPE:
      return getLogicalType();

    }
    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 TYPE:
      return isSetType();
    case TYPE_LENGTH:
      return isSetTypeLength();
    case REPETITION_TYPE:
      return isSetRepetitionType();
    case NAME:
      return isSetName();
    case NUM_CHILDREN:
      return isSetNumChildren();
    case CONVERTED_TYPE:
      return isSetConvertedType();
    case SCALE:
      return isSetScale();
    case PRECISION:
      return isSetPrecision();
    case FIELD_ID:
      return isSetFieldId();
    case LOGICAL_TYPE:
      return isSetLogicalType();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_type_length = true && this.isSetTypeLength();
    boolean that_present_type_length = true && that.isSetTypeLength();
    if (this_present_type_length || that_present_type_length) {
      if (!(this_present_type_length && that_present_type_length))
        return false;
      if (this.type_length != that.type_length)
        return false;
    }

    boolean this_present_repetition_type = true && this.isSetRepetitionType();
    boolean that_present_repetition_type = true && that.isSetRepetitionType();
    if (this_present_repetition_type || that_present_repetition_type) {
      if (!(this_present_repetition_type && that_present_repetition_type))
        return false;
      if (!this.repetition_type.equals(that.repetition_type))
        return false;
    }

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }

    boolean this_present_num_children = true && this.isSetNumChildren();
    boolean that_present_num_children = true && that.isSetNumChildren();
    if (this_present_num_children || that_present_num_children) {
      if (!(this_present_num_children && that_present_num_children))
        return false;
      if (this.num_children != that.num_children)
        return false;
    }

    boolean this_present_converted_type = true && this.isSetConvertedType();
    boolean that_present_converted_type = true && that.isSetConvertedType();
    if (this_present_converted_type || that_present_converted_type) {
      if (!(this_present_converted_type && that_present_converted_type))
        return false;
      if (!this.converted_type.equals(that.converted_type))
        return false;
    }

    boolean this_present_scale = true && this.isSetScale();
    boolean that_present_scale = true && that.isSetScale();
    if (this_present_scale || that_present_scale) {
      if (!(this_present_scale && that_present_scale))
        return false;
      if (this.scale != that.scale)
        return false;
    }

    boolean this_present_precision = true && this.isSetPrecision();
    boolean that_present_precision = true && that.isSetPrecision();
    if (this_present_precision || that_present_precision) {
      if (!(this_present_precision && that_present_precision))
        return false;
      if (this.precision != that.precision)
        return false;
    }

    boolean this_present_field_id = true && this.isSetFieldId();
    boolean that_present_field_id = true && that.isSetFieldId();
    if (this_present_field_id || that_present_field_id) {
      if (!(this_present_field_id && that_present_field_id))
        return false;
      if (this.field_id != that.field_id)
        return false;
    }

    boolean this_present_logicalType = true && this.isSetLogicalType();
    boolean that_present_logicalType = true && that.isSetLogicalType();
    if (this_present_logicalType || that_present_logicalType) {
      if (!(this_present_logicalType && that_present_logicalType))
        return false;
      if (!this.logicalType.equals(that.logicalType))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + ((isSetTypeLength()) ? 131071 : 524287);
    if (isSetTypeLength())
      hashCode = hashCode * 8191 + type_length;

    hashCode = hashCode * 8191 + ((isSetRepetitionType()) ? 131071 : 524287);
    if (isSetRepetitionType())
      hashCode = hashCode * 8191 + repetition_type.getValue();

    hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287);
    if (isSetName())
      hashCode = hashCode * 8191 + name.hashCode();

    hashCode = hashCode * 8191 + ((isSetNumChildren()) ? 131071 : 524287);
    if (isSetNumChildren())
      hashCode = hashCode * 8191 + num_children;

    hashCode = hashCode * 8191 + ((isSetConvertedType()) ? 131071 : 524287);
    if (isSetConvertedType())
      hashCode = hashCode * 8191 + converted_type.getValue();

    hashCode = hashCode * 8191 + ((isSetScale()) ? 131071 : 524287);
    if (isSetScale())
      hashCode = hashCode * 8191 + scale;

    hashCode = hashCode * 8191 + ((isSetPrecision()) ? 131071 : 524287);
    if (isSetPrecision())
      hashCode = hashCode * 8191 + precision;

    hashCode = hashCode * 8191 + ((isSetFieldId()) ? 131071 : 524287);
    if (isSetFieldId())
      hashCode = hashCode * 8191 + field_id;

    hashCode = hashCode * 8191 + ((isSetLogicalType()) ? 131071 : 524287);
    if (isSetLogicalType())
      hashCode = hashCode * 8191 + logicalType.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTypeLength(), other.isSetTypeLength());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTypeLength()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type_length, other.type_length);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRepetitionType(), other.isSetRepetitionType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRepetitionType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.repetition_type, other.repetition_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNumChildren(), other.isSetNumChildren());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumChildren()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_children, other.num_children);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConvertedType(), other.isSetConvertedType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConvertedType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.converted_type, other.converted_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetScale(), other.isSetScale());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetScale()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scale, other.scale);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPrecision(), other.isSetPrecision());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPrecision()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.precision, other.precision);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFieldId(), other.isSetFieldId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFieldId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.field_id, other.field_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetLogicalType(), other.isSetLogicalType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLogicalType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.logicalType, other.logicalType);
      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("SchemaElement(");
    boolean first = true;

    if (isSetType()) {
      sb.append("type:");
      if (this.type == null) {
        sb.append("null");
      } else {
        sb.append(this.type);
      }
      first = false;
    }
    if (isSetTypeLength()) {
      if (!first) sb.append(", ");
      sb.append("type_length:");
      sb.append(this.type_length);
      first = false;
    }
    if (isSetRepetitionType()) {
      if (!first) sb.append(", ");
      sb.append("repetition_type:");
      if (this.repetition_type == null) {
        sb.append("null");
      } else {
        sb.append(this.repetition_type);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("name:");
    if (this.name == null) {
      sb.append("null");
    } else {
      sb.append(this.name);
    }
    first = false;
    if (isSetNumChildren()) {
      if (!first) sb.append(", ");
      sb.append("num_children:");
      sb.append(this.num_children);
      first = false;
    }
    if (isSetConvertedType()) {
      if (!first) sb.append(", ");
      sb.append("converted_type:");
      if (this.converted_type == null) {
        sb.append("null");
      } else {
        sb.append(this.converted_type);
      }
      first = false;
    }
    if (isSetScale()) {
      if (!first) sb.append(", ");
      sb.append("scale:");
      sb.append(this.scale);
      first = false;
    }
    if (isSetPrecision()) {
      if (!first) sb.append(", ");
      sb.append("precision:");
      sb.append(this.precision);
      first = false;
    }
    if (isSetFieldId()) {
      if (!first) sb.append(", ");
      sb.append("field_id:");
      sb.append(this.field_id);
      first = false;
    }
    if (isSetLogicalType()) {
      if (!first) sb.append(", ");
      sb.append("logicalType:");
      if (this.logicalType == null) {
        sb.append("null");
      } else {
        sb.append(this.logicalType);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (name == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' 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 SchemaElementStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public SchemaElementStandardScheme getScheme() {
      return new SchemaElementStandardScheme();
    }
  }

  private static class SchemaElementStandardScheme extends org.apache.thrift.scheme.StandardScheme<SchemaElement> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SchemaElement 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.parquet.format.Type.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TYPE_LENGTH
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type_length = iprot.readI32();
              struct.setTypeLengthIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // REPETITION_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.repetition_type = org.apache.parquet.format.FieldRepetitionType.findByValue(iprot.readI32());
              struct.setRepetitionTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.name = iprot.readString();
              struct.setNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // NUM_CHILDREN
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.num_children = iprot.readI32();
              struct.setNumChildrenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // CONVERTED_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.converted_type = org.apache.parquet.format.ConvertedType.findByValue(iprot.readI32());
              struct.setConvertedTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SCALE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.scale = iprot.readI32();
              struct.setScaleIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // PRECISION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.precision = iprot.readI32();
              struct.setPrecisionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // FIELD_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.field_id = iprot.readI32();
              struct.setFieldIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // LOGICAL_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.logicalType = new LogicalType();
              struct.logicalType.read(iprot);
              struct.setLogicalTypeIsSet(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
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        if (struct.isSetType()) {
          oprot.writeFieldBegin(TYPE_FIELD_DESC);
          oprot.writeI32(struct.type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetTypeLength()) {
        oprot.writeFieldBegin(TYPE_LENGTH_FIELD_DESC);
        oprot.writeI32(struct.type_length);
        oprot.writeFieldEnd();
      }
      if (struct.repetition_type != null) {
        if (struct.isSetRepetitionType()) {
          oprot.writeFieldBegin(REPETITION_TYPE_FIELD_DESC);
          oprot.writeI32(struct.repetition_type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(struct.name);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNumChildren()) {
        oprot.writeFieldBegin(NUM_CHILDREN_FIELD_DESC);
        oprot.writeI32(struct.num_children);
        oprot.writeFieldEnd();
      }
      if (struct.converted_type != null) {
        if (struct.isSetConvertedType()) {
          oprot.writeFieldBegin(CONVERTED_TYPE_FIELD_DESC);
          oprot.writeI32(struct.converted_type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetScale()) {
        oprot.writeFieldBegin(SCALE_FIELD_DESC);
        oprot.writeI32(struct.scale);
        oprot.writeFieldEnd();
      }
      if (struct.isSetPrecision()) {
        oprot.writeFieldBegin(PRECISION_FIELD_DESC);
        oprot.writeI32(struct.precision);
        oprot.writeFieldEnd();
      }
      if (struct.isSetFieldId()) {
        oprot.writeFieldBegin(FIELD_ID_FIELD_DESC);
        oprot.writeI32(struct.field_id);
        oprot.writeFieldEnd();
      }
      if (struct.logicalType != null) {
        if (struct.isSetLogicalType()) {
          oprot.writeFieldBegin(LOGICAL_TYPE_FIELD_DESC);
          struct.logicalType.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class SchemaElementTupleScheme extends org.apache.thrift.scheme.TupleScheme<SchemaElement> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SchemaElement struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.name);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetType()) {
        optionals.set(0);
      }
      if (struct.isSetTypeLength()) {
        optionals.set(1);
      }
      if (struct.isSetRepetitionType()) {
        optionals.set(2);
      }
      if (struct.isSetNumChildren()) {
        optionals.set(3);
      }
      if (struct.isSetConvertedType()) {
        optionals.set(4);
      }
      if (struct.isSetScale()) {
        optionals.set(5);
      }
      if (struct.isSetPrecision()) {
        optionals.set(6);
      }
      if (struct.isSetFieldId()) {
        optionals.set(7);
      }
      if (struct.isSetLogicalType()) {
        optionals.set(8);
      }
      oprot.writeBitSet(optionals, 9);
      if (struct.isSetType()) {
        oprot.writeI32(struct.type.getValue());
      }
      if (struct.isSetTypeLength()) {
        oprot.writeI32(struct.type_length);
      }
      if (struct.isSetRepetitionType()) {
        oprot.writeI32(struct.repetition_type.getValue());
      }
      if (struct.isSetNumChildren()) {
        oprot.writeI32(struct.num_children);
      }
      if (struct.isSetConvertedType()) {
        oprot.writeI32(struct.converted_type.getValue());
      }
      if (struct.isSetScale()) {
        oprot.writeI32(struct.scale);
      }
      if (struct.isSetPrecision()) {
        oprot.writeI32(struct.precision);
      }
      if (struct.isSetFieldId()) {
        oprot.writeI32(struct.field_id);
      }
      if (struct.isSetLogicalType()) {
        struct.logicalType.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SchemaElement struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.name = iprot.readString();
      struct.setNameIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(9);
      if (incoming.get(0)) {
        struct.type = org.apache.parquet.format.Type.findByValue(iprot.readI32());
        struct.setTypeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.type_length = iprot.readI32();
        struct.setTypeLengthIsSet(true);
      }
      if (incoming.get(2)) {
        struct.repetition_type = org.apache.parquet.format.FieldRepetitionType.findByValue(iprot.readI32());
        struct.setRepetitionTypeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.num_children = iprot.readI32();
        struct.setNumChildrenIsSet(true);
      }
      if (incoming.get(4)) {
        struct.converted_type = org.apache.parquet.format.ConvertedType.findByValue(iprot.readI32());
        struct.setConvertedTypeIsSet(true);
      }
      if (incoming.get(5)) {
        struct.scale = iprot.readI32();
        struct.setScaleIsSet(true);
      }
      if (incoming.get(6)) {
        struct.precision = iprot.readI32();
        struct.setPrecisionIsSet(true);
      }
      if (incoming.get(7)) {
        struct.field_id = iprot.readI32();
        struct.setFieldIdIsSet(true);
      }
      if (incoming.get(8)) {
        struct.logicalType = new LogicalType();
        struct.logicalType.read(iprot);
        struct.setLogicalTypeIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> 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();
  }
}