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

Source Code of org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc$ColumnStatisticsDescTupleScheme

/**
* 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 com.facebook.presto.hive.shaded.org.apache.commons.lang.builder.HashCodeBuilder;
import com.facebook.presto.hive.shaded.org.apache.thrift.scheme.IScheme;
import com.facebook.presto.hive.shaded.org.apache.thrift.scheme.SchemeFactory;
import com.facebook.presto.hive.shaded.org.apache.thrift.scheme.StandardScheme;

import com.facebook.presto.hive.shaded.org.apache.thrift.scheme.TupleScheme;
import com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TTupleProtocol;
import com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolException;
import com.facebook.presto.hive.shaded.org.apache.thrift.EncodingUtils;
import com.facebook.presto.hive.shaded.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 com.facebook.presto.hive.shaded.org.slf4j.Logger;
import com.facebook.presto.hive.shaded.org.slf4j.LoggerFactory;

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

  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField IS_TBL_LEVEL_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("isTblLevel", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL, (short)1);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("dbName", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("tableName", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField PART_NAME_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("partName", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField LAST_ANALYZED_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("lastAnalyzed", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64, (short)5);

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

  private boolean isTblLevel; // required
  private String dbName; // required
  private String tableName; // required
  private String partName; // optional
  private long lastAnalyzed; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements com.facebook.presto.hive.shaded.org.apache.thrift.TFieldIdEnum {
    IS_TBL_LEVEL((short)1, "isTblLevel"),
    DB_NAME((short)2, "dbName"),
    TABLE_NAME((short)3, "tableName"),
    PART_NAME((short)4, "partName"),
    LAST_ANALYZED((short)5, "lastAnalyzed");

    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: // IS_TBL_LEVEL
          return IS_TBL_LEVEL;
        case 2: // DB_NAME
          return DB_NAME;
        case 3: // TABLE_NAME
          return TABLE_NAME;
        case 4: // PART_NAME
          return PART_NAME;
        case 5: // LAST_ANALYZED
          return LAST_ANALYZED;
        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 __ISTBLLEVEL_ISSET_ID = 0;
  private static final int __LASTANALYZED_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private _Fields optionals[] = {_Fields.PART_NAME,_Fields.LAST_ANALYZED};
  public static final Map<_Fields, com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.IS_TBL_LEVEL, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("isTblLevel", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.REQUIRED,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.DB_NAME, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("dbName", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.REQUIRED,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TABLE_NAME, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("tableName", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.REQUIRED,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PART_NAME, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("partName", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.LAST_ANALYZED, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("lastAnalyzed", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnStatisticsDesc.class, metaDataMap);
  }

  public ColumnStatisticsDesc() {
  }

  public ColumnStatisticsDesc(
    boolean isTblLevel,
    String dbName,
    String tableName)
  {
    this();
    this.isTblLevel = isTblLevel;
    setIsTblLevelIsSet(true);
    this.dbName = dbName;
    this.tableName = tableName;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ColumnStatisticsDesc(ColumnStatisticsDesc other) {
    __isset_bitfield = other.__isset_bitfield;
    this.isTblLevel = other.isTblLevel;
    if (other.isSetDbName()) {
      this.dbName = other.dbName;
    }
    if (other.isSetTableName()) {
      this.tableName = other.tableName;
    }
    if (other.isSetPartName()) {
      this.partName = other.partName;
    }
    this.lastAnalyzed = other.lastAnalyzed;
  }

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

  @Override
  public void clear() {
    setIsTblLevelIsSet(false);
    this.isTblLevel = false;
    this.dbName = null;
    this.tableName = null;
    this.partName = null;
    setLastAnalyzedIsSet(false);
    this.lastAnalyzed = 0;
  }

  public boolean isIsTblLevel() {
    return this.isTblLevel;
  }

  public void setIsTblLevel(boolean isTblLevel) {
    this.isTblLevel = isTblLevel;
    setIsTblLevelIsSet(true);
  }

  public void unsetIsTblLevel() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISTBLLEVEL_ISSET_ID);
  }

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

  public void setIsTblLevelIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTBLLEVEL_ISSET_ID, value);
  }

  public String getDbName() {
    return this.dbName;
  }

  public void setDbName(String dbName) {
    this.dbName = dbName;
  }

  public void unsetDbName() {
    this.dbName = null;
  }

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

  public void setDbNameIsSet(boolean value) {
    if (!value) {
      this.dbName = null;
    }
  }

  public String getTableName() {
    return this.tableName;
  }

  public void setTableName(String tableName) {
    this.tableName = tableName;
  }

  public void unsetTableName() {
    this.tableName = null;
  }

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

  public void setTableNameIsSet(boolean value) {
    if (!value) {
      this.tableName = null;
    }
  }

  public String getPartName() {
    return this.partName;
  }

  public void setPartName(String partName) {
    this.partName = partName;
  }

  public void unsetPartName() {
    this.partName = null;
  }

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

  public void setPartNameIsSet(boolean value) {
    if (!value) {
      this.partName = null;
    }
  }

  public long getLastAnalyzed() {
    return this.lastAnalyzed;
  }

  public void setLastAnalyzed(long lastAnalyzed) {
    this.lastAnalyzed = lastAnalyzed;
    setLastAnalyzedIsSet(true);
  }

  public void unsetLastAnalyzed() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LASTANALYZED_ISSET_ID);
  }

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

  public void setLastAnalyzedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LASTANALYZED_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case IS_TBL_LEVEL:
      if (value == null) {
        unsetIsTblLevel();
      } else {
        setIsTblLevel((Boolean)value);
      }
      break;

    case DB_NAME:
      if (value == null) {
        unsetDbName();
      } else {
        setDbName((String)value);
      }
      break;

    case TABLE_NAME:
      if (value == null) {
        unsetTableName();
      } else {
        setTableName((String)value);
      }
      break;

    case PART_NAME:
      if (value == null) {
        unsetPartName();
      } else {
        setPartName((String)value);
      }
      break;

    case LAST_ANALYZED:
      if (value == null) {
        unsetLastAnalyzed();
      } else {
        setLastAnalyzed((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case IS_TBL_LEVEL:
      return Boolean.valueOf(isIsTblLevel());

    case DB_NAME:
      return getDbName();

    case TABLE_NAME:
      return getTableName();

    case PART_NAME:
      return getPartName();

    case LAST_ANALYZED:
      return Long.valueOf(getLastAnalyzed());

    }
    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 IS_TBL_LEVEL:
      return isSetIsTblLevel();
    case DB_NAME:
      return isSetDbName();
    case TABLE_NAME:
      return isSetTableName();
    case PART_NAME:
      return isSetPartName();
    case LAST_ANALYZED:
      return isSetLastAnalyzed();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_isTblLevel = true;
    boolean that_present_isTblLevel = true;
    if (this_present_isTblLevel || that_present_isTblLevel) {
      if (!(this_present_isTblLevel && that_present_isTblLevel))
        return false;
      if (this.isTblLevel != that.isTblLevel)
        return false;
    }

    boolean this_present_dbName = true && this.isSetDbName();
    boolean that_present_dbName = true && that.isSetDbName();
    if (this_present_dbName || that_present_dbName) {
      if (!(this_present_dbName && that_present_dbName))
        return false;
      if (!this.dbName.equals(that.dbName))
        return false;
    }

    boolean this_present_tableName = true && this.isSetTableName();
    boolean that_present_tableName = true && that.isSetTableName();
    if (this_present_tableName || that_present_tableName) {
      if (!(this_present_tableName && that_present_tableName))
        return false;
      if (!this.tableName.equals(that.tableName))
        return false;
    }

    boolean this_present_partName = true && this.isSetPartName();
    boolean that_present_partName = true && that.isSetPartName();
    if (this_present_partName || that_present_partName) {
      if (!(this_present_partName && that_present_partName))
        return false;
      if (!this.partName.equals(that.partName))
        return false;
    }

    boolean this_present_lastAnalyzed = true && this.isSetLastAnalyzed();
    boolean that_present_lastAnalyzed = true && that.isSetLastAnalyzed();
    if (this_present_lastAnalyzed || that_present_lastAnalyzed) {
      if (!(this_present_lastAnalyzed && that_present_lastAnalyzed))
        return false;
      if (this.lastAnalyzed != that.lastAnalyzed)
        return false;
    }

    return true;
  }

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

    boolean present_isTblLevel = true;
    builder.append(present_isTblLevel);
    if (present_isTblLevel)
      builder.append(isTblLevel);

    boolean present_dbName = true && (isSetDbName());
    builder.append(present_dbName);
    if (present_dbName)
      builder.append(dbName);

    boolean present_tableName = true && (isSetTableName());
    builder.append(present_tableName);
    if (present_tableName)
      builder.append(tableName);

    boolean present_partName = true && (isSetPartName());
    builder.append(present_partName);
    if (present_partName)
      builder.append(partName);

    boolean present_lastAnalyzed = true && (isSetLastAnalyzed());
    builder.append(present_lastAnalyzed);
    if (present_lastAnalyzed)
      builder.append(lastAnalyzed);

    return builder.toHashCode();
  }

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

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

    lastComparison = Boolean.valueOf(isSetIsTblLevel()).compareTo(typedOther.isSetIsTblLevel());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsTblLevel()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.isTblLevel, typedOther.isTblLevel);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbName()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.dbName, typedOther.dbName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTableName()).compareTo(typedOther.isSetTableName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTableName()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.tableName, typedOther.tableName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPartName()).compareTo(typedOther.isSetPartName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartName()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.partName, typedOther.partName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastAnalyzed()).compareTo(typedOther.isSetLastAnalyzed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastAnalyzed()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.lastAnalyzed, typedOther.lastAnalyzed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

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

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

    sb.append("isTblLevel:");
    sb.append(this.isTblLevel);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dbName:");
    if (this.dbName == null) {
      sb.append("null");
    } else {
      sb.append(this.dbName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("tableName:");
    if (this.tableName == null) {
      sb.append("null");
    } else {
      sb.append(this.tableName);
    }
    first = false;
    if (isSetPartName()) {
      if (!first) sb.append(", ");
      sb.append("partName:");
      if (this.partName == null) {
        sb.append("null");
      } else {
        sb.append(this.partName);
      }
      first = false;
    }
    if (isSetLastAnalyzed()) {
      if (!first) sb.append(", ");
      sb.append("lastAnalyzed:");
      sb.append(this.lastAnalyzed);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
    // check for required fields
    if (!isSetIsTblLevel()) {
      throw new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolException("Required field 'isTblLevel' is unset! Struct:" + toString());
    }

    if (!isSetDbName()) {
      throw new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolException("Required field 'dbName' is unset! Struct:" + toString());
    }

    if (!isSetTableName()) {
      throw new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolException("Required field 'tableName' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TCompactProtocol(new com.facebook.presto.hive.shaded.org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (com.facebook.presto.hive.shaded.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 com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TCompactProtocol(new com.facebook.presto.hive.shaded.org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (com.facebook.presto.hive.shaded.org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ColumnStatisticsDescStandardSchemeFactory implements SchemeFactory {
    public ColumnStatisticsDescStandardScheme getScheme() {
      return new ColumnStatisticsDescStandardScheme();
    }
  }

  private static class ColumnStatisticsDescStandardScheme extends StandardScheme<ColumnStatisticsDesc> {

    public void read(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol iprot, ColumnStatisticsDesc struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // IS_TBL_LEVEL
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL) {
              struct.isTblLevel = iprot.readBool();
              struct.setIsTblLevelIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DB_NAME
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.dbName = iprot.readString();
              struct.setDbNameIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLE_NAME
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.tableName = iprot.readString();
              struct.setTableNameIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PART_NAME
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.partName = iprot.readString();
              struct.setPartNameIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // LAST_ANALYZED
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64) {
              struct.lastAnalyzed = iprot.readI64();
              struct.setLastAnalyzedIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol oprot, ColumnStatisticsDesc struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(IS_TBL_LEVEL_FIELD_DESC);
      oprot.writeBool(struct.isTblLevel);
      oprot.writeFieldEnd();
      if (struct.dbName != null) {
        oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
        oprot.writeString(struct.dbName);
        oprot.writeFieldEnd();
      }
      if (struct.tableName != null) {
        oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
        oprot.writeString(struct.tableName);
        oprot.writeFieldEnd();
      }
      if (struct.partName != null) {
        if (struct.isSetPartName()) {
          oprot.writeFieldBegin(PART_NAME_FIELD_DESC);
          oprot.writeString(struct.partName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetLastAnalyzed()) {
        oprot.writeFieldBegin(LAST_ANALYZED_FIELD_DESC);
        oprot.writeI64(struct.lastAnalyzed);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ColumnStatisticsDescTupleSchemeFactory implements SchemeFactory {
    public ColumnStatisticsDescTupleScheme getScheme() {
      return new ColumnStatisticsDescTupleScheme();
    }
  }

  private static class ColumnStatisticsDescTupleScheme extends TupleScheme<ColumnStatisticsDesc> {

    @Override
    public void write(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol prot, ColumnStatisticsDesc struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeBool(struct.isTblLevel);
      oprot.writeString(struct.dbName);
      oprot.writeString(struct.tableName);
      BitSet optionals = new BitSet();
      if (struct.isSetPartName()) {
        optionals.set(0);
      }
      if (struct.isSetLastAnalyzed()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetPartName()) {
        oprot.writeString(struct.partName);
      }
      if (struct.isSetLastAnalyzed()) {
        oprot.writeI64(struct.lastAnalyzed);
      }
    }

    @Override
    public void read(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol prot, ColumnStatisticsDesc struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.isTblLevel = iprot.readBool();
      struct.setIsTblLevelIsSet(true);
      struct.dbName = iprot.readString();
      struct.setDbNameIsSet(true);
      struct.tableName = iprot.readString();
      struct.setTableNameIsSet(true);
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.partName = iprot.readString();
        struct.setPartNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.lastAnalyzed = iprot.readI64();
        struct.setLastAnalyzedIsSet(true);
      }
    }
  }

}
TOP

Related Classes of org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc$ColumnStatisticsDescTupleScheme

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.