Package org.apache.hadoop.hive.ql.plan.api

Source Code of org.apache.hadoop.hive.ql.plan.api.Stage

/**
* 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.ql.plan.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 Stage implements com.facebook.presto.hive.shaded.org.apache.thrift.TBase<Stage, Stage._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("Stage");

  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STAGE_ID_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageId", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STAGE_TYPE_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageType", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I32, (short)2);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STAGE_ATTRIBUTES_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageAttributes", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP, (short)3);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STAGE_COUNTERS_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageCounters", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP, (short)4);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField TASK_LIST_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("taskList", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.LIST, (short)5);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField DONE_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("done", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL, (short)6);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STARTED_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("started", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL, (short)7);

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

  private String stageId; // required
  private StageType stageType; // required
  private Map<String,String> stageAttributes; // required
  private Map<String,Long> stageCounters; // required
  private List<Task> taskList; // required
  private boolean done; // required
  private boolean started; // required

  /** 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 {
    STAGE_ID((short)1, "stageId"),
    /**
     *
     * @see StageType
     */
    STAGE_TYPE((short)2, "stageType"),
    STAGE_ATTRIBUTES((short)3, "stageAttributes"),
    STAGE_COUNTERS((short)4, "stageCounters"),
    TASK_LIST((short)5, "taskList"),
    DONE((short)6, "done"),
    STARTED((short)7, "started");

    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: // STAGE_ID
          return STAGE_ID;
        case 2: // STAGE_TYPE
          return STAGE_TYPE;
        case 3: // STAGE_ATTRIBUTES
          return STAGE_ATTRIBUTES;
        case 4: // STAGE_COUNTERS
          return STAGE_COUNTERS;
        case 5: // TASK_LIST
          return TASK_LIST;
        case 6: // DONE
          return DONE;
        case 7: // STARTED
          return STARTED;
        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 __DONE_ISSET_ID = 0;
  private static final int __STARTED_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  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.STAGE_ID, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageId", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        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.STAGE_TYPE, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageType", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.EnumMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.ENUM, StageType.class)));
    tmpMap.put(_Fields.STAGE_ATTRIBUTES, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageAttributes", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.MapMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP,
            new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING),
            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.STAGE_COUNTERS, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageCounters", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.MapMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP,
            new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING),
            new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.TASK_LIST, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("taskList", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.ListMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.LIST,
            new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.StructMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT, Task.class))));
    tmpMap.put(_Fields.DONE, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("done", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        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.STARTED, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("started", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldValueMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Stage.class, metaDataMap);
  }

  public Stage() {
  }

  public Stage(
    String stageId,
    StageType stageType,
    Map<String,String> stageAttributes,
    Map<String,Long> stageCounters,
    List<Task> taskList,
    boolean done,
    boolean started)
  {
    this();
    this.stageId = stageId;
    this.stageType = stageType;
    this.stageAttributes = stageAttributes;
    this.stageCounters = stageCounters;
    this.taskList = taskList;
    this.done = done;
    setDoneIsSet(true);
    this.started = started;
    setStartedIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Stage(Stage other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetStageId()) {
      this.stageId = other.stageId;
    }
    if (other.isSetStageType()) {
      this.stageType = other.stageType;
    }
    if (other.isSetStageAttributes()) {
      Map<String,String> __this__stageAttributes = new HashMap<String,String>();
      for (Map.Entry<String, String> other_element : other.stageAttributes.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__stageAttributes_copy_key = other_element_key;

        String __this__stageAttributes_copy_value = other_element_value;

        __this__stageAttributes.put(__this__stageAttributes_copy_key, __this__stageAttributes_copy_value);
      }
      this.stageAttributes = __this__stageAttributes;
    }
    if (other.isSetStageCounters()) {
      Map<String,Long> __this__stageCounters = new HashMap<String,Long>();
      for (Map.Entry<String, Long> other_element : other.stageCounters.entrySet()) {

        String other_element_key = other_element.getKey();
        Long other_element_value = other_element.getValue();

        String __this__stageCounters_copy_key = other_element_key;

        Long __this__stageCounters_copy_value = other_element_value;

        __this__stageCounters.put(__this__stageCounters_copy_key, __this__stageCounters_copy_value);
      }
      this.stageCounters = __this__stageCounters;
    }
    if (other.isSetTaskList()) {
      List<Task> __this__taskList = new ArrayList<Task>();
      for (Task other_element : other.taskList) {
        __this__taskList.add(new Task(other_element));
      }
      this.taskList = __this__taskList;
    }
    this.done = other.done;
    this.started = other.started;
  }

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

  @Override
  public void clear() {
    this.stageId = null;
    this.stageType = null;
    this.stageAttributes = null;
    this.stageCounters = null;
    this.taskList = null;
    setDoneIsSet(false);
    this.done = false;
    setStartedIsSet(false);
    this.started = false;
  }

  public String getStageId() {
    return this.stageId;
  }

  public void setStageId(String stageId) {
    this.stageId = stageId;
  }

  public void unsetStageId() {
    this.stageId = null;
  }

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

  public void setStageIdIsSet(boolean value) {
    if (!value) {
      this.stageId = null;
    }
  }

  /**
   *
   * @see StageType
   */
  public StageType getStageType() {
    return this.stageType;
  }

  /**
   *
   * @see StageType
   */
  public void setStageType(StageType stageType) {
    this.stageType = stageType;
  }

  public void unsetStageType() {
    this.stageType = null;
  }

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

  public void setStageTypeIsSet(boolean value) {
    if (!value) {
      this.stageType = null;
    }
  }

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

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

  public Map<String,String> getStageAttributes() {
    return this.stageAttributes;
  }

  public void setStageAttributes(Map<String,String> stageAttributes) {
    this.stageAttributes = stageAttributes;
  }

  public void unsetStageAttributes() {
    this.stageAttributes = null;
  }

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

  public void setStageAttributesIsSet(boolean value) {
    if (!value) {
      this.stageAttributes = null;
    }
  }

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

  public void putToStageCounters(String key, long val) {
    if (this.stageCounters == null) {
      this.stageCounters = new HashMap<String,Long>();
    }
    this.stageCounters.put(key, val);
  }

  public Map<String,Long> getStageCounters() {
    return this.stageCounters;
  }

  public void setStageCounters(Map<String,Long> stageCounters) {
    this.stageCounters = stageCounters;
  }

  public void unsetStageCounters() {
    this.stageCounters = null;
  }

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

  public void setStageCountersIsSet(boolean value) {
    if (!value) {
      this.stageCounters = null;
    }
  }

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

  public java.util.Iterator<Task> getTaskListIterator() {
    return (this.taskList == null) ? null : this.taskList.iterator();
  }

  public void addToTaskList(Task elem) {
    if (this.taskList == null) {
      this.taskList = new ArrayList<Task>();
    }
    this.taskList.add(elem);
  }

  public List<Task> getTaskList() {
    return this.taskList;
  }

  public void setTaskList(List<Task> taskList) {
    this.taskList = taskList;
  }

  public void unsetTaskList() {
    this.taskList = null;
  }

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

  public void setTaskListIsSet(boolean value) {
    if (!value) {
      this.taskList = null;
    }
  }

  public boolean isDone() {
    return this.done;
  }

  public void setDone(boolean done) {
    this.done = done;
    setDoneIsSet(true);
  }

  public void unsetDone() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DONE_ISSET_ID);
  }

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

  public void setDoneIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DONE_ISSET_ID, value);
  }

  public boolean isStarted() {
    return this.started;
  }

  public void setStarted(boolean started) {
    this.started = started;
    setStartedIsSet(true);
  }

  public void unsetStarted() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STARTED_ISSET_ID);
  }

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

  public void setStartedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STARTED_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case STAGE_ID:
      if (value == null) {
        unsetStageId();
      } else {
        setStageId((String)value);
      }
      break;

    case STAGE_TYPE:
      if (value == null) {
        unsetStageType();
      } else {
        setStageType((StageType)value);
      }
      break;

    case STAGE_ATTRIBUTES:
      if (value == null) {
        unsetStageAttributes();
      } else {
        setStageAttributes((Map<String,String>)value);
      }
      break;

    case STAGE_COUNTERS:
      if (value == null) {
        unsetStageCounters();
      } else {
        setStageCounters((Map<String,Long>)value);
      }
      break;

    case TASK_LIST:
      if (value == null) {
        unsetTaskList();
      } else {
        setTaskList((List<Task>)value);
      }
      break;

    case DONE:
      if (value == null) {
        unsetDone();
      } else {
        setDone((Boolean)value);
      }
      break;

    case STARTED:
      if (value == null) {
        unsetStarted();
      } else {
        setStarted((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case STAGE_ID:
      return getStageId();

    case STAGE_TYPE:
      return getStageType();

    case STAGE_ATTRIBUTES:
      return getStageAttributes();

    case STAGE_COUNTERS:
      return getStageCounters();

    case TASK_LIST:
      return getTaskList();

    case DONE:
      return Boolean.valueOf(isDone());

    case STARTED:
      return Boolean.valueOf(isStarted());

    }
    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 STAGE_ID:
      return isSetStageId();
    case STAGE_TYPE:
      return isSetStageType();
    case STAGE_ATTRIBUTES:
      return isSetStageAttributes();
    case STAGE_COUNTERS:
      return isSetStageCounters();
    case TASK_LIST:
      return isSetTaskList();
    case DONE:
      return isSetDone();
    case STARTED:
      return isSetStarted();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_stageId = true && this.isSetStageId();
    boolean that_present_stageId = true && that.isSetStageId();
    if (this_present_stageId || that_present_stageId) {
      if (!(this_present_stageId && that_present_stageId))
        return false;
      if (!this.stageId.equals(that.stageId))
        return false;
    }

    boolean this_present_stageType = true && this.isSetStageType();
    boolean that_present_stageType = true && that.isSetStageType();
    if (this_present_stageType || that_present_stageType) {
      if (!(this_present_stageType && that_present_stageType))
        return false;
      if (!this.stageType.equals(that.stageType))
        return false;
    }

    boolean this_present_stageAttributes = true && this.isSetStageAttributes();
    boolean that_present_stageAttributes = true && that.isSetStageAttributes();
    if (this_present_stageAttributes || that_present_stageAttributes) {
      if (!(this_present_stageAttributes && that_present_stageAttributes))
        return false;
      if (!this.stageAttributes.equals(that.stageAttributes))
        return false;
    }

    boolean this_present_stageCounters = true && this.isSetStageCounters();
    boolean that_present_stageCounters = true && that.isSetStageCounters();
    if (this_present_stageCounters || that_present_stageCounters) {
      if (!(this_present_stageCounters && that_present_stageCounters))
        return false;
      if (!this.stageCounters.equals(that.stageCounters))
        return false;
    }

    boolean this_present_taskList = true && this.isSetTaskList();
    boolean that_present_taskList = true && that.isSetTaskList();
    if (this_present_taskList || that_present_taskList) {
      if (!(this_present_taskList && that_present_taskList))
        return false;
      if (!this.taskList.equals(that.taskList))
        return false;
    }

    boolean this_present_done = true;
    boolean that_present_done = true;
    if (this_present_done || that_present_done) {
      if (!(this_present_done && that_present_done))
        return false;
      if (this.done != that.done)
        return false;
    }

    boolean this_present_started = true;
    boolean that_present_started = true;
    if (this_present_started || that_present_started) {
      if (!(this_present_started && that_present_started))
        return false;
      if (this.started != that.started)
        return false;
    }

    return true;
  }

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

    boolean present_stageId = true && (isSetStageId());
    builder.append(present_stageId);
    if (present_stageId)
      builder.append(stageId);

    boolean present_stageType = true && (isSetStageType());
    builder.append(present_stageType);
    if (present_stageType)
      builder.append(stageType.getValue());

    boolean present_stageAttributes = true && (isSetStageAttributes());
    builder.append(present_stageAttributes);
    if (present_stageAttributes)
      builder.append(stageAttributes);

    boolean present_stageCounters = true && (isSetStageCounters());
    builder.append(present_stageCounters);
    if (present_stageCounters)
      builder.append(stageCounters);

    boolean present_taskList = true && (isSetTaskList());
    builder.append(present_taskList);
    if (present_taskList)
      builder.append(taskList);

    boolean present_done = true;
    builder.append(present_done);
    if (present_done)
      builder.append(done);

    boolean present_started = true;
    builder.append(present_started);
    if (present_started)
      builder.append(started);

    return builder.toHashCode();
  }

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

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

    lastComparison = Boolean.valueOf(isSetStageId()).compareTo(typedOther.isSetStageId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageId()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageId, typedOther.stageId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStageType()).compareTo(typedOther.isSetStageType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageType()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageType, typedOther.stageType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStageAttributes()).compareTo(typedOther.isSetStageAttributes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageAttributes()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageAttributes, typedOther.stageAttributes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStageCounters()).compareTo(typedOther.isSetStageCounters());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageCounters()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageCounters, typedOther.stageCounters);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskList()).compareTo(typedOther.isSetTaskList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskList()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.taskList, typedOther.taskList);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDone()).compareTo(typedOther.isSetDone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDone()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.done, typedOther.done);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStarted()).compareTo(typedOther.isSetStarted());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStarted()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.started, typedOther.started);
      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("Stage(");
    boolean first = true;

    sb.append("stageId:");
    if (this.stageId == null) {
      sb.append("null");
    } else {
      sb.append(this.stageId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stageType:");
    if (this.stageType == null) {
      sb.append("null");
    } else {
      sb.append(this.stageType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stageAttributes:");
    if (this.stageAttributes == null) {
      sb.append("null");
    } else {
      sb.append(this.stageAttributes);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stageCounters:");
    if (this.stageCounters == null) {
      sb.append("null");
    } else {
      sb.append(this.stageCounters);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("taskList:");
    if (this.taskList == null) {
      sb.append("null");
    } else {
      sb.append(this.taskList);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("done:");
    sb.append(this.done);
    first = false;
    if (!first) sb.append(", ");
    sb.append("started:");
    sb.append(this.started);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws com.facebook.presto.hive.shaded.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 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 StageStandardSchemeFactory implements SchemeFactory {
    public StageStandardScheme getScheme() {
      return new StageStandardScheme();
    }
  }

  private static class StageStandardScheme extends StandardScheme<Stage> {

    public void read(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol iprot, Stage 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: // STAGE_ID
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.stageId = iprot.readString();
              struct.setStageIdIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STAGE_TYPE
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I32) {
              struct.stageType = StageType.findByValue(iprot.readI32());
              struct.setStageTypeIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // STAGE_ATTRIBUTES
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP) {
              {
                com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map72 = iprot.readMapBegin();
                struct.stageAttributes = new HashMap<String,String>(2*_map72.size);
                for (int _i73 = 0; _i73 < _map72.size; ++_i73)
                {
                  String _key74; // required
                  String _val75; // required
                  _key74 = iprot.readString();
                  _val75 = iprot.readString();
                  struct.stageAttributes.put(_key74, _val75);
                }
                iprot.readMapEnd();
              }
              struct.setStageAttributesIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // STAGE_COUNTERS
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.MAP) {
              {
                com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map76 = iprot.readMapBegin();
                struct.stageCounters = new HashMap<String,Long>(2*_map76.size);
                for (int _i77 = 0; _i77 < _map76.size; ++_i77)
                {
                  String _key78; // required
                  long _val79; // required
                  _key78 = iprot.readString();
                  _val79 = iprot.readI64();
                  struct.stageCounters.put(_key78, _val79);
                }
                iprot.readMapEnd();
              }
              struct.setStageCountersIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TASK_LIST
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.LIST) {
              {
                com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TList _list80 = iprot.readListBegin();
                struct.taskList = new ArrayList<Task>(_list80.size);
                for (int _i81 = 0; _i81 < _list80.size; ++_i81)
                {
                  Task _elem82; // required
                  _elem82 = new Task();
                  _elem82.read(iprot);
                  struct.taskList.add(_elem82);
                }
                iprot.readListEnd();
              }
              struct.setTaskListIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // DONE
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL) {
              struct.done = iprot.readBool();
              struct.setDoneIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // STARTED
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.BOOL) {
              struct.started = iprot.readBool();
              struct.setStartedIsSet(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, Stage struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.stageId != null) {
        oprot.writeFieldBegin(STAGE_ID_FIELD_DESC);
        oprot.writeString(struct.stageId);
        oprot.writeFieldEnd();
      }
      if (struct.stageType != null) {
        oprot.writeFieldBegin(STAGE_TYPE_FIELD_DESC);
        oprot.writeI32(struct.stageType.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.stageAttributes != null) {
        oprot.writeFieldBegin(STAGE_ATTRIBUTES_FIELD_DESC);
        {
          oprot.writeMapBegin(new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, struct.stageAttributes.size()));
          for (Map.Entry<String, String> _iter83 : struct.stageAttributes.entrySet())
          {
            oprot.writeString(_iter83.getKey());
            oprot.writeString(_iter83.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.stageCounters != null) {
        oprot.writeFieldBegin(STAGE_COUNTERS_FIELD_DESC);
        {
          oprot.writeMapBegin(new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64, struct.stageCounters.size()));
          for (Map.Entry<String, Long> _iter84 : struct.stageCounters.entrySet())
          {
            oprot.writeString(_iter84.getKey());
            oprot.writeI64(_iter84.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.taskList != null) {
        oprot.writeFieldBegin(TASK_LIST_FIELD_DESC);
        {
          oprot.writeListBegin(new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TList(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT, struct.taskList.size()));
          for (Task _iter85 : struct.taskList)
          {
            _iter85.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(DONE_FIELD_DESC);
      oprot.writeBool(struct.done);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(STARTED_FIELD_DESC);
      oprot.writeBool(struct.started);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class StageTupleSchemeFactory implements SchemeFactory {
    public StageTupleScheme getScheme() {
      return new StageTupleScheme();
    }
  }

  private static class StageTupleScheme extends TupleScheme<Stage> {

    @Override
    public void write(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol prot, Stage struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetStageId()) {
        optionals.set(0);
      }
      if (struct.isSetStageType()) {
        optionals.set(1);
      }
      if (struct.isSetStageAttributes()) {
        optionals.set(2);
      }
      if (struct.isSetStageCounters()) {
        optionals.set(3);
      }
      if (struct.isSetTaskList()) {
        optionals.set(4);
      }
      if (struct.isSetDone()) {
        optionals.set(5);
      }
      if (struct.isSetStarted()) {
        optionals.set(6);
      }
      oprot.writeBitSet(optionals, 7);
      if (struct.isSetStageId()) {
        oprot.writeString(struct.stageId);
      }
      if (struct.isSetStageType()) {
        oprot.writeI32(struct.stageType.getValue());
      }
      if (struct.isSetStageAttributes()) {
        {
          oprot.writeI32(struct.stageAttributes.size());
          for (Map.Entry<String, String> _iter86 : struct.stageAttributes.entrySet())
          {
            oprot.writeString(_iter86.getKey());
            oprot.writeString(_iter86.getValue());
          }
        }
      }
      if (struct.isSetStageCounters()) {
        {
          oprot.writeI32(struct.stageCounters.size());
          for (Map.Entry<String, Long> _iter87 : struct.stageCounters.entrySet())
          {
            oprot.writeString(_iter87.getKey());
            oprot.writeI64(_iter87.getValue());
          }
        }
      }
      if (struct.isSetTaskList()) {
        {
          oprot.writeI32(struct.taskList.size());
          for (Task _iter88 : struct.taskList)
          {
            _iter88.write(oprot);
          }
        }
      }
      if (struct.isSetDone()) {
        oprot.writeBool(struct.done);
      }
      if (struct.isSetStarted()) {
        oprot.writeBool(struct.started);
      }
    }

    @Override
    public void read(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol prot, Stage struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(7);
      if (incoming.get(0)) {
        struct.stageId = iprot.readString();
        struct.setStageIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.stageType = StageType.findByValue(iprot.readI32());
        struct.setStageTypeIsSet(true);
      }
      if (incoming.get(2)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map89 = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.stageAttributes = new HashMap<String,String>(2*_map89.size);
          for (int _i90 = 0; _i90 < _map89.size; ++_i90)
          {
            String _key91; // required
            String _val92; // required
            _key91 = iprot.readString();
            _val92 = iprot.readString();
            struct.stageAttributes.put(_key91, _val92);
          }
        }
        struct.setStageAttributesIsSet(true);
      }
      if (incoming.get(3)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map93 = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING, com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.stageCounters = new HashMap<String,Long>(2*_map93.size);
          for (int _i94 = 0; _i94 < _map93.size; ++_i94)
          {
            String _key95; // required
            long _val96; // required
            _key95 = iprot.readString();
            _val96 = iprot.readI64();
            struct.stageCounters.put(_key95, _val96);
          }
        }
        struct.setStageCountersIsSet(true);
      }
      if (incoming.get(4)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TList _list97 = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TList(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.taskList = new ArrayList<Task>(_list97.size);
          for (int _i98 = 0; _i98 < _list97.size; ++_i98)
          {
            Task _elem99; // required
            _elem99 = new Task();
            _elem99.read(iprot);
            struct.taskList.add(_elem99);
          }
        }
        struct.setTaskListIsSet(true);
      }
      if (incoming.get(5)) {
        struct.done = iprot.readBool();
        struct.setDoneIsSet(true);
      }
      if (incoming.get(6)) {
        struct.started = iprot.readBool();
        struct.setStartedIsSet(true);
      }
    }
  }

}
TOP

Related Classes of org.apache.hadoop.hive.ql.plan.api.Stage

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.