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

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

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

  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField QUERY_ID_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("queryId", 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 QUERY_TYPE_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("queryType", 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 QUERY_ATTRIBUTES_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("queryAttributes", 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 QUERY_COUNTERS_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("queryCounters", 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 STAGE_GRAPH_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageGraph", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT, (short)5);
  private static final com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField STAGE_LIST_FIELD_DESC = new com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TField("stageList", com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.LIST, (short)6);
  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)7);
  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)8);

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

  private String queryId; // required
  private String queryType; // required
  private Map<String,String> queryAttributes; // required
  private Map<String,Long> queryCounters; // required
  private Graph stageGraph; // required
  private List<Stage> stageList; // 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 {
    QUERY_ID((short)1, "queryId"),
    QUERY_TYPE((short)2, "queryType"),
    QUERY_ATTRIBUTES((short)3, "queryAttributes"),
    QUERY_COUNTERS((short)4, "queryCounters"),
    STAGE_GRAPH((short)5, "stageGraph"),
    STAGE_LIST((short)6, "stageList"),
    DONE((short)7, "done"),
    STARTED((short)8, "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: // QUERY_ID
          return QUERY_ID;
        case 2: // QUERY_TYPE
          return QUERY_TYPE;
        case 3: // QUERY_ATTRIBUTES
          return QUERY_ATTRIBUTES;
        case 4: // QUERY_COUNTERS
          return QUERY_COUNTERS;
        case 5: // STAGE_GRAPH
          return STAGE_GRAPH;
        case 6: // STAGE_LIST
          return STAGE_LIST;
        case 7: // DONE
          return DONE;
        case 8: // 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.QUERY_ID, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("queryId", 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.QUERY_TYPE, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("queryType", 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.QUERY_ATTRIBUTES, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("queryAttributes", 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.QUERY_COUNTERS, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("queryCounters", 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.STAGE_GRAPH, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageGraph", com.facebook.presto.hive.shaded.org.apache.thrift.TFieldRequirementType.DEFAULT,
        new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.StructMetaData(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT, Graph.class)));
    tmpMap.put(_Fields.STAGE_LIST, new com.facebook.presto.hive.shaded.org.apache.thrift.meta_data.FieldMetaData("stageList", 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, Stage.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(Query.class, metaDataMap);
  }

  public Query() {
  }

  public Query(
    String queryId,
    String queryType,
    Map<String,String> queryAttributes,
    Map<String,Long> queryCounters,
    Graph stageGraph,
    List<Stage> stageList,
    boolean done,
    boolean started)
  {
    this();
    this.queryId = queryId;
    this.queryType = queryType;
    this.queryAttributes = queryAttributes;
    this.queryCounters = queryCounters;
    this.stageGraph = stageGraph;
    this.stageList = stageList;
    this.done = done;
    setDoneIsSet(true);
    this.started = started;
    setStartedIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Query(Query other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetQueryId()) {
      this.queryId = other.queryId;
    }
    if (other.isSetQueryType()) {
      this.queryType = other.queryType;
    }
    if (other.isSetQueryAttributes()) {
      Map<String,String> __this__queryAttributes = new HashMap<String,String>();
      for (Map.Entry<String, String> other_element : other.queryAttributes.entrySet()) {

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

        String __this__queryAttributes_copy_key = other_element_key;

        String __this__queryAttributes_copy_value = other_element_value;

        __this__queryAttributes.put(__this__queryAttributes_copy_key, __this__queryAttributes_copy_value);
      }
      this.queryAttributes = __this__queryAttributes;
    }
    if (other.isSetQueryCounters()) {
      Map<String,Long> __this__queryCounters = new HashMap<String,Long>();
      for (Map.Entry<String, Long> other_element : other.queryCounters.entrySet()) {

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

        String __this__queryCounters_copy_key = other_element_key;

        Long __this__queryCounters_copy_value = other_element_value;

        __this__queryCounters.put(__this__queryCounters_copy_key, __this__queryCounters_copy_value);
      }
      this.queryCounters = __this__queryCounters;
    }
    if (other.isSetStageGraph()) {
      this.stageGraph = new Graph(other.stageGraph);
    }
    if (other.isSetStageList()) {
      List<Stage> __this__stageList = new ArrayList<Stage>();
      for (Stage other_element : other.stageList) {
        __this__stageList.add(new Stage(other_element));
      }
      this.stageList = __this__stageList;
    }
    this.done = other.done;
    this.started = other.started;
  }

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

  @Override
  public void clear() {
    this.queryId = null;
    this.queryType = null;
    this.queryAttributes = null;
    this.queryCounters = null;
    this.stageGraph = null;
    this.stageList = null;
    setDoneIsSet(false);
    this.done = false;
    setStartedIsSet(false);
    this.started = false;
  }

  public String getQueryId() {
    return this.queryId;
  }

  public void setQueryId(String queryId) {
    this.queryId = queryId;
  }

  public void unsetQueryId() {
    this.queryId = null;
  }

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

  public void setQueryIdIsSet(boolean value) {
    if (!value) {
      this.queryId = null;
    }
  }

  public String getQueryType() {
    return this.queryType;
  }

  public void setQueryType(String queryType) {
    this.queryType = queryType;
  }

  public void unsetQueryType() {
    this.queryType = null;
  }

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

  public void setQueryTypeIsSet(boolean value) {
    if (!value) {
      this.queryType = null;
    }
  }

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

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

  public Map<String,String> getQueryAttributes() {
    return this.queryAttributes;
  }

  public void setQueryAttributes(Map<String,String> queryAttributes) {
    this.queryAttributes = queryAttributes;
  }

  public void unsetQueryAttributes() {
    this.queryAttributes = null;
  }

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

  public void setQueryAttributesIsSet(boolean value) {
    if (!value) {
      this.queryAttributes = null;
    }
  }

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

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

  public Map<String,Long> getQueryCounters() {
    return this.queryCounters;
  }

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

  public void unsetQueryCounters() {
    this.queryCounters = null;
  }

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

  public void setQueryCountersIsSet(boolean value) {
    if (!value) {
      this.queryCounters = null;
    }
  }

  public Graph getStageGraph() {
    return this.stageGraph;
  }

  public void setStageGraph(Graph stageGraph) {
    this.stageGraph = stageGraph;
  }

  public void unsetStageGraph() {
    this.stageGraph = null;
  }

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

  public void setStageGraphIsSet(boolean value) {
    if (!value) {
      this.stageGraph = null;
    }
  }

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

  public java.util.Iterator<Stage> getStageListIterator() {
    return (this.stageList == null) ? null : this.stageList.iterator();
  }

  public void addToStageList(Stage elem) {
    if (this.stageList == null) {
      this.stageList = new ArrayList<Stage>();
    }
    this.stageList.add(elem);
  }

  public List<Stage> getStageList() {
    return this.stageList;
  }

  public void setStageList(List<Stage> stageList) {
    this.stageList = stageList;
  }

  public void unsetStageList() {
    this.stageList = null;
  }

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

  public void setStageListIsSet(boolean value) {
    if (!value) {
      this.stageList = 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 QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((String)value);
      }
      break;

    case QUERY_TYPE:
      if (value == null) {
        unsetQueryType();
      } else {
        setQueryType((String)value);
      }
      break;

    case QUERY_ATTRIBUTES:
      if (value == null) {
        unsetQueryAttributes();
      } else {
        setQueryAttributes((Map<String,String>)value);
      }
      break;

    case QUERY_COUNTERS:
      if (value == null) {
        unsetQueryCounters();
      } else {
        setQueryCounters((Map<String,Long>)value);
      }
      break;

    case STAGE_GRAPH:
      if (value == null) {
        unsetStageGraph();
      } else {
        setStageGraph((Graph)value);
      }
      break;

    case STAGE_LIST:
      if (value == null) {
        unsetStageList();
      } else {
        setStageList((List<Stage>)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 QUERY_ID:
      return getQueryId();

    case QUERY_TYPE:
      return getQueryType();

    case QUERY_ATTRIBUTES:
      return getQueryAttributes();

    case QUERY_COUNTERS:
      return getQueryCounters();

    case STAGE_GRAPH:
      return getStageGraph();

    case STAGE_LIST:
      return getStageList();

    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 QUERY_ID:
      return isSetQueryId();
    case QUERY_TYPE:
      return isSetQueryType();
    case QUERY_ATTRIBUTES:
      return isSetQueryAttributes();
    case QUERY_COUNTERS:
      return isSetQueryCounters();
    case STAGE_GRAPH:
      return isSetStageGraph();
    case STAGE_LIST:
      return isSetStageList();
    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 Query)
      return this.equals((Query)that);
    return false;
  }

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

    boolean this_present_queryId = true && this.isSetQueryId();
    boolean that_present_queryId = true && that.isSetQueryId();
    if (this_present_queryId || that_present_queryId) {
      if (!(this_present_queryId && that_present_queryId))
        return false;
      if (!this.queryId.equals(that.queryId))
        return false;
    }

    boolean this_present_queryType = true && this.isSetQueryType();
    boolean that_present_queryType = true && that.isSetQueryType();
    if (this_present_queryType || that_present_queryType) {
      if (!(this_present_queryType && that_present_queryType))
        return false;
      if (!this.queryType.equals(that.queryType))
        return false;
    }

    boolean this_present_queryAttributes = true && this.isSetQueryAttributes();
    boolean that_present_queryAttributes = true && that.isSetQueryAttributes();
    if (this_present_queryAttributes || that_present_queryAttributes) {
      if (!(this_present_queryAttributes && that_present_queryAttributes))
        return false;
      if (!this.queryAttributes.equals(that.queryAttributes))
        return false;
    }

    boolean this_present_queryCounters = true && this.isSetQueryCounters();
    boolean that_present_queryCounters = true && that.isSetQueryCounters();
    if (this_present_queryCounters || that_present_queryCounters) {
      if (!(this_present_queryCounters && that_present_queryCounters))
        return false;
      if (!this.queryCounters.equals(that.queryCounters))
        return false;
    }

    boolean this_present_stageGraph = true && this.isSetStageGraph();
    boolean that_present_stageGraph = true && that.isSetStageGraph();
    if (this_present_stageGraph || that_present_stageGraph) {
      if (!(this_present_stageGraph && that_present_stageGraph))
        return false;
      if (!this.stageGraph.equals(that.stageGraph))
        return false;
    }

    boolean this_present_stageList = true && this.isSetStageList();
    boolean that_present_stageList = true && that.isSetStageList();
    if (this_present_stageList || that_present_stageList) {
      if (!(this_present_stageList && that_present_stageList))
        return false;
      if (!this.stageList.equals(that.stageList))
        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_queryId = true && (isSetQueryId());
    builder.append(present_queryId);
    if (present_queryId)
      builder.append(queryId);

    boolean present_queryType = true && (isSetQueryType());
    builder.append(present_queryType);
    if (present_queryType)
      builder.append(queryType);

    boolean present_queryAttributes = true && (isSetQueryAttributes());
    builder.append(present_queryAttributes);
    if (present_queryAttributes)
      builder.append(queryAttributes);

    boolean present_queryCounters = true && (isSetQueryCounters());
    builder.append(present_queryCounters);
    if (present_queryCounters)
      builder.append(queryCounters);

    boolean present_stageGraph = true && (isSetStageGraph());
    builder.append(present_stageGraph);
    if (present_stageGraph)
      builder.append(stageGraph);

    boolean present_stageList = true && (isSetStageList());
    builder.append(present_stageList);
    if (present_stageList)
      builder.append(stageList);

    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(Query other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

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

    lastComparison = Boolean.valueOf(isSetQueryId()).compareTo(typedOther.isSetQueryId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryId()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.queryId, typedOther.queryId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQueryType()).compareTo(typedOther.isSetQueryType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryType()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.queryType, typedOther.queryType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQueryAttributes()).compareTo(typedOther.isSetQueryAttributes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryAttributes()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.queryAttributes, typedOther.queryAttributes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQueryCounters()).compareTo(typedOther.isSetQueryCounters());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryCounters()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.queryCounters, typedOther.queryCounters);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStageGraph()).compareTo(typedOther.isSetStageGraph());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageGraph()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageGraph, typedOther.stageGraph);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStageList()).compareTo(typedOther.isSetStageList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStageList()) {
      lastComparison = com.facebook.presto.hive.shaded.org.apache.thrift.TBaseHelper.compareTo(this.stageList, typedOther.stageList);
      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("Query(");
    boolean first = true;

    sb.append("queryId:");
    if (this.queryId == null) {
      sb.append("null");
    } else {
      sb.append(this.queryId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("queryType:");
    if (this.queryType == null) {
      sb.append("null");
    } else {
      sb.append(this.queryType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("queryAttributes:");
    if (this.queryAttributes == null) {
      sb.append("null");
    } else {
      sb.append(this.queryAttributes);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("queryCounters:");
    if (this.queryCounters == null) {
      sb.append("null");
    } else {
      sb.append(this.queryCounters);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stageGraph:");
    if (this.stageGraph == null) {
      sb.append("null");
    } else {
      sb.append(this.stageGraph);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stageList:");
    if (this.stageList == null) {
      sb.append("null");
    } else {
      sb.append(this.stageList);
    }
    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
    if (stageGraph != null) {
      stageGraph.validate();
    }
  }

  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 QueryStandardSchemeFactory implements SchemeFactory {
    public QueryStandardScheme getScheme() {
      return new QueryStandardScheme();
    }
  }

  private static class QueryStandardScheme extends StandardScheme<Query> {

    public void read(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol iprot, Query 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: // QUERY_ID
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.queryId = iprot.readString();
              struct.setQueryIdIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // QUERY_TYPE
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRING) {
              struct.queryType = iprot.readString();
              struct.setQueryTypeIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // QUERY_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 _map100 = iprot.readMapBegin();
                struct.queryAttributes = new HashMap<String,String>(2*_map100.size);
                for (int _i101 = 0; _i101 < _map100.size; ++_i101)
                {
                  String _key102; // required
                  String _val103; // required
                  _key102 = iprot.readString();
                  _val103 = iprot.readString();
                  struct.queryAttributes.put(_key102, _val103);
                }
                iprot.readMapEnd();
              }
              struct.setQueryAttributesIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // QUERY_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 _map104 = iprot.readMapBegin();
                struct.queryCounters = new HashMap<String,Long>(2*_map104.size);
                for (int _i105 = 0; _i105 < _map104.size; ++_i105)
                {
                  String _key106; // required
                  long _val107; // required
                  _key106 = iprot.readString();
                  _val107 = iprot.readI64();
                  struct.queryCounters.put(_key106, _val107);
                }
                iprot.readMapEnd();
              }
              struct.setQueryCountersIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STAGE_GRAPH
            if (schemeField.type == com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TType.STRUCT) {
              struct.stageGraph = new Graph();
              struct.stageGraph.read(iprot);
              struct.setStageGraphIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // STAGE_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 _list108 = iprot.readListBegin();
                struct.stageList = new ArrayList<Stage>(_list108.size);
                for (int _i109 = 0; _i109 < _list108.size; ++_i109)
                {
                  Stage _elem110; // required
                  _elem110 = new Stage();
                  _elem110.read(iprot);
                  struct.stageList.add(_elem110);
                }
                iprot.readListEnd();
              }
              struct.setStageListIsSet(true);
            } else {
              com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // 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 8: // 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, Query struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.queryId != null) {
        oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
        oprot.writeString(struct.queryId);
        oprot.writeFieldEnd();
      }
      if (struct.queryType != null) {
        oprot.writeFieldBegin(QUERY_TYPE_FIELD_DESC);
        oprot.writeString(struct.queryType);
        oprot.writeFieldEnd();
      }
      if (struct.queryAttributes != null) {
        oprot.writeFieldBegin(QUERY_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.queryAttributes.size()));
          for (Map.Entry<String, String> _iter111 : struct.queryAttributes.entrySet())
          {
            oprot.writeString(_iter111.getKey());
            oprot.writeString(_iter111.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.queryCounters != null) {
        oprot.writeFieldBegin(QUERY_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.queryCounters.size()));
          for (Map.Entry<String, Long> _iter112 : struct.queryCounters.entrySet())
          {
            oprot.writeString(_iter112.getKey());
            oprot.writeI64(_iter112.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.stageGraph != null) {
        oprot.writeFieldBegin(STAGE_GRAPH_FIELD_DESC);
        struct.stageGraph.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.stageList != null) {
        oprot.writeFieldBegin(STAGE_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.stageList.size()));
          for (Stage _iter113 : struct.stageList)
          {
            _iter113.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 QueryTupleSchemeFactory implements SchemeFactory {
    public QueryTupleScheme getScheme() {
      return new QueryTupleScheme();
    }
  }

  private static class QueryTupleScheme extends TupleScheme<Query> {

    @Override
    public void write(com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TProtocol prot, Query struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetQueryId()) {
        optionals.set(0);
      }
      if (struct.isSetQueryType()) {
        optionals.set(1);
      }
      if (struct.isSetQueryAttributes()) {
        optionals.set(2);
      }
      if (struct.isSetQueryCounters()) {
        optionals.set(3);
      }
      if (struct.isSetStageGraph()) {
        optionals.set(4);
      }
      if (struct.isSetStageList()) {
        optionals.set(5);
      }
      if (struct.isSetDone()) {
        optionals.set(6);
      }
      if (struct.isSetStarted()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetQueryId()) {
        oprot.writeString(struct.queryId);
      }
      if (struct.isSetQueryType()) {
        oprot.writeString(struct.queryType);
      }
      if (struct.isSetQueryAttributes()) {
        {
          oprot.writeI32(struct.queryAttributes.size());
          for (Map.Entry<String, String> _iter114 : struct.queryAttributes.entrySet())
          {
            oprot.writeString(_iter114.getKey());
            oprot.writeString(_iter114.getValue());
          }
        }
      }
      if (struct.isSetQueryCounters()) {
        {
          oprot.writeI32(struct.queryCounters.size());
          for (Map.Entry<String, Long> _iter115 : struct.queryCounters.entrySet())
          {
            oprot.writeString(_iter115.getKey());
            oprot.writeI64(_iter115.getValue());
          }
        }
      }
      if (struct.isSetStageGraph()) {
        struct.stageGraph.write(oprot);
      }
      if (struct.isSetStageList()) {
        {
          oprot.writeI32(struct.stageList.size());
          for (Stage _iter116 : struct.stageList)
          {
            _iter116.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, Query struct) throws com.facebook.presto.hive.shaded.org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.queryId = iprot.readString();
        struct.setQueryIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.queryType = iprot.readString();
        struct.setQueryTypeIsSet(true);
      }
      if (incoming.get(2)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map117 = 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.queryAttributes = new HashMap<String,String>(2*_map117.size);
          for (int _i118 = 0; _i118 < _map117.size; ++_i118)
          {
            String _key119; // required
            String _val120; // required
            _key119 = iprot.readString();
            _val120 = iprot.readString();
            struct.queryAttributes.put(_key119, _val120);
          }
        }
        struct.setQueryAttributesIsSet(true);
      }
      if (incoming.get(3)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TMap _map121 = 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.queryCounters = new HashMap<String,Long>(2*_map121.size);
          for (int _i122 = 0; _i122 < _map121.size; ++_i122)
          {
            String _key123; // required
            long _val124; // required
            _key123 = iprot.readString();
            _val124 = iprot.readI64();
            struct.queryCounters.put(_key123, _val124);
          }
        }
        struct.setQueryCountersIsSet(true);
      }
      if (incoming.get(4)) {
        struct.stageGraph = new Graph();
        struct.stageGraph.read(iprot);
        struct.setStageGraphIsSet(true);
      }
      if (incoming.get(5)) {
        {
          com.facebook.presto.hive.shaded.org.apache.thrift.protocol.TList _list125 = 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.stageList = new ArrayList<Stage>(_list125.size);
          for (int _i126 = 0; _i126 < _list125.size; ++_i126)
          {
            Stage _elem127; // required
            _elem127 = new Stage();
            _elem127.read(iprot);
            struct.stageList.add(_elem127);
          }
        }
        struct.setStageListIsSet(true);
      }
      if (incoming.get(6)) {
        struct.done = iprot.readBool();
        struct.setDoneIsSet(true);
      }
      if (incoming.get(7)) {
        struct.started = iprot.readBool();
        struct.setStartedIsSet(true);
      }
    }
  }

}
TOP

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

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.