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

org.apache.hadoop.hive.metastore.api.SchemaVersion Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import com.facebook.presto.hive.$internal.org.slf4j.Logger;
import com.facebook.presto.hive.$internal.org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class SchemaVersion 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("SchemaVersion");

  private static final org.apache.thrift.protocol.TField SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("schema", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  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)2);
  private static final org.apache.thrift.protocol.TField CREATED_AT_FIELD_DESC = new org.apache.thrift.protocol.TField("createdAt", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField COLS_FIELD_DESC = new org.apache.thrift.protocol.TField("cols", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField SCHEMA_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("schemaText", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField FINGERPRINT_FIELD_DESC = new org.apache.thrift.protocol.TField("fingerprint", org.apache.thrift.protocol.TType.STRING, (short)8);
  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)9);
  private static final org.apache.thrift.protocol.TField SER_DE_FIELD_DESC = new org.apache.thrift.protocol.TField("serDe", org.apache.thrift.protocol.TType.STRUCT, (short)10);

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

  private ISchemaName schema; // required
  private int version; // required
  private long createdAt; // required
  private List cols; // required
  private SchemaVersionState state; // optional
  private String description; // optional
  private String schemaText; // optional
  private String fingerprint; // optional
  private String name; // optional
  private SerDeInfo serDe; // 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 {
    SCHEMA((short)1, "schema"),
    VERSION((short)2, "version"),
    CREATED_AT((short)3, "createdAt"),
    COLS((short)4, "cols"),
    /**
     * 
     * @see SchemaVersionState
     */
    STATE((short)5, "state"),
    DESCRIPTION((short)6, "description"),
    SCHEMA_TEXT((short)7, "schemaText"),
    FINGERPRINT((short)8, "fingerprint"),
    NAME((short)9, "name"),
    SER_DE((short)10, "serDe");

    private static final Map byName = new HashMap();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // SCHEMA
          return SCHEMA;
        case 2: // VERSION
          return VERSION;
        case 3: // CREATED_AT
          return CREATED_AT;
        case 4: // COLS
          return COLS;
        case 5: // STATE
          return STATE;
        case 6: // DESCRIPTION
          return DESCRIPTION;
        case 7: // SCHEMA_TEXT
          return SCHEMA_TEXT;
        case 8: // FINGERPRINT
          return FINGERPRINT;
        case 9: // NAME
          return NAME;
        case 10: // SER_DE
          return SER_DE;
        default:
          return null;
      }
    }

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

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __VERSION_ISSET_ID = 0;
  private static final int __CREATEDAT_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.STATE,_Fields.DESCRIPTION,_Fields.SCHEMA_TEXT,_Fields.FINGERPRINT,_Fields.NAME,_Fields.SER_DE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("schema", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ISchemaName.class)));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.CREATED_AT, new org.apache.thrift.meta_data.FieldMetaData("createdAt", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.COLS, new org.apache.thrift.meta_data.FieldMetaData("cols", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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, FieldSchema.class))));
    tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SchemaVersionState.class)));
    tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SCHEMA_TEXT, new org.apache.thrift.meta_data.FieldMetaData("schemaText", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FINGERPRINT, new org.apache.thrift.meta_data.FieldMetaData("fingerprint", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SER_DE, new org.apache.thrift.meta_data.FieldMetaData("serDe", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SerDeInfo.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SchemaVersion.class, metaDataMap);
  }

  public SchemaVersion() {
  }

  public SchemaVersion(
    ISchemaName schema,
    int version,
    long createdAt,
    List cols)
  {
    this();
    this.schema = schema;
    this.version = version;
    setVersionIsSet(true);
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
    this.cols = cols;
  }

  /**
   * Performs a deep copy on other.
   */
  public SchemaVersion(SchemaVersion other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetSchema()) {
      this.schema = new ISchemaName(other.schema);
    }
    this.version = other.version;
    this.createdAt = other.createdAt;
    if (other.isSetCols()) {
      List __this__cols = new ArrayList(other.cols.size());
      for (FieldSchema other_element : other.cols) {
        __this__cols.add(new FieldSchema(other_element));
      }
      this.cols = __this__cols;
    }
    if (other.isSetState()) {
      this.state = other.state;
    }
    if (other.isSetDescription()) {
      this.description = other.description;
    }
    if (other.isSetSchemaText()) {
      this.schemaText = other.schemaText;
    }
    if (other.isSetFingerprint()) {
      this.fingerprint = other.fingerprint;
    }
    if (other.isSetName()) {
      this.name = other.name;
    }
    if (other.isSetSerDe()) {
      this.serDe = new SerDeInfo(other.serDe);
    }
  }

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

  @Override
  public void clear() {
    this.schema = null;
    setVersionIsSet(false);
    this.version = 0;
    setCreatedAtIsSet(false);
    this.createdAt = 0;
    this.cols = null;
    this.state = null;
    this.description = null;
    this.schemaText = null;
    this.fingerprint = null;
    this.name = null;
    this.serDe = null;
  }

  public ISchemaName getSchema() {
    return this.schema;
  }

  public void setSchema(ISchemaName schema) {
    this.schema = schema;
  }

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

  public int getVersion() {
    return this.version;
  }

  public void setVersion(int version) {
    this.version = version;
    setVersionIsSet(true);
  }

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

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

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

  public long getCreatedAt() {
    return this.createdAt;
  }

  public void setCreatedAt(long createdAt) {
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
  }

  public void unsetCreatedAt() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATEDAT_ISSET_ID);
  }

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

  public void setCreatedAtIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATEDAT_ISSET_ID, value);
  }

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

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

  public void addToCols(FieldSchema elem) {
    if (this.cols == null) {
      this.cols = new ArrayList();
    }
    this.cols.add(elem);
  }

  public List getCols() {
    return this.cols;
  }

  public void setCols(List cols) {
    this.cols = cols;
  }

  public void unsetCols() {
    this.cols = null;
  }

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

  public void setColsIsSet(boolean value) {
    if (!value) {
      this.cols = null;
    }
  }

  /**
   * 
   * @see SchemaVersionState
   */
  public SchemaVersionState getState() {
    return this.state;
  }

  /**
   * 
   * @see SchemaVersionState
   */
  public void setState(SchemaVersionState state) {
    this.state = state;
  }

  public void unsetState() {
    this.state = null;
  }

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

  public void setStateIsSet(boolean value) {
    if (!value) {
      this.state = null;
    }
  }

  public String getDescription() {
    return this.description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  public String getSchemaText() {
    return this.schemaText;
  }

  public void setSchemaText(String schemaText) {
    this.schemaText = schemaText;
  }

  public void unsetSchemaText() {
    this.schemaText = null;
  }

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

  public void setSchemaTextIsSet(boolean value) {
    if (!value) {
      this.schemaText = null;
    }
  }

  public String getFingerprint() {
    return this.fingerprint;
  }

  public void setFingerprint(String fingerprint) {
    this.fingerprint = fingerprint;
  }

  public void unsetFingerprint() {
    this.fingerprint = null;
  }

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

  public void setFingerprintIsSet(boolean value) {
    if (!value) {
      this.fingerprint = null;
    }
  }

  public String getName() {
    return this.name;
  }

  public void setName(String name) {
    this.name = name;
  }

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

  public SerDeInfo getSerDe() {
    return this.serDe;
  }

  public void setSerDe(SerDeInfo serDe) {
    this.serDe = serDe;
  }

  public void unsetSerDe() {
    this.serDe = null;
  }

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

  public void setSerDeIsSet(boolean value) {
    if (!value) {
      this.serDe = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SCHEMA:
      if (value == null) {
        unsetSchema();
      } else {
        setSchema((ISchemaName)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((Integer)value);
      }
      break;

    case CREATED_AT:
      if (value == null) {
        unsetCreatedAt();
      } else {
        setCreatedAt((Long)value);
      }
      break;

    case COLS:
      if (value == null) {
        unsetCols();
      } else {
        setCols((List)value);
      }
      break;

    case STATE:
      if (value == null) {
        unsetState();
      } else {
        setState((SchemaVersionState)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    case SCHEMA_TEXT:
      if (value == null) {
        unsetSchemaText();
      } else {
        setSchemaText((String)value);
      }
      break;

    case FINGERPRINT:
      if (value == null) {
        unsetFingerprint();
      } else {
        setFingerprint((String)value);
      }
      break;

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

    case SER_DE:
      if (value == null) {
        unsetSerDe();
      } else {
        setSerDe((SerDeInfo)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SCHEMA:
      return getSchema();

    case VERSION:
      return getVersion();

    case CREATED_AT:
      return getCreatedAt();

    case COLS:
      return getCols();

    case STATE:
      return getState();

    case DESCRIPTION:
      return getDescription();

    case SCHEMA_TEXT:
      return getSchemaText();

    case FINGERPRINT:
      return getFingerprint();

    case NAME:
      return getName();

    case SER_DE:
      return getSerDe();

    }
    throw new IllegalStateException();
  }

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

    switch (field) {
    case SCHEMA:
      return isSetSchema();
    case VERSION:
      return isSetVersion();
    case CREATED_AT:
      return isSetCreatedAt();
    case COLS:
      return isSetCols();
    case STATE:
      return isSetState();
    case DESCRIPTION:
      return isSetDescription();
    case SCHEMA_TEXT:
      return isSetSchemaText();
    case FINGERPRINT:
      return isSetFingerprint();
    case NAME:
      return isSetName();
    case SER_DE:
      return isSetSerDe();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(SchemaVersion that) {
    if (that == null)
      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_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_createdAt = true;
    boolean that_present_createdAt = true;
    if (this_present_createdAt || that_present_createdAt) {
      if (!(this_present_createdAt && that_present_createdAt))
        return false;
      if (this.createdAt != that.createdAt)
        return false;
    }

    boolean this_present_cols = true && this.isSetCols();
    boolean that_present_cols = true && that.isSetCols();
    if (this_present_cols || that_present_cols) {
      if (!(this_present_cols && that_present_cols))
        return false;
      if (!this.cols.equals(that.cols))
        return false;
    }

    boolean this_present_state = true && this.isSetState();
    boolean that_present_state = true && that.isSetState();
    if (this_present_state || that_present_state) {
      if (!(this_present_state && that_present_state))
        return false;
      if (!this.state.equals(that.state))
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    boolean this_present_schemaText = true && this.isSetSchemaText();
    boolean that_present_schemaText = true && that.isSetSchemaText();
    if (this_present_schemaText || that_present_schemaText) {
      if (!(this_present_schemaText && that_present_schemaText))
        return false;
      if (!this.schemaText.equals(that.schemaText))
        return false;
    }

    boolean this_present_fingerprint = true && this.isSetFingerprint();
    boolean that_present_fingerprint = true && that.isSetFingerprint();
    if (this_present_fingerprint || that_present_fingerprint) {
      if (!(this_present_fingerprint && that_present_fingerprint))
        return false;
      if (!this.fingerprint.equals(that.fingerprint))
        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_serDe = true && this.isSetSerDe();
    boolean that_present_serDe = true && that.isSetSerDe();
    if (this_present_serDe || that_present_serDe) {
      if (!(this_present_serDe && that_present_serDe))
        return false;
      if (!this.serDe.equals(that.serDe))
        return false;
    }

    return true;
  }

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

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

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

    boolean present_createdAt = true;
    list.add(present_createdAt);
    if (present_createdAt)
      list.add(createdAt);

    boolean present_cols = true && (isSetCols());
    list.add(present_cols);
    if (present_cols)
      list.add(cols);

    boolean present_state = true && (isSetState());
    list.add(present_state);
    if (present_state)
      list.add(state.getValue());

    boolean present_description = true && (isSetDescription());
    list.add(present_description);
    if (present_description)
      list.add(description);

    boolean present_schemaText = true && (isSetSchemaText());
    list.add(present_schemaText);
    if (present_schemaText)
      list.add(schemaText);

    boolean present_fingerprint = true && (isSetFingerprint());
    list.add(present_fingerprint);
    if (present_fingerprint)
      list.add(fingerprint);

    boolean present_name = true && (isSetName());
    list.add(present_name);
    if (present_name)
      list.add(name);

    boolean present_serDe = true && (isSetSerDe());
    list.add(present_serDe);
    if (present_serDe)
      list.add(serDe);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetSchema()).compareTo(other.isSetSchema());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSchema()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schema, other.schema);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreatedAt()).compareTo(other.isSetCreatedAt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreatedAt()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createdAt, other.createdAt);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCols()).compareTo(other.isSetCols());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCols()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cols, other.cols);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(other.isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, other.description);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSchemaText()).compareTo(other.isSetSchemaText());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSchemaText()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schemaText, other.schemaText);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFingerprint()).compareTo(other.isSetFingerprint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFingerprint()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fingerprint, other.fingerprint);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetName()).compareTo(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 = Boolean.valueOf(isSetSerDe()).compareTo(other.isSetSerDe());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSerDe()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serDe, other.serDe);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

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

    sb.append("schema:");
    if (this.schema == null) {
      sb.append("null");
    } else {
      sb.append(this.schema);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("version:");
    sb.append(this.version);
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdAt:");
    sb.append(this.createdAt);
    first = false;
    if (!first) sb.append(", ");
    sb.append("cols:");
    if (this.cols == null) {
      sb.append("null");
    } else {
      sb.append(this.cols);
    }
    first = false;
    if (isSetState()) {
      if (!first) sb.append(", ");
      sb.append("state:");
      if (this.state == null) {
        sb.append("null");
      } else {
        sb.append(this.state);
      }
      first = false;
    }
    if (isSetDescription()) {
      if (!first) sb.append(", ");
      sb.append("description:");
      if (this.description == null) {
        sb.append("null");
      } else {
        sb.append(this.description);
      }
      first = false;
    }
    if (isSetSchemaText()) {
      if (!first) sb.append(", ");
      sb.append("schemaText:");
      if (this.schemaText == null) {
        sb.append("null");
      } else {
        sb.append(this.schemaText);
      }
      first = false;
    }
    if (isSetFingerprint()) {
      if (!first) sb.append(", ");
      sb.append("fingerprint:");
      if (this.fingerprint == null) {
        sb.append("null");
      } else {
        sb.append(this.fingerprint);
      }
      first = false;
    }
    if (isSetName()) {
      if (!first) sb.append(", ");
      sb.append("name:");
      if (this.name == null) {
        sb.append("null");
      } else {
        sb.append(this.name);
      }
      first = false;
    }
    if (isSetSerDe()) {
      if (!first) sb.append(", ");
      sb.append("serDe:");
      if (this.serDe == null) {
        sb.append("null");
      } else {
        sb.append(this.serDe);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (schema != null) {
      schema.validate();
    }
    if (serDe != null) {
      serDe.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class SchemaVersionStandardSchemeFactory implements SchemeFactory {
    public SchemaVersionStandardScheme getScheme() {
      return new SchemaVersionStandardScheme();
    }
  }

  private static class SchemaVersionStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SchemaVersion 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: // SCHEMA
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.schema = new ISchemaName();
              struct.schema.read(iprot);
              struct.setSchemaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // 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 3: // CREATED_AT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.createdAt = iprot.readI64();
              struct.setCreatedAtIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // COLS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list912 = iprot.readListBegin();
                struct.cols = new ArrayList(_list912.size);
                FieldSchema _elem913;
                for (int _i914 = 0; _i914 < _list912.size; ++_i914)
                {
                  _elem913 = new FieldSchema();
                  _elem913.read(iprot);
                  struct.cols.add(_elem913);
                }
                iprot.readListEnd();
              }
              struct.setColsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STATE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.state = org.apache.hadoop.hive.metastore.api.SchemaVersionState.findByValue(iprot.readI32());
              struct.setStateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // DESCRIPTION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.description = iprot.readString();
              struct.setDescriptionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SCHEMA_TEXT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.schemaText = iprot.readString();
              struct.setSchemaTextIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // FINGERPRINT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fingerprint = iprot.readString();
              struct.setFingerprintIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // 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 10: // SER_DE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.serDe = new SerDeInfo();
              struct.serDe.read(iprot);
              struct.setSerDeIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.schema != null) {
        oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
        struct.schema.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(VERSION_FIELD_DESC);
      oprot.writeI32(struct.version);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CREATED_AT_FIELD_DESC);
      oprot.writeI64(struct.createdAt);
      oprot.writeFieldEnd();
      if (struct.cols != null) {
        oprot.writeFieldBegin(COLS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.cols.size()));
          for (FieldSchema _iter915 : struct.cols)
          {
            _iter915.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.state != null) {
        if (struct.isSetState()) {
          oprot.writeFieldBegin(STATE_FIELD_DESC);
          oprot.writeI32(struct.state.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.description != null) {
        if (struct.isSetDescription()) {
          oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
          oprot.writeString(struct.description);
          oprot.writeFieldEnd();
        }
      }
      if (struct.schemaText != null) {
        if (struct.isSetSchemaText()) {
          oprot.writeFieldBegin(SCHEMA_TEXT_FIELD_DESC);
          oprot.writeString(struct.schemaText);
          oprot.writeFieldEnd();
        }
      }
      if (struct.fingerprint != null) {
        if (struct.isSetFingerprint()) {
          oprot.writeFieldBegin(FINGERPRINT_FIELD_DESC);
          oprot.writeString(struct.fingerprint);
          oprot.writeFieldEnd();
        }
      }
      if (struct.name != null) {
        if (struct.isSetName()) {
          oprot.writeFieldBegin(NAME_FIELD_DESC);
          oprot.writeString(struct.name);
          oprot.writeFieldEnd();
        }
      }
      if (struct.serDe != null) {
        if (struct.isSetSerDe()) {
          oprot.writeFieldBegin(SER_DE_FIELD_DESC);
          struct.serDe.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SchemaVersionTupleSchemeFactory implements SchemeFactory {
    public SchemaVersionTupleScheme getScheme() {
      return new SchemaVersionTupleScheme();
    }
  }

  private static class SchemaVersionTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SchemaVersion struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetSchema()) {
        optionals.set(0);
      }
      if (struct.isSetVersion()) {
        optionals.set(1);
      }
      if (struct.isSetCreatedAt()) {
        optionals.set(2);
      }
      if (struct.isSetCols()) {
        optionals.set(3);
      }
      if (struct.isSetState()) {
        optionals.set(4);
      }
      if (struct.isSetDescription()) {
        optionals.set(5);
      }
      if (struct.isSetSchemaText()) {
        optionals.set(6);
      }
      if (struct.isSetFingerprint()) {
        optionals.set(7);
      }
      if (struct.isSetName()) {
        optionals.set(8);
      }
      if (struct.isSetSerDe()) {
        optionals.set(9);
      }
      oprot.writeBitSet(optionals, 10);
      if (struct.isSetSchema()) {
        struct.schema.write(oprot);
      }
      if (struct.isSetVersion()) {
        oprot.writeI32(struct.version);
      }
      if (struct.isSetCreatedAt()) {
        oprot.writeI64(struct.createdAt);
      }
      if (struct.isSetCols()) {
        {
          oprot.writeI32(struct.cols.size());
          for (FieldSchema _iter916 : struct.cols)
          {
            _iter916.write(oprot);
          }
        }
      }
      if (struct.isSetState()) {
        oprot.writeI32(struct.state.getValue());
      }
      if (struct.isSetDescription()) {
        oprot.writeString(struct.description);
      }
      if (struct.isSetSchemaText()) {
        oprot.writeString(struct.schemaText);
      }
      if (struct.isSetFingerprint()) {
        oprot.writeString(struct.fingerprint);
      }
      if (struct.isSetName()) {
        oprot.writeString(struct.name);
      }
      if (struct.isSetSerDe()) {
        struct.serDe.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SchemaVersion struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(10);
      if (incoming.get(0)) {
        struct.schema = new ISchemaName();
        struct.schema.read(iprot);
        struct.setSchemaIsSet(true);
      }
      if (incoming.get(1)) {
        struct.version = iprot.readI32();
        struct.setVersionIsSet(true);
      }
      if (incoming.get(2)) {
        struct.createdAt = iprot.readI64();
        struct.setCreatedAtIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list917 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.cols = new ArrayList(_list917.size);
          FieldSchema _elem918;
          for (int _i919 = 0; _i919 < _list917.size; ++_i919)
          {
            _elem918 = new FieldSchema();
            _elem918.read(iprot);
            struct.cols.add(_elem918);
          }
        }
        struct.setColsIsSet(true);
      }
      if (incoming.get(4)) {
        struct.state = org.apache.hadoop.hive.metastore.api.SchemaVersionState.findByValue(iprot.readI32());
        struct.setStateIsSet(true);
      }
      if (incoming.get(5)) {
        struct.description = iprot.readString();
        struct.setDescriptionIsSet(true);
      }
      if (incoming.get(6)) {
        struct.schemaText = iprot.readString();
        struct.setSchemaTextIsSet(true);
      }
      if (incoming.get(7)) {
        struct.fingerprint = iprot.readString();
        struct.setFingerprintIsSet(true);
      }
      if (incoming.get(8)) {
        struct.name = iprot.readString();
        struct.setNameIsSet(true);
      }
      if (incoming.get(9)) {
        struct.serDe = new SerDeInfo();
        struct.serDe.read(iprot);
        struct.setSerDeIsSet(true);
      }
    }
  }

}