/**
 * 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
public class StorageDescriptor implements org.apache.thrift.TBase<StorageDescriptor, StorageDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<StorageDescriptor> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("StorageDescriptor");

  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)1);
  private static final org.apache.thrift.protocol.TField LOCATION_FIELD_DESC = new org.apache.thrift.protocol.TField("location", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField INPUT_FORMAT_FIELD_DESC = new org.apache.thrift.protocol.TField("inputFormat", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField OUTPUT_FORMAT_FIELD_DESC = new org.apache.thrift.protocol.TField("outputFormat", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField COMPRESSED_FIELD_DESC = new org.apache.thrift.protocol.TField("compressed", org.apache.thrift.protocol.TType.BOOL, (short)5);
  private static final org.apache.thrift.protocol.TField NUM_BUCKETS_FIELD_DESC = new org.apache.thrift.protocol.TField("numBuckets", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField SERDE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("serdeInfo", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField BUCKET_COLS_FIELD_DESC = new org.apache.thrift.protocol.TField("bucketCols", org.apache.thrift.protocol.TType.LIST, (short)8);
  private static final org.apache.thrift.protocol.TField SORT_COLS_FIELD_DESC = new org.apache.thrift.protocol.TField("sortCols", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.MAP, (short)10);
  private static final org.apache.thrift.protocol.TField SKEWED_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("skewedInfo", org.apache.thrift.protocol.TType.STRUCT, (short)11);
  private static final org.apache.thrift.protocol.TField STORED_AS_SUB_DIRECTORIES_FIELD_DESC = new org.apache.thrift.protocol.TField("storedAsSubDirectories", org.apache.thrift.protocol.TType.BOOL, (short)12);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new StorageDescriptorStandardSchemeFactory());
    schemes.put(TupleScheme.class, new StorageDescriptorTupleSchemeFactory());
  }

  private List<FieldSchema> cols; // required
  private String location; // required
  private String inputFormat; // required
  private String outputFormat; // required
  private boolean compressed; // required
  private int numBuckets; // required
  private SerDeInfo serdeInfo; // required
  private List<String> bucketCols; // required
  private List<Order> sortCols; // required
  private Map<String,String> parameters; // required
  private SkewedInfo skewedInfo; // optional
  private boolean storedAsSubDirectories; // 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 {
    COLS((short)1, "cols"),
    LOCATION((short)2, "location"),
    INPUT_FORMAT((short)3, "inputFormat"),
    OUTPUT_FORMAT((short)4, "outputFormat"),
    COMPRESSED((short)5, "compressed"),
    NUM_BUCKETS((short)6, "numBuckets"),
    SERDE_INFO((short)7, "serdeInfo"),
    BUCKET_COLS((short)8, "bucketCols"),
    SORT_COLS((short)9, "sortCols"),
    PARAMETERS((short)10, "parameters"),
    SKEWED_INFO((short)11, "skewedInfo"),
    STORED_AS_SUB_DIRECTORIES((short)12, "storedAsSubDirectories");

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

    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: // COLS
          return COLS;
        case 2: // LOCATION
          return LOCATION;
        case 3: // INPUT_FORMAT
          return INPUT_FORMAT;
        case 4: // OUTPUT_FORMAT
          return OUTPUT_FORMAT;
        case 5: // COMPRESSED
          return COMPRESSED;
        case 6: // NUM_BUCKETS
          return NUM_BUCKETS;
        case 7: // SERDE_INFO
          return SERDE_INFO;
        case 8: // BUCKET_COLS
          return BUCKET_COLS;
        case 9: // SORT_COLS
          return SORT_COLS;
        case 10: // PARAMETERS
          return PARAMETERS;
        case 11: // SKEWED_INFO
          return SKEWED_INFO;
        case 12: // STORED_AS_SUB_DIRECTORIES
          return STORED_AS_SUB_DIRECTORIES;
        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 __COMPRESSED_ISSET_ID = 0;
  private static final int __NUMBUCKETS_ISSET_ID = 1;
  private static final int __STOREDASSUBDIRECTORIES_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.SKEWED_INFO,_Fields.STORED_AS_SUB_DIRECTORIES};
  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.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.LOCATION, new org.apache.thrift.meta_data.FieldMetaData("location", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.INPUT_FORMAT, new org.apache.thrift.meta_data.FieldMetaData("inputFormat", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.OUTPUT_FORMAT, new org.apache.thrift.meta_data.FieldMetaData("outputFormat", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.COMPRESSED, new org.apache.thrift.meta_data.FieldMetaData("compressed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.NUM_BUCKETS, new org.apache.thrift.meta_data.FieldMetaData("numBuckets", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.SERDE_INFO, new org.apache.thrift.meta_data.FieldMetaData("serdeInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SerDeInfo.class)));
    tmpMap.put(_Fields.BUCKET_COLS, new org.apache.thrift.meta_data.FieldMetaData("bucketCols", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.SORT_COLS, new org.apache.thrift.meta_data.FieldMetaData("sortCols", 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, Order.class))));
    tmpMap.put(_Fields.PARAMETERS, new org.apache.thrift.meta_data.FieldMetaData("parameters", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.SKEWED_INFO, new org.apache.thrift.meta_data.FieldMetaData("skewedInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SkewedInfo.class)));
    tmpMap.put(_Fields.STORED_AS_SUB_DIRECTORIES, new org.apache.thrift.meta_data.FieldMetaData("storedAsSubDirectories", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StorageDescriptor.class, metaDataMap);
  }

  public StorageDescriptor() {
  }

  public StorageDescriptor(
    List<FieldSchema> cols,
    String location,
    String inputFormat,
    String outputFormat,
    boolean compressed,
    int numBuckets,
    SerDeInfo serdeInfo,
    List<String> bucketCols,
    List<Order> sortCols,
    Map<String,String> parameters)
  {
    this();
    this.cols = cols;
    this.location = org.apache.hive.common.util.HiveStringUtils.intern(location);
    this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(inputFormat);
    this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(outputFormat);
    this.compressed = compressed;
    setCompressedIsSet(true);
    this.numBuckets = numBuckets;
    setNumBucketsIsSet(true);
    this.serdeInfo = serdeInfo;
    this.bucketCols = org.apache.hive.common.util.HiveStringUtils.intern(bucketCols);
    this.sortCols = sortCols;
    this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public StorageDescriptor(StorageDescriptor other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetCols()) {
      List<FieldSchema> __this__cols = new ArrayList<FieldSchema>(other.cols.size());
      for (FieldSchema other_element : other.cols) {
        __this__cols.add(new FieldSchema(other_element));
      }
      this.cols = __this__cols;
    }
    if (other.isSetLocation()) {
      this.location = org.apache.hive.common.util.HiveStringUtils.intern(other.location);
    }
    if (other.isSetInputFormat()) {
      this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(other.inputFormat);
    }
    if (other.isSetOutputFormat()) {
      this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(other.outputFormat);
    }
    this.compressed = other.compressed;
    this.numBuckets = other.numBuckets;
    if (other.isSetSerdeInfo()) {
      this.serdeInfo = new SerDeInfo(other.serdeInfo);
    }
    if (other.isSetBucketCols()) {
      List<String> __this__bucketCols = new ArrayList<String>(other.bucketCols);
      this.bucketCols = __this__bucketCols;
    }
    if (other.isSetSortCols()) {
      List<Order> __this__sortCols = new ArrayList<Order>(other.sortCols.size());
      for (Order other_element : other.sortCols) {
        __this__sortCols.add(new Order(other_element));
      }
      this.sortCols = __this__sortCols;
    }
    if (other.isSetParameters()) {
      Map<String,String> __this__parameters = new HashMap<String,String>(other.parameters);
      this.parameters = __this__parameters;
    }
    if (other.isSetSkewedInfo()) {
      this.skewedInfo = new SkewedInfo(other.skewedInfo);
    }
    this.storedAsSubDirectories = other.storedAsSubDirectories;
  }

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

  @Override
  public void clear() {
    this.cols = null;
    this.location = null;
    this.inputFormat = null;
    this.outputFormat = null;
    setCompressedIsSet(false);
    this.compressed = false;
    setNumBucketsIsSet(false);
    this.numBuckets = 0;
    this.serdeInfo = null;
    this.bucketCols = null;
    this.sortCols = null;
    this.parameters = null;
    this.skewedInfo = null;
    setStoredAsSubDirectoriesIsSet(false);
    this.storedAsSubDirectories = false;
  }

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

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

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

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

  public void setCols(List<FieldSchema> 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;
    }
  }

  public String getLocation() {
    return this.location;
  }

  public void setLocation(String location) {
    this.location = org.apache.hive.common.util.HiveStringUtils.intern(location);
  }

  public void unsetLocation() {
    this.location = null;
  }

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

  public void setLocationIsSet(boolean value) {
    if (!value) {
      this.location = null;
    }
  }

  public String getInputFormat() {
    return this.inputFormat;
  }

  public void setInputFormat(String inputFormat) {
    this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(inputFormat);
  }

  public void unsetInputFormat() {
    this.inputFormat = null;
  }

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

  public void setInputFormatIsSet(boolean value) {
    if (!value) {
      this.inputFormat = null;
    }
  }

  public String getOutputFormat() {
    return this.outputFormat;
  }

  public void setOutputFormat(String outputFormat) {
    this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(outputFormat);
  }

  public void unsetOutputFormat() {
    this.outputFormat = null;
  }

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

  public void setOutputFormatIsSet(boolean value) {
    if (!value) {
      this.outputFormat = null;
    }
  }

  public boolean isCompressed() {
    return this.compressed;
  }

  public void setCompressed(boolean compressed) {
    this.compressed = compressed;
    setCompressedIsSet(true);
  }

  public void unsetCompressed() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COMPRESSED_ISSET_ID);
  }

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

  public void setCompressedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COMPRESSED_ISSET_ID, value);
  }

  public int getNumBuckets() {
    return this.numBuckets;
  }

  public void setNumBuckets(int numBuckets) {
    this.numBuckets = numBuckets;
    setNumBucketsIsSet(true);
  }

  public void unsetNumBuckets() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMBUCKETS_ISSET_ID);
  }

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

  public void setNumBucketsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMBUCKETS_ISSET_ID, value);
  }

  public SerDeInfo getSerdeInfo() {
    return this.serdeInfo;
  }

  public void setSerdeInfo(SerDeInfo serdeInfo) {
    this.serdeInfo = serdeInfo;
  }

  public void unsetSerdeInfo() {
    this.serdeInfo = null;
  }

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

  public void setSerdeInfoIsSet(boolean value) {
    if (!value) {
      this.serdeInfo = null;
    }
  }

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

  public java.util.Iterator<String> getBucketColsIterator() {
    return (this.bucketCols == null) ? null : this.bucketCols.iterator();
  }

  public void addToBucketCols(String elem) {
    if (this.bucketCols == null) {
      this.bucketCols = new ArrayList<String>();
    }
    this.bucketCols.add(elem);
  }

  public List<String> getBucketCols() {
    return this.bucketCols;
  }

  public void setBucketCols(List<String> bucketCols) {
    this.bucketCols = org.apache.hive.common.util.HiveStringUtils.intern(bucketCols);
  }

  public void unsetBucketCols() {
    this.bucketCols = null;
  }

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

  public void setBucketColsIsSet(boolean value) {
    if (!value) {
      this.bucketCols = null;
    }
  }

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

  public java.util.Iterator<Order> getSortColsIterator() {
    return (this.sortCols == null) ? null : this.sortCols.iterator();
  }

  public void addToSortCols(Order elem) {
    if (this.sortCols == null) {
      this.sortCols = new ArrayList<Order>();
    }
    this.sortCols.add(elem);
  }

  public List<Order> getSortCols() {
    return this.sortCols;
  }

  public void setSortCols(List<Order> sortCols) {
    this.sortCols = sortCols;
  }

  public void unsetSortCols() {
    this.sortCols = null;
  }

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

  public void setSortColsIsSet(boolean value) {
    if (!value) {
      this.sortCols = null;
    }
  }

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

  public void putToParameters(String key, String val) {
    if (this.parameters == null) {
      this.parameters = new HashMap<String,String>();
    }
    this.parameters.put(key, val);
  }

  public Map<String,String> getParameters() {
    return this.parameters;
  }

  public void setParameters(Map<String,String> parameters) {
    this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters);
  }

  public void unsetParameters() {
    this.parameters = null;
  }

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

  public void setParametersIsSet(boolean value) {
    if (!value) {
      this.parameters = null;
    }
  }

  public SkewedInfo getSkewedInfo() {
    return this.skewedInfo;
  }

  public void setSkewedInfo(SkewedInfo skewedInfo) {
    this.skewedInfo = skewedInfo;
  }

  public void unsetSkewedInfo() {
    this.skewedInfo = null;
  }

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

  public void setSkewedInfoIsSet(boolean value) {
    if (!value) {
      this.skewedInfo = null;
    }
  }

  public boolean isStoredAsSubDirectories() {
    return this.storedAsSubDirectories;
  }

  public void setStoredAsSubDirectories(boolean storedAsSubDirectories) {
    this.storedAsSubDirectories = storedAsSubDirectories;
    setStoredAsSubDirectoriesIsSet(true);
  }

  public void unsetStoredAsSubDirectories() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STOREDASSUBDIRECTORIES_ISSET_ID);
  }

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

  public void setStoredAsSubDirectoriesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STOREDASSUBDIRECTORIES_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case COLS:
      if (value == null) {
        unsetCols();
      } else {
        setCols((List<FieldSchema>)value);
      }
      break;

    case LOCATION:
      if (value == null) {
        unsetLocation();
      } else {
        setLocation((String)value);
      }
      break;

    case INPUT_FORMAT:
      if (value == null) {
        unsetInputFormat();
      } else {
        setInputFormat((String)value);
      }
      break;

    case OUTPUT_FORMAT:
      if (value == null) {
        unsetOutputFormat();
      } else {
        setOutputFormat((String)value);
      }
      break;

    case COMPRESSED:
      if (value == null) {
        unsetCompressed();
      } else {
        setCompressed((Boolean)value);
      }
      break;

    case NUM_BUCKETS:
      if (value == null) {
        unsetNumBuckets();
      } else {
        setNumBuckets((Integer)value);
      }
      break;

    case SERDE_INFO:
      if (value == null) {
        unsetSerdeInfo();
      } else {
        setSerdeInfo((SerDeInfo)value);
      }
      break;

    case BUCKET_COLS:
      if (value == null) {
        unsetBucketCols();
      } else {
        setBucketCols((List<String>)value);
      }
      break;

    case SORT_COLS:
      if (value == null) {
        unsetSortCols();
      } else {
        setSortCols((List<Order>)value);
      }
      break;

    case PARAMETERS:
      if (value == null) {
        unsetParameters();
      } else {
        setParameters((Map<String,String>)value);
      }
      break;

    case SKEWED_INFO:
      if (value == null) {
        unsetSkewedInfo();
      } else {
        setSkewedInfo((SkewedInfo)value);
      }
      break;

    case STORED_AS_SUB_DIRECTORIES:
      if (value == null) {
        unsetStoredAsSubDirectories();
      } else {
        setStoredAsSubDirectories((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case COLS:
      return getCols();

    case LOCATION:
      return getLocation();

    case INPUT_FORMAT:
      return getInputFormat();

    case OUTPUT_FORMAT:
      return getOutputFormat();

    case COMPRESSED:
      return isCompressed();

    case NUM_BUCKETS:
      return getNumBuckets();

    case SERDE_INFO:
      return getSerdeInfo();

    case BUCKET_COLS:
      return getBucketCols();

    case SORT_COLS:
      return getSortCols();

    case PARAMETERS:
      return getParameters();

    case SKEWED_INFO:
      return getSkewedInfo();

    case STORED_AS_SUB_DIRECTORIES:
      return isStoredAsSubDirectories();

    }
    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 COLS:
      return isSetCols();
    case LOCATION:
      return isSetLocation();
    case INPUT_FORMAT:
      return isSetInputFormat();
    case OUTPUT_FORMAT:
      return isSetOutputFormat();
    case COMPRESSED:
      return isSetCompressed();
    case NUM_BUCKETS:
      return isSetNumBuckets();
    case SERDE_INFO:
      return isSetSerdeInfo();
    case BUCKET_COLS:
      return isSetBucketCols();
    case SORT_COLS:
      return isSetSortCols();
    case PARAMETERS:
      return isSetParameters();
    case SKEWED_INFO:
      return isSetSkewedInfo();
    case STORED_AS_SUB_DIRECTORIES:
      return isSetStoredAsSubDirectories();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(StorageDescriptor that) {
    if (that == null)
      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_location = true && this.isSetLocation();
    boolean that_present_location = true && that.isSetLocation();
    if (this_present_location || that_present_location) {
      if (!(this_present_location && that_present_location))
        return false;
      if (!this.location.equals(that.location))
        return false;
    }

    boolean this_present_inputFormat = true && this.isSetInputFormat();
    boolean that_present_inputFormat = true && that.isSetInputFormat();
    if (this_present_inputFormat || that_present_inputFormat) {
      if (!(this_present_inputFormat && that_present_inputFormat))
        return false;
      if (!this.inputFormat.equals(that.inputFormat))
        return false;
    }

    boolean this_present_outputFormat = true && this.isSetOutputFormat();
    boolean that_present_outputFormat = true && that.isSetOutputFormat();
    if (this_present_outputFormat || that_present_outputFormat) {
      if (!(this_present_outputFormat && that_present_outputFormat))
        return false;
      if (!this.outputFormat.equals(that.outputFormat))
        return false;
    }

    boolean this_present_compressed = true;
    boolean that_present_compressed = true;
    if (this_present_compressed || that_present_compressed) {
      if (!(this_present_compressed && that_present_compressed))
        return false;
      if (this.compressed != that.compressed)
        return false;
    }

    boolean this_present_numBuckets = true;
    boolean that_present_numBuckets = true;
    if (this_present_numBuckets || that_present_numBuckets) {
      if (!(this_present_numBuckets && that_present_numBuckets))
        return false;
      if (this.numBuckets != that.numBuckets)
        return false;
    }

    boolean this_present_serdeInfo = true && this.isSetSerdeInfo();
    boolean that_present_serdeInfo = true && that.isSetSerdeInfo();
    if (this_present_serdeInfo || that_present_serdeInfo) {
      if (!(this_present_serdeInfo && that_present_serdeInfo))
        return false;
      if (!this.serdeInfo.equals(that.serdeInfo))
        return false;
    }

    boolean this_present_bucketCols = true && this.isSetBucketCols();
    boolean that_present_bucketCols = true && that.isSetBucketCols();
    if (this_present_bucketCols || that_present_bucketCols) {
      if (!(this_present_bucketCols && that_present_bucketCols))
        return false;
      if (!this.bucketCols.equals(that.bucketCols))
        return false;
    }

    boolean this_present_sortCols = true && this.isSetSortCols();
    boolean that_present_sortCols = true && that.isSetSortCols();
    if (this_present_sortCols || that_present_sortCols) {
      if (!(this_present_sortCols && that_present_sortCols))
        return false;
      if (!this.sortCols.equals(that.sortCols))
        return false;
    }

    boolean this_present_parameters = true && this.isSetParameters();
    boolean that_present_parameters = true && that.isSetParameters();
    if (this_present_parameters || that_present_parameters) {
      if (!(this_present_parameters && that_present_parameters))
        return false;
      if (!this.parameters.equals(that.parameters))
        return false;
    }

    boolean this_present_skewedInfo = true && this.isSetSkewedInfo();
    boolean that_present_skewedInfo = true && that.isSetSkewedInfo();
    if (this_present_skewedInfo || that_present_skewedInfo) {
      if (!(this_present_skewedInfo && that_present_skewedInfo))
        return false;
      if (!this.skewedInfo.equals(that.skewedInfo))
        return false;
    }

    boolean this_present_storedAsSubDirectories = true && this.isSetStoredAsSubDirectories();
    boolean that_present_storedAsSubDirectories = true && that.isSetStoredAsSubDirectories();
    if (this_present_storedAsSubDirectories || that_present_storedAsSubDirectories) {
      if (!(this_present_storedAsSubDirectories && that_present_storedAsSubDirectories))
        return false;
      if (this.storedAsSubDirectories != that.storedAsSubDirectories)
        return false;
    }

    return true;
  }

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

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

    boolean present_location = true && (isSetLocation());
    list.add(present_location);
    if (present_location)
      list.add(location);

    boolean present_inputFormat = true && (isSetInputFormat());
    list.add(present_inputFormat);
    if (present_inputFormat)
      list.add(inputFormat);

    boolean present_outputFormat = true && (isSetOutputFormat());
    list.add(present_outputFormat);
    if (present_outputFormat)
      list.add(outputFormat);

    boolean present_compressed = true;
    list.add(present_compressed);
    if (present_compressed)
      list.add(compressed);

    boolean present_numBuckets = true;
    list.add(present_numBuckets);
    if (present_numBuckets)
      list.add(numBuckets);

    boolean present_serdeInfo = true && (isSetSerdeInfo());
    list.add(present_serdeInfo);
    if (present_serdeInfo)
      list.add(serdeInfo);

    boolean present_bucketCols = true && (isSetBucketCols());
    list.add(present_bucketCols);
    if (present_bucketCols)
      list.add(bucketCols);

    boolean present_sortCols = true && (isSetSortCols());
    list.add(present_sortCols);
    if (present_sortCols)
      list.add(sortCols);

    boolean present_parameters = true && (isSetParameters());
    list.add(present_parameters);
    if (present_parameters)
      list.add(parameters);

    boolean present_skewedInfo = true && (isSetSkewedInfo());
    list.add(present_skewedInfo);
    if (present_skewedInfo)
      list.add(skewedInfo);

    boolean present_storedAsSubDirectories = true && (isSetStoredAsSubDirectories());
    list.add(present_storedAsSubDirectories);
    if (present_storedAsSubDirectories)
      list.add(storedAsSubDirectories);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    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(isSetLocation()).compareTo(other.isSetLocation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLocation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.location, other.location);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInputFormat()).compareTo(other.isSetInputFormat());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInputFormat()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inputFormat, other.inputFormat);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOutputFormat()).compareTo(other.isSetOutputFormat());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOutputFormat()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.outputFormat, other.outputFormat);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCompressed()).compareTo(other.isSetCompressed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCompressed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compressed, other.compressed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNumBuckets()).compareTo(other.isSetNumBuckets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumBuckets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numBuckets, other.numBuckets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSerdeInfo()).compareTo(other.isSetSerdeInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSerdeInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serdeInfo, other.serdeInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBucketCols()).compareTo(other.isSetBucketCols());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBucketCols()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bucketCols, other.bucketCols);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSortCols()).compareTo(other.isSetSortCols());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSortCols()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sortCols, other.sortCols);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetParameters()).compareTo(other.isSetParameters());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetParameters()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parameters, other.parameters);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSkewedInfo()).compareTo(other.isSetSkewedInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSkewedInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.skewedInfo, other.skewedInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStoredAsSubDirectories()).compareTo(other.isSetStoredAsSubDirectories());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStoredAsSubDirectories()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storedAsSubDirectories, other.storedAsSubDirectories);
      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("StorageDescriptor(");
    boolean first = true;

    sb.append("cols:");
    if (this.cols == null) {
      sb.append("null");
    } else {
      sb.append(this.cols);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("location:");
    if (this.location == null) {
      sb.append("null");
    } else {
      sb.append(this.location);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("inputFormat:");
    if (this.inputFormat == null) {
      sb.append("null");
    } else {
      sb.append(this.inputFormat);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("outputFormat:");
    if (this.outputFormat == null) {
      sb.append("null");
    } else {
      sb.append(this.outputFormat);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("compressed:");
    sb.append(this.compressed);
    first = false;
    if (!first) sb.append(", ");
    sb.append("numBuckets:");
    sb.append(this.numBuckets);
    first = false;
    if (!first) sb.append(", ");
    sb.append("serdeInfo:");
    if (this.serdeInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.serdeInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("bucketCols:");
    if (this.bucketCols == null) {
      sb.append("null");
    } else {
      sb.append(this.bucketCols);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("sortCols:");
    if (this.sortCols == null) {
      sb.append("null");
    } else {
      sb.append(this.sortCols);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("parameters:");
    if (this.parameters == null) {
      sb.append("null");
    } else {
      sb.append(this.parameters);
    }
    first = false;
    if (isSetSkewedInfo()) {
      if (!first) sb.append(", ");
      sb.append("skewedInfo:");
      if (this.skewedInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.skewedInfo);
      }
      first = false;
    }
    if (isSetStoredAsSubDirectories()) {
      if (!first) sb.append(", ");
      sb.append("storedAsSubDirectories:");
      sb.append(this.storedAsSubDirectories);
      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 (serdeInfo != null) {
      serdeInfo.validate();
    }
    if (skewedInfo != null) {
      skewedInfo.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 StorageDescriptorStandardSchemeFactory implements SchemeFactory {
    public StorageDescriptorStandardScheme getScheme() {
      return new StorageDescriptorStandardScheme();
    }
  }

  private static class StorageDescriptorStandardScheme extends StandardScheme<StorageDescriptor> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, StorageDescriptor 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: // COLS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list156 = iprot.readListBegin();
                struct.cols = new ArrayList<FieldSchema>(_list156.size);
                FieldSchema _elem157;
                for (int _i158 = 0; _i158 < _list156.size; ++_i158)
                {
                  _elem157 = new FieldSchema();
                  _elem157.read(iprot);
                  struct.cols.add(_elem157);
                }
                iprot.readListEnd();
              }
              struct.setColsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LOCATION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.location = iprot.readString();
              struct.setLocationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // INPUT_FORMAT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.inputFormat = iprot.readString();
              struct.setInputFormatIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // OUTPUT_FORMAT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.outputFormat = iprot.readString();
              struct.setOutputFormatIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // COMPRESSED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.compressed = iprot.readBool();
              struct.setCompressedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // NUM_BUCKETS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.numBuckets = iprot.readI32();
              struct.setNumBucketsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SERDE_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.serdeInfo = new SerDeInfo();
              struct.serdeInfo.read(iprot);
              struct.setSerdeInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // BUCKET_COLS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list159 = iprot.readListBegin();
                struct.bucketCols = new ArrayList<String>(_list159.size);
                String _elem160;
                for (int _i161 = 0; _i161 < _list159.size; ++_i161)
                {
                  _elem160 = iprot.readString();
                  struct.bucketCols.add(_elem160);
                }
                iprot.readListEnd();
              }
              struct.setBucketColsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // SORT_COLS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list162 = iprot.readListBegin();
                struct.sortCols = new ArrayList<Order>(_list162.size);
                Order _elem163;
                for (int _i164 = 0; _i164 < _list162.size; ++_i164)
                {
                  _elem163 = new Order();
                  _elem163.read(iprot);
                  struct.sortCols.add(_elem163);
                }
                iprot.readListEnd();
              }
              struct.setSortColsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // PARAMETERS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map165 = iprot.readMapBegin();
                struct.parameters = new HashMap<String,String>(2*_map165.size);
                String _key166;
                String _val167;
                for (int _i168 = 0; _i168 < _map165.size; ++_i168)
                {
                  _key166 = iprot.readString();
                  _val167 = iprot.readString();
                  struct.parameters.put(_key166, _val167);
                }
                iprot.readMapEnd();
              }
              struct.setParametersIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // SKEWED_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.skewedInfo = new SkewedInfo();
              struct.skewedInfo.read(iprot);
              struct.setSkewedInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // STORED_AS_SUB_DIRECTORIES
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.storedAsSubDirectories = iprot.readBool();
              struct.setStoredAsSubDirectoriesIsSet(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, StorageDescriptor struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      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 _iter169 : struct.cols)
          {
            _iter169.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.location != null) {
        oprot.writeFieldBegin(LOCATION_FIELD_DESC);
        oprot.writeString(struct.location);
        oprot.writeFieldEnd();
      }
      if (struct.inputFormat != null) {
        oprot.writeFieldBegin(INPUT_FORMAT_FIELD_DESC);
        oprot.writeString(struct.inputFormat);
        oprot.writeFieldEnd();
      }
      if (struct.outputFormat != null) {
        oprot.writeFieldBegin(OUTPUT_FORMAT_FIELD_DESC);
        oprot.writeString(struct.outputFormat);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(COMPRESSED_FIELD_DESC);
      oprot.writeBool(struct.compressed);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_BUCKETS_FIELD_DESC);
      oprot.writeI32(struct.numBuckets);
      oprot.writeFieldEnd();
      if (struct.serdeInfo != null) {
        oprot.writeFieldBegin(SERDE_INFO_FIELD_DESC);
        struct.serdeInfo.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.bucketCols != null) {
        oprot.writeFieldBegin(BUCKET_COLS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.bucketCols.size()));
          for (String _iter170 : struct.bucketCols)
          {
            oprot.writeString(_iter170);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.sortCols != null) {
        oprot.writeFieldBegin(SORT_COLS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.sortCols.size()));
          for (Order _iter171 : struct.sortCols)
          {
            _iter171.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.parameters != null) {
        oprot.writeFieldBegin(PARAMETERS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.parameters.size()));
          for (Map.Entry<String, String> _iter172 : struct.parameters.entrySet())
          {
            oprot.writeString(_iter172.getKey());
            oprot.writeString(_iter172.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.skewedInfo != null) {
        if (struct.isSetSkewedInfo()) {
          oprot.writeFieldBegin(SKEWED_INFO_FIELD_DESC);
          struct.skewedInfo.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetStoredAsSubDirectories()) {
        oprot.writeFieldBegin(STORED_AS_SUB_DIRECTORIES_FIELD_DESC);
        oprot.writeBool(struct.storedAsSubDirectories);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class StorageDescriptorTupleSchemeFactory implements SchemeFactory {
    public StorageDescriptorTupleScheme getScheme() {
      return new StorageDescriptorTupleScheme();
    }
  }

  private static class StorageDescriptorTupleScheme extends TupleScheme<StorageDescriptor> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, StorageDescriptor struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetCols()) {
        optionals.set(0);
      }
      if (struct.isSetLocation()) {
        optionals.set(1);
      }
      if (struct.isSetInputFormat()) {
        optionals.set(2);
      }
      if (struct.isSetOutputFormat()) {
        optionals.set(3);
      }
      if (struct.isSetCompressed()) {
        optionals.set(4);
      }
      if (struct.isSetNumBuckets()) {
        optionals.set(5);
      }
      if (struct.isSetSerdeInfo()) {
        optionals.set(6);
      }
      if (struct.isSetBucketCols()) {
        optionals.set(7);
      }
      if (struct.isSetSortCols()) {
        optionals.set(8);
      }
      if (struct.isSetParameters()) {
        optionals.set(9);
      }
      if (struct.isSetSkewedInfo()) {
        optionals.set(10);
      }
      if (struct.isSetStoredAsSubDirectories()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetCols()) {
        {
          oprot.writeI32(struct.cols.size());
          for (FieldSchema _iter173 : struct.cols)
          {
            _iter173.write(oprot);
          }
        }
      }
      if (struct.isSetLocation()) {
        oprot.writeString(struct.location);
      }
      if (struct.isSetInputFormat()) {
        oprot.writeString(struct.inputFormat);
      }
      if (struct.isSetOutputFormat()) {
        oprot.writeString(struct.outputFormat);
      }
      if (struct.isSetCompressed()) {
        oprot.writeBool(struct.compressed);
      }
      if (struct.isSetNumBuckets()) {
        oprot.writeI32(struct.numBuckets);
      }
      if (struct.isSetSerdeInfo()) {
        struct.serdeInfo.write(oprot);
      }
      if (struct.isSetBucketCols()) {
        {
          oprot.writeI32(struct.bucketCols.size());
          for (String _iter174 : struct.bucketCols)
          {
            oprot.writeString(_iter174);
          }
        }
      }
      if (struct.isSetSortCols()) {
        {
          oprot.writeI32(struct.sortCols.size());
          for (Order _iter175 : struct.sortCols)
          {
            _iter175.write(oprot);
          }
        }
      }
      if (struct.isSetParameters()) {
        {
          oprot.writeI32(struct.parameters.size());
          for (Map.Entry<String, String> _iter176 : struct.parameters.entrySet())
          {
            oprot.writeString(_iter176.getKey());
            oprot.writeString(_iter176.getValue());
          }
        }
      }
      if (struct.isSetSkewedInfo()) {
        struct.skewedInfo.write(oprot);
      }
      if (struct.isSetStoredAsSubDirectories()) {
        oprot.writeBool(struct.storedAsSubDirectories);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, StorageDescriptor struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list177 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.cols = new ArrayList<FieldSchema>(_list177.size);
          FieldSchema _elem178;
          for (int _i179 = 0; _i179 < _list177.size; ++_i179)
          {
            _elem178 = new FieldSchema();
            _elem178.read(iprot);
            struct.cols.add(_elem178);
          }
        }
        struct.setColsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.location = iprot.readString();
        struct.setLocationIsSet(true);
      }
      if (incoming.get(2)) {
        struct.inputFormat = iprot.readString();
        struct.setInputFormatIsSet(true);
      }
      if (incoming.get(3)) {
        struct.outputFormat = iprot.readString();
        struct.setOutputFormatIsSet(true);
      }
      if (incoming.get(4)) {
        struct.compressed = iprot.readBool();
        struct.setCompressedIsSet(true);
      }
      if (incoming.get(5)) {
        struct.numBuckets = iprot.readI32();
        struct.setNumBucketsIsSet(true);
      }
      if (incoming.get(6)) {
        struct.serdeInfo = new SerDeInfo();
        struct.serdeInfo.read(iprot);
        struct.setSerdeInfoIsSet(true);
      }
      if (incoming.get(7)) {
        {
          org.apache.thrift.protocol.TList _list180 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.bucketCols = new ArrayList<String>(_list180.size);
          String _elem181;
          for (int _i182 = 0; _i182 < _list180.size; ++_i182)
          {
            _elem181 = iprot.readString();
            struct.bucketCols.add(_elem181);
          }
        }
        struct.setBucketColsIsSet(true);
      }
      if (incoming.get(8)) {
        {
          org.apache.thrift.protocol.TList _list183 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.sortCols = new ArrayList<Order>(_list183.size);
          Order _elem184;
          for (int _i185 = 0; _i185 < _list183.size; ++_i185)
          {
            _elem184 = new Order();
            _elem184.read(iprot);
            struct.sortCols.add(_elem184);
          }
        }
        struct.setSortColsIsSet(true);
      }
      if (incoming.get(9)) {
        {
          org.apache.thrift.protocol.TMap _map186 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.parameters = new HashMap<String,String>(2*_map186.size);
          String _key187;
          String _val188;
          for (int _i189 = 0; _i189 < _map186.size; ++_i189)
          {
            _key187 = iprot.readString();
            _val188 = iprot.readString();
            struct.parameters.put(_key187, _val188);
          }
        }
        struct.setParametersIsSet(true);
      }
      if (incoming.get(10)) {
        struct.skewedInfo = new SkewedInfo();
        struct.skewedInfo.read(iprot);
        struct.setSkewedInfoIsSet(true);
      }
      if (incoming.get(11)) {
        struct.storedAsSubDirectories = iprot.readBool();
        struct.setStoredAsSubDirectoriesIsSet(true);
      }
    }
  }

}

