TQueryProfile.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TQueryProfile implements org.apache.thrift.TBase<TQueryProfile, TQueryProfile._Fields>, java.io.Serializable, Cloneable, Comparable<TQueryProfile> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TQueryProfile");

  private static final org.apache.thrift.protocol.TField QUERY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("query_id", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField FRAGMENT_ID_TO_PROFILE_FIELD_DESC = new org.apache.thrift.protocol.TField("fragment_id_to_profile", org.apache.thrift.protocol.TType.MAP, (short)2);
  private static final org.apache.thrift.protocol.TField FRAGMENT_INSTANCE_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("fragment_instance_ids", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField INSTANCE_PROFILES_FIELD_DESC = new org.apache.thrift.protocol.TField("instance_profiles", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField LOAD_CHANNEL_PROFILES_FIELD_DESC = new org.apache.thrift.protocol.TField("load_channel_profiles", org.apache.thrift.protocol.TType.LIST, (short)5);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TQueryProfileStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TQueryProfileTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId query_id; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,java.util.List<TDetailedReportParams>> fragment_id_to_profile; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TUniqueId> fragment_instance_ids; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> instance_profiles; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> load_channel_profiles; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    QUERY_ID((short)1, "query_id"),
    FRAGMENT_ID_TO_PROFILE((short)2, "fragment_id_to_profile"),
    FRAGMENT_INSTANCE_IDS((short)3, "fragment_instance_ids"),
    INSTANCE_PROFILES((short)4, "instance_profiles"),
    LOAD_CHANNEL_PROFILES((short)5, "load_channel_profiles");

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

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // QUERY_ID
          return QUERY_ID;
        case 2: // FRAGMENT_ID_TO_PROFILE
          return FRAGMENT_ID_TO_PROFILE;
        case 3: // FRAGMENT_INSTANCE_IDS
          return FRAGMENT_INSTANCE_IDS;
        case 4: // INSTANCE_PROFILES
          return INSTANCE_PROFILES;
        case 5: // LOAD_CHANNEL_PROFILES
          return LOAD_CHANNEL_PROFILES;
        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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.QUERY_ID,_Fields.FRAGMENT_ID_TO_PROFILE,_Fields.FRAGMENT_INSTANCE_IDS,_Fields.INSTANCE_PROFILES,_Fields.LOAD_CHANNEL_PROFILES};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUERY_ID, new org.apache.thrift.meta_data.FieldMetaData("query_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TUniqueId.class)));
    tmpMap.put(_Fields.FRAGMENT_ID_TO_PROFILE, new org.apache.thrift.meta_data.FieldMetaData("fragment_id_to_profile", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32), 
            new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
                new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDetailedReportParams.class)))));
    tmpMap.put(_Fields.FRAGMENT_INSTANCE_IDS, new org.apache.thrift.meta_data.FieldMetaData("fragment_instance_ids", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TUniqueId.class))));
    tmpMap.put(_Fields.INSTANCE_PROFILES, new org.apache.thrift.meta_data.FieldMetaData("instance_profiles", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TRuntimeProfileTree.class))));
    tmpMap.put(_Fields.LOAD_CHANNEL_PROFILES, new org.apache.thrift.meta_data.FieldMetaData("load_channel_profiles", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TRuntimeProfileTree.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TQueryProfile.class, metaDataMap);
  }

  public TQueryProfile() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TQueryProfile(TQueryProfile other) {
    if (other.isSetQueryId()) {
      this.query_id = new org.apache.doris.thrift.TUniqueId(other.query_id);
    }
    if (other.isSetFragmentIdToProfile()) {
      java.util.Map<java.lang.Integer,java.util.List<TDetailedReportParams>> __this__fragment_id_to_profile = new java.util.HashMap<java.lang.Integer,java.util.List<TDetailedReportParams>>(other.fragment_id_to_profile.size());
      for (java.util.Map.Entry<java.lang.Integer, java.util.List<TDetailedReportParams>> other_element : other.fragment_id_to_profile.entrySet()) {

        java.lang.Integer other_element_key = other_element.getKey();
        java.util.List<TDetailedReportParams> other_element_value = other_element.getValue();

        java.lang.Integer __this__fragment_id_to_profile_copy_key = other_element_key;

        java.util.List<TDetailedReportParams> __this__fragment_id_to_profile_copy_value = new java.util.ArrayList<TDetailedReportParams>(other_element_value.size());
        for (TDetailedReportParams other_element_value_element : other_element_value) {
          __this__fragment_id_to_profile_copy_value.add(new TDetailedReportParams(other_element_value_element));
        }

        __this__fragment_id_to_profile.put(__this__fragment_id_to_profile_copy_key, __this__fragment_id_to_profile_copy_value);
      }
      this.fragment_id_to_profile = __this__fragment_id_to_profile;
    }
    if (other.isSetFragmentInstanceIds()) {
      java.util.List<org.apache.doris.thrift.TUniqueId> __this__fragment_instance_ids = new java.util.ArrayList<org.apache.doris.thrift.TUniqueId>(other.fragment_instance_ids.size());
      for (org.apache.doris.thrift.TUniqueId other_element : other.fragment_instance_ids) {
        __this__fragment_instance_ids.add(new org.apache.doris.thrift.TUniqueId(other_element));
      }
      this.fragment_instance_ids = __this__fragment_instance_ids;
    }
    if (other.isSetInstanceProfiles()) {
      java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> __this__instance_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(other.instance_profiles.size());
      for (org.apache.doris.thrift.TRuntimeProfileTree other_element : other.instance_profiles) {
        __this__instance_profiles.add(new org.apache.doris.thrift.TRuntimeProfileTree(other_element));
      }
      this.instance_profiles = __this__instance_profiles;
    }
    if (other.isSetLoadChannelProfiles()) {
      java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> __this__load_channel_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(other.load_channel_profiles.size());
      for (org.apache.doris.thrift.TRuntimeProfileTree other_element : other.load_channel_profiles) {
        __this__load_channel_profiles.add(new org.apache.doris.thrift.TRuntimeProfileTree(other_element));
      }
      this.load_channel_profiles = __this__load_channel_profiles;
    }
  }

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

  @Override
  public void clear() {
    this.query_id = null;
    this.fragment_id_to_profile = null;
    this.fragment_instance_ids = null;
    this.instance_profiles = null;
    this.load_channel_profiles = null;
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TUniqueId getQueryId() {
    return this.query_id;
  }

  public TQueryProfile setQueryId(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId query_id) {
    this.query_id = query_id;
    return this;
  }

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

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

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

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

  public void putToFragmentIdToProfile(int key, java.util.List<TDetailedReportParams> val) {
    if (this.fragment_id_to_profile == null) {
      this.fragment_id_to_profile = new java.util.HashMap<java.lang.Integer,java.util.List<TDetailedReportParams>>();
    }
    this.fragment_id_to_profile.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.Integer,java.util.List<TDetailedReportParams>> getFragmentIdToProfile() {
    return this.fragment_id_to_profile;
  }

  public TQueryProfile setFragmentIdToProfile(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,java.util.List<TDetailedReportParams>> fragment_id_to_profile) {
    this.fragment_id_to_profile = fragment_id_to_profile;
    return this;
  }

  public void unsetFragmentIdToProfile() {
    this.fragment_id_to_profile = null;
  }

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

  public void setFragmentIdToProfileIsSet(boolean value) {
    if (!value) {
      this.fragment_id_to_profile = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<org.apache.doris.thrift.TUniqueId> getFragmentInstanceIdsIterator() {
    return (this.fragment_instance_ids == null) ? null : this.fragment_instance_ids.iterator();
  }

  public void addToFragmentInstanceIds(org.apache.doris.thrift.TUniqueId elem) {
    if (this.fragment_instance_ids == null) {
      this.fragment_instance_ids = new java.util.ArrayList<org.apache.doris.thrift.TUniqueId>();
    }
    this.fragment_instance_ids.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TUniqueId> getFragmentInstanceIds() {
    return this.fragment_instance_ids;
  }

  public TQueryProfile setFragmentInstanceIds(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TUniqueId> fragment_instance_ids) {
    this.fragment_instance_ids = fragment_instance_ids;
    return this;
  }

  public void unsetFragmentInstanceIds() {
    this.fragment_instance_ids = null;
  }

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

  public void setFragmentInstanceIdsIsSet(boolean value) {
    if (!value) {
      this.fragment_instance_ids = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<org.apache.doris.thrift.TRuntimeProfileTree> getInstanceProfilesIterator() {
    return (this.instance_profiles == null) ? null : this.instance_profiles.iterator();
  }

  public void addToInstanceProfiles(org.apache.doris.thrift.TRuntimeProfileTree elem) {
    if (this.instance_profiles == null) {
      this.instance_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>();
    }
    this.instance_profiles.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> getInstanceProfiles() {
    return this.instance_profiles;
  }

  public TQueryProfile setInstanceProfiles(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> instance_profiles) {
    this.instance_profiles = instance_profiles;
    return this;
  }

  public void unsetInstanceProfiles() {
    this.instance_profiles = null;
  }

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

  public void setInstanceProfilesIsSet(boolean value) {
    if (!value) {
      this.instance_profiles = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<org.apache.doris.thrift.TRuntimeProfileTree> getLoadChannelProfilesIterator() {
    return (this.load_channel_profiles == null) ? null : this.load_channel_profiles.iterator();
  }

  public void addToLoadChannelProfiles(org.apache.doris.thrift.TRuntimeProfileTree elem) {
    if (this.load_channel_profiles == null) {
      this.load_channel_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>();
    }
    this.load_channel_profiles.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> getLoadChannelProfiles() {
    return this.load_channel_profiles;
  }

  public TQueryProfile setLoadChannelProfiles(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TRuntimeProfileTree> load_channel_profiles) {
    this.load_channel_profiles = load_channel_profiles;
    return this;
  }

  public void unsetLoadChannelProfiles() {
    this.load_channel_profiles = null;
  }

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

  public void setLoadChannelProfilesIsSet(boolean value) {
    if (!value) {
      this.load_channel_profiles = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((org.apache.doris.thrift.TUniqueId)value);
      }
      break;

    case FRAGMENT_ID_TO_PROFILE:
      if (value == null) {
        unsetFragmentIdToProfile();
      } else {
        setFragmentIdToProfile((java.util.Map<java.lang.Integer,java.util.List<TDetailedReportParams>>)value);
      }
      break;

    case FRAGMENT_INSTANCE_IDS:
      if (value == null) {
        unsetFragmentInstanceIds();
      } else {
        setFragmentInstanceIds((java.util.List<org.apache.doris.thrift.TUniqueId>)value);
      }
      break;

    case INSTANCE_PROFILES:
      if (value == null) {
        unsetInstanceProfiles();
      } else {
        setInstanceProfiles((java.util.List<org.apache.doris.thrift.TRuntimeProfileTree>)value);
      }
      break;

    case LOAD_CHANNEL_PROFILES:
      if (value == null) {
        unsetLoadChannelProfiles();
      } else {
        setLoadChannelProfiles((java.util.List<org.apache.doris.thrift.TRuntimeProfileTree>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY_ID:
      return getQueryId();

    case FRAGMENT_ID_TO_PROFILE:
      return getFragmentIdToProfile();

    case FRAGMENT_INSTANCE_IDS:
      return getFragmentInstanceIds();

    case INSTANCE_PROFILES:
      return getInstanceProfiles();

    case LOAD_CHANNEL_PROFILES:
      return getLoadChannelProfiles();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case QUERY_ID:
      return isSetQueryId();
    case FRAGMENT_ID_TO_PROFILE:
      return isSetFragmentIdToProfile();
    case FRAGMENT_INSTANCE_IDS:
      return isSetFragmentInstanceIds();
    case INSTANCE_PROFILES:
      return isSetInstanceProfiles();
    case LOAD_CHANNEL_PROFILES:
      return isSetLoadChannelProfiles();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TQueryProfile)
      return this.equals((TQueryProfile)that);
    return false;
  }

  public boolean equals(TQueryProfile that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_query_id = true && this.isSetQueryId();
    boolean that_present_query_id = true && that.isSetQueryId();
    if (this_present_query_id || that_present_query_id) {
      if (!(this_present_query_id && that_present_query_id))
        return false;
      if (!this.query_id.equals(that.query_id))
        return false;
    }

    boolean this_present_fragment_id_to_profile = true && this.isSetFragmentIdToProfile();
    boolean that_present_fragment_id_to_profile = true && that.isSetFragmentIdToProfile();
    if (this_present_fragment_id_to_profile || that_present_fragment_id_to_profile) {
      if (!(this_present_fragment_id_to_profile && that_present_fragment_id_to_profile))
        return false;
      if (!this.fragment_id_to_profile.equals(that.fragment_id_to_profile))
        return false;
    }

    boolean this_present_fragment_instance_ids = true && this.isSetFragmentInstanceIds();
    boolean that_present_fragment_instance_ids = true && that.isSetFragmentInstanceIds();
    if (this_present_fragment_instance_ids || that_present_fragment_instance_ids) {
      if (!(this_present_fragment_instance_ids && that_present_fragment_instance_ids))
        return false;
      if (!this.fragment_instance_ids.equals(that.fragment_instance_ids))
        return false;
    }

    boolean this_present_instance_profiles = true && this.isSetInstanceProfiles();
    boolean that_present_instance_profiles = true && that.isSetInstanceProfiles();
    if (this_present_instance_profiles || that_present_instance_profiles) {
      if (!(this_present_instance_profiles && that_present_instance_profiles))
        return false;
      if (!this.instance_profiles.equals(that.instance_profiles))
        return false;
    }

    boolean this_present_load_channel_profiles = true && this.isSetLoadChannelProfiles();
    boolean that_present_load_channel_profiles = true && that.isSetLoadChannelProfiles();
    if (this_present_load_channel_profiles || that_present_load_channel_profiles) {
      if (!(this_present_load_channel_profiles && that_present_load_channel_profiles))
        return false;
      if (!this.load_channel_profiles.equals(that.load_channel_profiles))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetQueryId()) ? 131071 : 524287);
    if (isSetQueryId())
      hashCode = hashCode * 8191 + query_id.hashCode();

    hashCode = hashCode * 8191 + ((isSetFragmentIdToProfile()) ? 131071 : 524287);
    if (isSetFragmentIdToProfile())
      hashCode = hashCode * 8191 + fragment_id_to_profile.hashCode();

    hashCode = hashCode * 8191 + ((isSetFragmentInstanceIds()) ? 131071 : 524287);
    if (isSetFragmentInstanceIds())
      hashCode = hashCode * 8191 + fragment_instance_ids.hashCode();

    hashCode = hashCode * 8191 + ((isSetInstanceProfiles()) ? 131071 : 524287);
    if (isSetInstanceProfiles())
      hashCode = hashCode * 8191 + instance_profiles.hashCode();

    hashCode = hashCode * 8191 + ((isSetLoadChannelProfiles()) ? 131071 : 524287);
    if (isSetLoadChannelProfiles())
      hashCode = hashCode * 8191 + load_channel_profiles.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetQueryId(), other.isSetQueryId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.query_id, other.query_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFragmentIdToProfile(), other.isSetFragmentIdToProfile());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFragmentIdToProfile()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fragment_id_to_profile, other.fragment_id_to_profile);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFragmentInstanceIds(), other.isSetFragmentInstanceIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFragmentInstanceIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fragment_instance_ids, other.fragment_instance_ids);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetInstanceProfiles(), other.isSetInstanceProfiles());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInstanceProfiles()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instance_profiles, other.instance_profiles);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetLoadChannelProfiles(), other.isSetLoadChannelProfiles());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoadChannelProfiles()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.load_channel_profiles, other.load_channel_profiles);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TQueryProfile(");
    boolean first = true;

    if (isSetQueryId()) {
      sb.append("query_id:");
      if (this.query_id == null) {
        sb.append("null");
      } else {
        sb.append(this.query_id);
      }
      first = false;
    }
    if (isSetFragmentIdToProfile()) {
      if (!first) sb.append(", ");
      sb.append("fragment_id_to_profile:");
      if (this.fragment_id_to_profile == null) {
        sb.append("null");
      } else {
        sb.append(this.fragment_id_to_profile);
      }
      first = false;
    }
    if (isSetFragmentInstanceIds()) {
      if (!first) sb.append(", ");
      sb.append("fragment_instance_ids:");
      if (this.fragment_instance_ids == null) {
        sb.append("null");
      } else {
        sb.append(this.fragment_instance_ids);
      }
      first = false;
    }
    if (isSetInstanceProfiles()) {
      if (!first) sb.append(", ");
      sb.append("instance_profiles:");
      if (this.instance_profiles == null) {
        sb.append("null");
      } else {
        sb.append(this.instance_profiles);
      }
      first = false;
    }
    if (isSetLoadChannelProfiles()) {
      if (!first) sb.append(", ");
      sb.append("load_channel_profiles:");
      if (this.load_channel_profiles == null) {
        sb.append("null");
      } else {
        sb.append(this.load_channel_profiles);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (query_id != null) {
      query_id.validate();
    }
  }

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TQueryProfileStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TQueryProfileStandardScheme getScheme() {
      return new TQueryProfileStandardScheme();
    }
  }

  private static class TQueryProfileStandardScheme extends org.apache.thrift.scheme.StandardScheme<TQueryProfile> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TQueryProfile struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // QUERY_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.query_id = new org.apache.doris.thrift.TUniqueId();
              struct.query_id.read(iprot);
              struct.setQueryIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FRAGMENT_ID_TO_PROFILE
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map132 = iprot.readMapBegin();
                struct.fragment_id_to_profile = new java.util.HashMap<java.lang.Integer,java.util.List<TDetailedReportParams>>(2*_map132.size);
                int _key133;
                @org.apache.thrift.annotation.Nullable java.util.List<TDetailedReportParams> _val134;
                for (int _i135 = 0; _i135 < _map132.size; ++_i135)
                {
                  _key133 = iprot.readI32();
                  {
                    org.apache.thrift.protocol.TList _list136 = iprot.readListBegin();
                    _val134 = new java.util.ArrayList<TDetailedReportParams>(_list136.size);
                    @org.apache.thrift.annotation.Nullable TDetailedReportParams _elem137;
                    for (int _i138 = 0; _i138 < _list136.size; ++_i138)
                    {
                      _elem137 = new TDetailedReportParams();
                      _elem137.read(iprot);
                      _val134.add(_elem137);
                    }
                    iprot.readListEnd();
                  }
                  struct.fragment_id_to_profile.put(_key133, _val134);
                }
                iprot.readMapEnd();
              }
              struct.setFragmentIdToProfileIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // FRAGMENT_INSTANCE_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list139 = iprot.readListBegin();
                struct.fragment_instance_ids = new java.util.ArrayList<org.apache.doris.thrift.TUniqueId>(_list139.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId _elem140;
                for (int _i141 = 0; _i141 < _list139.size; ++_i141)
                {
                  _elem140 = new org.apache.doris.thrift.TUniqueId();
                  _elem140.read(iprot);
                  struct.fragment_instance_ids.add(_elem140);
                }
                iprot.readListEnd();
              }
              struct.setFragmentInstanceIdsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // INSTANCE_PROFILES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list142 = iprot.readListBegin();
                struct.instance_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(_list142.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TRuntimeProfileTree _elem143;
                for (int _i144 = 0; _i144 < _list142.size; ++_i144)
                {
                  _elem143 = new org.apache.doris.thrift.TRuntimeProfileTree();
                  _elem143.read(iprot);
                  struct.instance_profiles.add(_elem143);
                }
                iprot.readListEnd();
              }
              struct.setInstanceProfilesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // LOAD_CHANNEL_PROFILES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list145 = iprot.readListBegin();
                struct.load_channel_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(_list145.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TRuntimeProfileTree _elem146;
                for (int _i147 = 0; _i147 < _list145.size; ++_i147)
                {
                  _elem146 = new org.apache.doris.thrift.TRuntimeProfileTree();
                  _elem146.read(iprot);
                  struct.load_channel_profiles.add(_elem146);
                }
                iprot.readListEnd();
              }
              struct.setLoadChannelProfilesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TQueryProfile struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.query_id != null) {
        if (struct.isSetQueryId()) {
          oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
          struct.query_id.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.fragment_id_to_profile != null) {
        if (struct.isSetFragmentIdToProfile()) {
          oprot.writeFieldBegin(FRAGMENT_ID_TO_PROFILE_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.LIST, struct.fragment_id_to_profile.size()));
            for (java.util.Map.Entry<java.lang.Integer, java.util.List<TDetailedReportParams>> _iter148 : struct.fragment_id_to_profile.entrySet())
            {
              oprot.writeI32(_iter148.getKey());
              {
                oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter148.getValue().size()));
                for (TDetailedReportParams _iter149 : _iter148.getValue())
                {
                  _iter149.write(oprot);
                }
                oprot.writeListEnd();
              }
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.fragment_instance_ids != null) {
        if (struct.isSetFragmentInstanceIds()) {
          oprot.writeFieldBegin(FRAGMENT_INSTANCE_IDS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.fragment_instance_ids.size()));
            for (org.apache.doris.thrift.TUniqueId _iter150 : struct.fragment_instance_ids)
            {
              _iter150.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.instance_profiles != null) {
        if (struct.isSetInstanceProfiles()) {
          oprot.writeFieldBegin(INSTANCE_PROFILES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.instance_profiles.size()));
            for (org.apache.doris.thrift.TRuntimeProfileTree _iter151 : struct.instance_profiles)
            {
              _iter151.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.load_channel_profiles != null) {
        if (struct.isSetLoadChannelProfiles()) {
          oprot.writeFieldBegin(LOAD_CHANNEL_PROFILES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.load_channel_profiles.size()));
            for (org.apache.doris.thrift.TRuntimeProfileTree _iter152 : struct.load_channel_profiles)
            {
              _iter152.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TQueryProfileTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TQueryProfileTupleScheme getScheme() {
      return new TQueryProfileTupleScheme();
    }
  }

  private static class TQueryProfileTupleScheme extends org.apache.thrift.scheme.TupleScheme<TQueryProfile> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TQueryProfile struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetQueryId()) {
        optionals.set(0);
      }
      if (struct.isSetFragmentIdToProfile()) {
        optionals.set(1);
      }
      if (struct.isSetFragmentInstanceIds()) {
        optionals.set(2);
      }
      if (struct.isSetInstanceProfiles()) {
        optionals.set(3);
      }
      if (struct.isSetLoadChannelProfiles()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetQueryId()) {
        struct.query_id.write(oprot);
      }
      if (struct.isSetFragmentIdToProfile()) {
        {
          oprot.writeI32(struct.fragment_id_to_profile.size());
          for (java.util.Map.Entry<java.lang.Integer, java.util.List<TDetailedReportParams>> _iter153 : struct.fragment_id_to_profile.entrySet())
          {
            oprot.writeI32(_iter153.getKey());
            {
              oprot.writeI32(_iter153.getValue().size());
              for (TDetailedReportParams _iter154 : _iter153.getValue())
              {
                _iter154.write(oprot);
              }
            }
          }
        }
      }
      if (struct.isSetFragmentInstanceIds()) {
        {
          oprot.writeI32(struct.fragment_instance_ids.size());
          for (org.apache.doris.thrift.TUniqueId _iter155 : struct.fragment_instance_ids)
          {
            _iter155.write(oprot);
          }
        }
      }
      if (struct.isSetInstanceProfiles()) {
        {
          oprot.writeI32(struct.instance_profiles.size());
          for (org.apache.doris.thrift.TRuntimeProfileTree _iter156 : struct.instance_profiles)
          {
            _iter156.write(oprot);
          }
        }
      }
      if (struct.isSetLoadChannelProfiles()) {
        {
          oprot.writeI32(struct.load_channel_profiles.size());
          for (org.apache.doris.thrift.TRuntimeProfileTree _iter157 : struct.load_channel_profiles)
          {
            _iter157.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TQueryProfile struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.query_id = new org.apache.doris.thrift.TUniqueId();
        struct.query_id.read(iprot);
        struct.setQueryIdIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TMap _map158 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.LIST); 
          struct.fragment_id_to_profile = new java.util.HashMap<java.lang.Integer,java.util.List<TDetailedReportParams>>(2*_map158.size);
          int _key159;
          @org.apache.thrift.annotation.Nullable java.util.List<TDetailedReportParams> _val160;
          for (int _i161 = 0; _i161 < _map158.size; ++_i161)
          {
            _key159 = iprot.readI32();
            {
              org.apache.thrift.protocol.TList _list162 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
              _val160 = new java.util.ArrayList<TDetailedReportParams>(_list162.size);
              @org.apache.thrift.annotation.Nullable TDetailedReportParams _elem163;
              for (int _i164 = 0; _i164 < _list162.size; ++_i164)
              {
                _elem163 = new TDetailedReportParams();
                _elem163.read(iprot);
                _val160.add(_elem163);
              }
            }
            struct.fragment_id_to_profile.put(_key159, _val160);
          }
        }
        struct.setFragmentIdToProfileIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list165 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.fragment_instance_ids = new java.util.ArrayList<org.apache.doris.thrift.TUniqueId>(_list165.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId _elem166;
          for (int _i167 = 0; _i167 < _list165.size; ++_i167)
          {
            _elem166 = new org.apache.doris.thrift.TUniqueId();
            _elem166.read(iprot);
            struct.fragment_instance_ids.add(_elem166);
          }
        }
        struct.setFragmentInstanceIdsIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list168 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.instance_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(_list168.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TRuntimeProfileTree _elem169;
          for (int _i170 = 0; _i170 < _list168.size; ++_i170)
          {
            _elem169 = new org.apache.doris.thrift.TRuntimeProfileTree();
            _elem169.read(iprot);
            struct.instance_profiles.add(_elem169);
          }
        }
        struct.setInstanceProfilesIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list171 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.load_channel_profiles = new java.util.ArrayList<org.apache.doris.thrift.TRuntimeProfileTree>(_list171.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TRuntimeProfileTree _elem172;
          for (int _i173 = 0; _i173 < _list171.size; ++_i173)
          {
            _elem172 = new org.apache.doris.thrift.TRuntimeProfileTree();
            _elem172.read(iprot);
            struct.load_channel_profiles.add(_elem172);
          }
        }
        struct.setLoadChannelProfilesIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}