Package org.apache.hadoop.hive.metastore.api

Source Code of org.apache.hadoop.hive.metastore.api.SkewedInfo$SkewedInfoStandardScheme

/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* 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.commons.lang.builder.HashCodeBuilder;
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 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SkewedInfo implements org.apache.thrift.TBase<SkewedInfo, SkewedInfo._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SkewedInfo");

  private static final org.apache.thrift.protocol.TField SKEWED_COL_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("skewedColNames", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField SKEWED_COL_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("skewedColValues", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField SKEWED_COL_VALUE_LOCATION_MAPS_FIELD_DESC = new org.apache.thrift.protocol.TField("skewedColValueLocationMaps", org.apache.thrift.protocol.TType.MAP, (short)3);

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

  private List<String> skewedColNames; // required
  private List<List<String>> skewedColValues; // required
  private Map<List<String>,String> skewedColValueLocationMaps; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    SKEWED_COL_NAMES((short)1, "skewedColNames"),
    SKEWED_COL_VALUES((short)2, "skewedColValues"),
    SKEWED_COL_VALUE_LOCATION_MAPS((short)3, "skewedColValueLocationMaps");

    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: // SKEWED_COL_NAMES
          return SKEWED_COL_NAMES;
        case 2: // SKEWED_COL_VALUES
          return SKEWED_COL_VALUES;
        case 3: // SKEWED_COL_VALUE_LOCATION_MAPS
          return SKEWED_COL_VALUE_LOCATION_MAPS;
        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
  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.SKEWED_COL_NAMES, new org.apache.thrift.meta_data.FieldMetaData("skewedColNames", 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.SKEWED_COL_VALUES, new org.apache.thrift.meta_data.FieldMetaData("skewedColValues", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            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.SKEWED_COL_VALUE_LOCATION_MAPS, new org.apache.thrift.meta_data.FieldMetaData("skewedColValueLocationMaps", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
            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)),
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SkewedInfo.class, metaDataMap);
  }

  public SkewedInfo() {
  }

  public SkewedInfo(
    List<String> skewedColNames,
    List<List<String>> skewedColValues,
    Map<List<String>,String> skewedColValueLocationMaps)
  {
    this();
    this.skewedColNames = skewedColNames;
    this.skewedColValues = skewedColValues;
    this.skewedColValueLocationMaps = skewedColValueLocationMaps;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SkewedInfo(SkewedInfo other) {
    if (other.isSetSkewedColNames()) {
      List<String> __this__skewedColNames = new ArrayList<String>();
      for (String other_element : other.skewedColNames) {
        __this__skewedColNames.add(other_element);
      }
      this.skewedColNames = __this__skewedColNames;
    }
    if (other.isSetSkewedColValues()) {
      List<List<String>> __this__skewedColValues = new ArrayList<List<String>>();
      for (List<String> other_element : other.skewedColValues) {
        List<String> __this__skewedColValues_copy = new ArrayList<String>();
        for (String other_element_element : other_element) {
          __this__skewedColValues_copy.add(other_element_element);
        }
        __this__skewedColValues.add(__this__skewedColValues_copy);
      }
      this.skewedColValues = __this__skewedColValues;
    }
    if (other.isSetSkewedColValueLocationMaps()) {
      Map<List<String>,String> __this__skewedColValueLocationMaps = new HashMap<List<String>,String>();
      for (Map.Entry<List<String>, String> other_element : other.skewedColValueLocationMaps.entrySet()) {

        List<String> other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        List<String> __this__skewedColValueLocationMaps_copy_key = new ArrayList<String>();
        for (String other_element_key_element : other_element_key) {
          __this__skewedColValueLocationMaps_copy_key.add(other_element_key_element);
        }

        String __this__skewedColValueLocationMaps_copy_value = other_element_value;

        __this__skewedColValueLocationMaps.put(__this__skewedColValueLocationMaps_copy_key, __this__skewedColValueLocationMaps_copy_value);
      }
      this.skewedColValueLocationMaps = __this__skewedColValueLocationMaps;
    }
  }

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

  @Override
  public void clear() {
    this.skewedColNames = null;
    this.skewedColValues = null;
    this.skewedColValueLocationMaps = null;
  }

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

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

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

  public List<String> getSkewedColNames() {
    return this.skewedColNames;
  }

  public void setSkewedColNames(List<String> skewedColNames) {
    this.skewedColNames = skewedColNames;
  }

  public void unsetSkewedColNames() {
    this.skewedColNames = null;
  }

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

  public void setSkewedColNamesIsSet(boolean value) {
    if (!value) {
      this.skewedColNames = null;
    }
  }

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

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

  public void addToSkewedColValues(List<String> elem) {
    if (this.skewedColValues == null) {
      this.skewedColValues = new ArrayList<List<String>>();
    }
    this.skewedColValues.add(elem);
  }

  public List<List<String>> getSkewedColValues() {
    return this.skewedColValues;
  }

  public void setSkewedColValues(List<List<String>> skewedColValues) {
    this.skewedColValues = skewedColValues;
  }

  public void unsetSkewedColValues() {
    this.skewedColValues = null;
  }

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

  public void setSkewedColValuesIsSet(boolean value) {
    if (!value) {
      this.skewedColValues = null;
    }
  }

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

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

  public Map<List<String>,String> getSkewedColValueLocationMaps() {
    return this.skewedColValueLocationMaps;
  }

  public void setSkewedColValueLocationMaps(Map<List<String>,String> skewedColValueLocationMaps) {
    this.skewedColValueLocationMaps = skewedColValueLocationMaps;
  }

  public void unsetSkewedColValueLocationMaps() {
    this.skewedColValueLocationMaps = null;
  }

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

  public void setSkewedColValueLocationMapsIsSet(boolean value) {
    if (!value) {
      this.skewedColValueLocationMaps = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SKEWED_COL_NAMES:
      if (value == null) {
        unsetSkewedColNames();
      } else {
        setSkewedColNames((List<String>)value);
      }
      break;

    case SKEWED_COL_VALUES:
      if (value == null) {
        unsetSkewedColValues();
      } else {
        setSkewedColValues((List<List<String>>)value);
      }
      break;

    case SKEWED_COL_VALUE_LOCATION_MAPS:
      if (value == null) {
        unsetSkewedColValueLocationMaps();
      } else {
        setSkewedColValueLocationMaps((Map<List<String>,String>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SKEWED_COL_NAMES:
      return getSkewedColNames();

    case SKEWED_COL_VALUES:
      return getSkewedColValues();

    case SKEWED_COL_VALUE_LOCATION_MAPS:
      return getSkewedColValueLocationMaps();

    }
    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 SKEWED_COL_NAMES:
      return isSetSkewedColNames();
    case SKEWED_COL_VALUES:
      return isSetSkewedColValues();
    case SKEWED_COL_VALUE_LOCATION_MAPS:
      return isSetSkewedColValueLocationMaps();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_skewedColNames = true && this.isSetSkewedColNames();
    boolean that_present_skewedColNames = true && that.isSetSkewedColNames();
    if (this_present_skewedColNames || that_present_skewedColNames) {
      if (!(this_present_skewedColNames && that_present_skewedColNames))
        return false;
      if (!this.skewedColNames.equals(that.skewedColNames))
        return false;
    }

    boolean this_present_skewedColValues = true && this.isSetSkewedColValues();
    boolean that_present_skewedColValues = true && that.isSetSkewedColValues();
    if (this_present_skewedColValues || that_present_skewedColValues) {
      if (!(this_present_skewedColValues && that_present_skewedColValues))
        return false;
      if (!this.skewedColValues.equals(that.skewedColValues))
        return false;
    }

    boolean this_present_skewedColValueLocationMaps = true && this.isSetSkewedColValueLocationMaps();
    boolean that_present_skewedColValueLocationMaps = true && that.isSetSkewedColValueLocationMaps();
    if (this_present_skewedColValueLocationMaps || that_present_skewedColValueLocationMaps) {
      if (!(this_present_skewedColValueLocationMaps && that_present_skewedColValueLocationMaps))
        return false;
      if (!this.skewedColValueLocationMaps.equals(that.skewedColValueLocationMaps))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    boolean present_skewedColNames = true && (isSetSkewedColNames());
    builder.append(present_skewedColNames);
    if (present_skewedColNames)
      builder.append(skewedColNames);

    boolean present_skewedColValues = true && (isSetSkewedColValues());
    builder.append(present_skewedColValues);
    if (present_skewedColValues)
      builder.append(skewedColValues);

    boolean present_skewedColValueLocationMaps = true && (isSetSkewedColValueLocationMaps());
    builder.append(present_skewedColValueLocationMaps);
    if (present_skewedColValueLocationMaps)
      builder.append(skewedColValueLocationMaps);

    return builder.toHashCode();
  }

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

    int lastComparison = 0;
    SkewedInfo typedOther = (SkewedInfo)other;

    lastComparison = Boolean.valueOf(isSetSkewedColNames()).compareTo(typedOther.isSetSkewedColNames());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSkewedColNames()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.skewedColNames, typedOther.skewedColNames);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSkewedColValues()).compareTo(typedOther.isSetSkewedColValues());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSkewedColValues()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.skewedColValues, typedOther.skewedColValues);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSkewedColValueLocationMaps()).compareTo(typedOther.isSetSkewedColValueLocationMaps());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSkewedColValueLocationMaps()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.skewedColValueLocationMaps, typedOther.skewedColValueLocationMaps);
      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("SkewedInfo(");
    boolean first = true;

    sb.append("skewedColNames:");
    if (this.skewedColNames == null) {
      sb.append("null");
    } else {
      sb.append(this.skewedColNames);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("skewedColValues:");
    if (this.skewedColValues == null) {
      sb.append("null");
    } else {
      sb.append(this.skewedColValues);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("skewedColValueLocationMaps:");
    if (this.skewedColValueLocationMaps == null) {
      sb.append("null");
    } else {
      sb.append(this.skewedColValueLocationMaps);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      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 SkewedInfoStandardSchemeFactory implements SchemeFactory {
    public SkewedInfoStandardScheme getScheme() {
      return new SkewedInfoStandardScheme();
    }
  }

  private static class SkewedInfoStandardScheme extends StandardScheme<SkewedInfo> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SkewedInfo 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: // SKEWED_COL_NAMES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list98 = iprot.readListBegin();
                struct.skewedColNames = new ArrayList<String>(_list98.size);
                for (int _i99 = 0; _i99 < _list98.size; ++_i99)
                {
                  String _elem100; // required
                  _elem100 = iprot.readString();
                  struct.skewedColNames.add(_elem100);
                }
                iprot.readListEnd();
              }
              struct.setSkewedColNamesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SKEWED_COL_VALUES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list101 = iprot.readListBegin();
                struct.skewedColValues = new ArrayList<List<String>>(_list101.size);
                for (int _i102 = 0; _i102 < _list101.size; ++_i102)
                {
                  List<String> _elem103; // required
                  {
                    org.apache.thrift.protocol.TList _list104 = iprot.readListBegin();
                    _elem103 = new ArrayList<String>(_list104.size);
                    for (int _i105 = 0; _i105 < _list104.size; ++_i105)
                    {
                      String _elem106; // required
                      _elem106 = iprot.readString();
                      _elem103.add(_elem106);
                    }
                    iprot.readListEnd();
                  }
                  struct.skewedColValues.add(_elem103);
                }
                iprot.readListEnd();
              }
              struct.setSkewedColValuesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SKEWED_COL_VALUE_LOCATION_MAPS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map107 = iprot.readMapBegin();
                struct.skewedColValueLocationMaps = new HashMap<List<String>,String>(2*_map107.size);
                for (int _i108 = 0; _i108 < _map107.size; ++_i108)
                {
                  List<String> _key109; // required
                  String _val110; // required
                  {
                    org.apache.thrift.protocol.TList _list111 = iprot.readListBegin();
                    _key109 = new ArrayList<String>(_list111.size);
                    for (int _i112 = 0; _i112 < _list111.size; ++_i112)
                    {
                      String _elem113; // required
                      _elem113 = iprot.readString();
                      _key109.add(_elem113);
                    }
                    iprot.readListEnd();
                  }
                  _val110 = iprot.readString();
                  struct.skewedColValueLocationMaps.put(_key109, _val110);
                }
                iprot.readMapEnd();
              }
              struct.setSkewedColValueLocationMapsIsSet(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, SkewedInfo struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.skewedColNames != null) {
        oprot.writeFieldBegin(SKEWED_COL_NAMES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.skewedColNames.size()));
          for (String _iter114 : struct.skewedColNames)
          {
            oprot.writeString(_iter114);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.skewedColValues != null) {
        oprot.writeFieldBegin(SKEWED_COL_VALUES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.skewedColValues.size()));
          for (List<String> _iter115 : struct.skewedColValues)
          {
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter115.size()));
              for (String _iter116 : _iter115)
              {
                oprot.writeString(_iter116);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.skewedColValueLocationMaps != null) {
        oprot.writeFieldBegin(SKEWED_COL_VALUE_LOCATION_MAPS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.LIST, org.apache.thrift.protocol.TType.STRING, struct.skewedColValueLocationMaps.size()));
          for (Map.Entry<List<String>, String> _iter117 : struct.skewedColValueLocationMaps.entrySet())
          {
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter117.getKey().size()));
              for (String _iter118 : _iter117.getKey())
              {
                oprot.writeString(_iter118);
              }
              oprot.writeListEnd();
            }
            oprot.writeString(_iter117.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SkewedInfoTupleSchemeFactory implements SchemeFactory {
    public SkewedInfoTupleScheme getScheme() {
      return new SkewedInfoTupleScheme();
    }
  }

  private static class SkewedInfoTupleScheme extends TupleScheme<SkewedInfo> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SkewedInfo struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetSkewedColNames()) {
        optionals.set(0);
      }
      if (struct.isSetSkewedColValues()) {
        optionals.set(1);
      }
      if (struct.isSetSkewedColValueLocationMaps()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetSkewedColNames()) {
        {
          oprot.writeI32(struct.skewedColNames.size());
          for (String _iter119 : struct.skewedColNames)
          {
            oprot.writeString(_iter119);
          }
        }
      }
      if (struct.isSetSkewedColValues()) {
        {
          oprot.writeI32(struct.skewedColValues.size());
          for (List<String> _iter120 : struct.skewedColValues)
          {
            {
              oprot.writeI32(_iter120.size());
              for (String _iter121 : _iter120)
              {
                oprot.writeString(_iter121);
              }
            }
          }
        }
      }
      if (struct.isSetSkewedColValueLocationMaps()) {
        {
          oprot.writeI32(struct.skewedColValueLocationMaps.size());
          for (Map.Entry<List<String>, String> _iter122 : struct.skewedColValueLocationMaps.entrySet())
          {
            {
              oprot.writeI32(_iter122.getKey().size());
              for (String _iter123 : _iter122.getKey())
              {
                oprot.writeString(_iter123);
              }
            }
            oprot.writeString(_iter122.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SkewedInfo struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list124 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.skewedColNames = new ArrayList<String>(_list124.size);
          for (int _i125 = 0; _i125 < _list124.size; ++_i125)
          {
            String _elem126; // required
            _elem126 = iprot.readString();
            struct.skewedColNames.add(_elem126);
          }
        }
        struct.setSkewedColNamesIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list127 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, iprot.readI32());
          struct.skewedColValues = new ArrayList<List<String>>(_list127.size);
          for (int _i128 = 0; _i128 < _list127.size; ++_i128)
          {
            List<String> _elem129; // required
            {
              org.apache.thrift.protocol.TList _list130 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
              _elem129 = new ArrayList<String>(_list130.size);
              for (int _i131 = 0; _i131 < _list130.size; ++_i131)
              {
                String _elem132; // required
                _elem132 = iprot.readString();
                _elem129.add(_elem132);
              }
            }
            struct.skewedColValues.add(_elem129);
          }
        }
        struct.setSkewedColValuesIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TMap _map133 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.LIST, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.skewedColValueLocationMaps = new HashMap<List<String>,String>(2*_map133.size);
          for (int _i134 = 0; _i134 < _map133.size; ++_i134)
          {
            List<String> _key135; // required
            String _val136; // required
            {
              org.apache.thrift.protocol.TList _list137 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
              _key135 = new ArrayList<String>(_list137.size);
              for (int _i138 = 0; _i138 < _list137.size; ++_i138)
              {
                String _elem139; // required
                _elem139 = iprot.readString();
                _key135.add(_elem139);
              }
            }
            _val136 = iprot.readString();
            struct.skewedColValueLocationMaps.put(_key135, _val136);
          }
        }
        struct.setSkewedColValueLocationMapsIsSet(true);
      }
    }
  }

}
TOP

Related Classes of org.apache.hadoop.hive.metastore.api.SkewedInfo$SkewedInfoStandardScheme

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.