TReplacePartitionResult.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 TReplacePartitionResult implements org.apache.thrift.TBase<TReplacePartitionResult, TReplacePartitionResult._Fields>, java.io.Serializable, Cloneable, Comparable<TReplacePartitionResult> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TReplacePartitionResult");

  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField PARTITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("partitions", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField TABLETS_FIELD_DESC = new org.apache.thrift.protocol.TField("tablets", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField NODES_FIELD_DESC = new org.apache.thrift.protocol.TField("nodes", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField SLAVE_TABLETS_FIELD_DESC = new org.apache.thrift.protocol.TField("slave_tablets", org.apache.thrift.protocol.TType.LIST, (short)5);

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

  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TStatus status; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TOlapTablePartition> partitions; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TTabletLocation> tablets; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TNodeInfo> nodes; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TTabletLocation> slave_tablets; // 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 {
    STATUS((short)1, "status"),
    PARTITIONS((short)2, "partitions"),
    TABLETS((short)3, "tablets"),
    NODES((short)4, "nodes"),
    SLAVE_TABLETS((short)5, "slave_tablets");

    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: // STATUS
          return STATUS;
        case 2: // PARTITIONS
          return PARTITIONS;
        case 3: // TABLETS
          return TABLETS;
        case 4: // NODES
          return NODES;
        case 5: // SLAVE_TABLETS
          return SLAVE_TABLETS;
        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.STATUS,_Fields.PARTITIONS,_Fields.TABLETS,_Fields.NODES,_Fields.SLAVE_TABLETS};
  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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TStatus.class)));
    tmpMap.put(_Fields.PARTITIONS, new org.apache.thrift.meta_data.FieldMetaData("partitions", 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.TOlapTablePartition.class))));
    tmpMap.put(_Fields.TABLETS, new org.apache.thrift.meta_data.FieldMetaData("tablets", 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.TTabletLocation.class))));
    tmpMap.put(_Fields.NODES, new org.apache.thrift.meta_data.FieldMetaData("nodes", 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.TNodeInfo.class))));
    tmpMap.put(_Fields.SLAVE_TABLETS, new org.apache.thrift.meta_data.FieldMetaData("slave_tablets", 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.TTabletLocation.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TReplacePartitionResult.class, metaDataMap);
  }

  public TReplacePartitionResult() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TReplacePartitionResult(TReplacePartitionResult other) {
    if (other.isSetStatus()) {
      this.status = new org.apache.doris.thrift.TStatus(other.status);
    }
    if (other.isSetPartitions()) {
      java.util.List<org.apache.doris.thrift.TOlapTablePartition> __this__partitions = new java.util.ArrayList<org.apache.doris.thrift.TOlapTablePartition>(other.partitions.size());
      for (org.apache.doris.thrift.TOlapTablePartition other_element : other.partitions) {
        __this__partitions.add(new org.apache.doris.thrift.TOlapTablePartition(other_element));
      }
      this.partitions = __this__partitions;
    }
    if (other.isSetTablets()) {
      java.util.List<org.apache.doris.thrift.TTabletLocation> __this__tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(other.tablets.size());
      for (org.apache.doris.thrift.TTabletLocation other_element : other.tablets) {
        __this__tablets.add(new org.apache.doris.thrift.TTabletLocation(other_element));
      }
      this.tablets = __this__tablets;
    }
    if (other.isSetNodes()) {
      java.util.List<org.apache.doris.thrift.TNodeInfo> __this__nodes = new java.util.ArrayList<org.apache.doris.thrift.TNodeInfo>(other.nodes.size());
      for (org.apache.doris.thrift.TNodeInfo other_element : other.nodes) {
        __this__nodes.add(new org.apache.doris.thrift.TNodeInfo(other_element));
      }
      this.nodes = __this__nodes;
    }
    if (other.isSetSlaveTablets()) {
      java.util.List<org.apache.doris.thrift.TTabletLocation> __this__slave_tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(other.slave_tablets.size());
      for (org.apache.doris.thrift.TTabletLocation other_element : other.slave_tablets) {
        __this__slave_tablets.add(new org.apache.doris.thrift.TTabletLocation(other_element));
      }
      this.slave_tablets = __this__slave_tablets;
    }
  }

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

  @Override
  public void clear() {
    this.status = null;
    this.partitions = null;
    this.tablets = null;
    this.nodes = null;
    this.slave_tablets = null;
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TStatus getStatus() {
    return this.status;
  }

  public TReplacePartitionResult setStatus(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TStatus status) {
    this.status = status;
    return this;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TOlapTablePartition> getPartitions() {
    return this.partitions;
  }

  public TReplacePartitionResult setPartitions(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TOlapTablePartition> partitions) {
    this.partitions = partitions;
    return this;
  }

  public void unsetPartitions() {
    this.partitions = null;
  }

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

  public void setPartitionsIsSet(boolean value) {
    if (!value) {
      this.partitions = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TTabletLocation> getTablets() {
    return this.tablets;
  }

  public TReplacePartitionResult setTablets(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TTabletLocation> tablets) {
    this.tablets = tablets;
    return this;
  }

  public void unsetTablets() {
    this.tablets = null;
  }

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

  public void setTabletsIsSet(boolean value) {
    if (!value) {
      this.tablets = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TNodeInfo> getNodes() {
    return this.nodes;
  }

  public TReplacePartitionResult setNodes(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TNodeInfo> nodes) {
    this.nodes = nodes;
    return this;
  }

  public void unsetNodes() {
    this.nodes = null;
  }

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

  public void setNodesIsSet(boolean value) {
    if (!value) {
      this.nodes = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TTabletLocation> getSlaveTablets() {
    return this.slave_tablets;
  }

  public TReplacePartitionResult setSlaveTablets(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TTabletLocation> slave_tablets) {
    this.slave_tablets = slave_tablets;
    return this;
  }

  public void unsetSlaveTablets() {
    this.slave_tablets = null;
  }

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

  public void setSlaveTabletsIsSet(boolean value) {
    if (!value) {
      this.slave_tablets = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((org.apache.doris.thrift.TStatus)value);
      }
      break;

    case PARTITIONS:
      if (value == null) {
        unsetPartitions();
      } else {
        setPartitions((java.util.List<org.apache.doris.thrift.TOlapTablePartition>)value);
      }
      break;

    case TABLETS:
      if (value == null) {
        unsetTablets();
      } else {
        setTablets((java.util.List<org.apache.doris.thrift.TTabletLocation>)value);
      }
      break;

    case NODES:
      if (value == null) {
        unsetNodes();
      } else {
        setNodes((java.util.List<org.apache.doris.thrift.TNodeInfo>)value);
      }
      break;

    case SLAVE_TABLETS:
      if (value == null) {
        unsetSlaveTablets();
      } else {
        setSlaveTablets((java.util.List<org.apache.doris.thrift.TTabletLocation>)value);
      }
      break;

    }
  }

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

    case PARTITIONS:
      return getPartitions();

    case TABLETS:
      return getTablets();

    case NODES:
      return getNodes();

    case SLAVE_TABLETS:
      return getSlaveTablets();

    }
    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 STATUS:
      return isSetStatus();
    case PARTITIONS:
      return isSetPartitions();
    case TABLETS:
      return isSetTablets();
    case NODES:
      return isSetNodes();
    case SLAVE_TABLETS:
      return isSetSlaveTablets();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_partitions = true && this.isSetPartitions();
    boolean that_present_partitions = true && that.isSetPartitions();
    if (this_present_partitions || that_present_partitions) {
      if (!(this_present_partitions && that_present_partitions))
        return false;
      if (!this.partitions.equals(that.partitions))
        return false;
    }

    boolean this_present_tablets = true && this.isSetTablets();
    boolean that_present_tablets = true && that.isSetTablets();
    if (this_present_tablets || that_present_tablets) {
      if (!(this_present_tablets && that_present_tablets))
        return false;
      if (!this.tablets.equals(that.tablets))
        return false;
    }

    boolean this_present_nodes = true && this.isSetNodes();
    boolean that_present_nodes = true && that.isSetNodes();
    if (this_present_nodes || that_present_nodes) {
      if (!(this_present_nodes && that_present_nodes))
        return false;
      if (!this.nodes.equals(that.nodes))
        return false;
    }

    boolean this_present_slave_tablets = true && this.isSetSlaveTablets();
    boolean that_present_slave_tablets = true && that.isSetSlaveTablets();
    if (this_present_slave_tablets || that_present_slave_tablets) {
      if (!(this_present_slave_tablets && that_present_slave_tablets))
        return false;
      if (!this.slave_tablets.equals(that.slave_tablets))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetStatus()) ? 131071 : 524287);
    if (isSetStatus())
      hashCode = hashCode * 8191 + status.hashCode();

    hashCode = hashCode * 8191 + ((isSetPartitions()) ? 131071 : 524287);
    if (isSetPartitions())
      hashCode = hashCode * 8191 + partitions.hashCode();

    hashCode = hashCode * 8191 + ((isSetTablets()) ? 131071 : 524287);
    if (isSetTablets())
      hashCode = hashCode * 8191 + tablets.hashCode();

    hashCode = hashCode * 8191 + ((isSetNodes()) ? 131071 : 524287);
    if (isSetNodes())
      hashCode = hashCode * 8191 + nodes.hashCode();

    hashCode = hashCode * 8191 + ((isSetSlaveTablets()) ? 131071 : 524287);
    if (isSetSlaveTablets())
      hashCode = hashCode * 8191 + slave_tablets.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetStatus(), other.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPartitions(), other.isSetPartitions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartitions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partitions, other.partitions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTablets(), other.isSetTablets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTablets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablets, other.tablets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNodes(), other.isSetNodes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNodes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodes, other.nodes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSlaveTablets(), other.isSetSlaveTablets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSlaveTablets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.slave_tablets, other.slave_tablets);
      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("TReplacePartitionResult(");
    boolean first = true;

    if (isSetStatus()) {
      sb.append("status:");
      if (this.status == null) {
        sb.append("null");
      } else {
        sb.append(this.status);
      }
      first = false;
    }
    if (isSetPartitions()) {
      if (!first) sb.append(", ");
      sb.append("partitions:");
      if (this.partitions == null) {
        sb.append("null");
      } else {
        sb.append(this.partitions);
      }
      first = false;
    }
    if (isSetTablets()) {
      if (!first) sb.append(", ");
      sb.append("tablets:");
      if (this.tablets == null) {
        sb.append("null");
      } else {
        sb.append(this.tablets);
      }
      first = false;
    }
    if (isSetNodes()) {
      if (!first) sb.append(", ");
      sb.append("nodes:");
      if (this.nodes == null) {
        sb.append("null");
      } else {
        sb.append(this.nodes);
      }
      first = false;
    }
    if (isSetSlaveTablets()) {
      if (!first) sb.append(", ");
      sb.append("slave_tablets:");
      if (this.slave_tablets == null) {
        sb.append("null");
      } else {
        sb.append(this.slave_tablets);
      }
      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 (status != null) {
      status.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 TReplacePartitionResultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TReplacePartitionResultStandardScheme getScheme() {
      return new TReplacePartitionResultStandardScheme();
    }
  }

  private static class TReplacePartitionResultStandardScheme extends org.apache.thrift.scheme.StandardScheme<TReplacePartitionResult> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TReplacePartitionResult 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: // STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.status = new org.apache.doris.thrift.TStatus();
              struct.status.read(iprot);
              struct.setStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PARTITIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list690 = iprot.readListBegin();
                struct.partitions = new java.util.ArrayList<org.apache.doris.thrift.TOlapTablePartition>(_list690.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TOlapTablePartition _elem691;
                for (int _i692 = 0; _i692 < _list690.size; ++_i692)
                {
                  _elem691 = new org.apache.doris.thrift.TOlapTablePartition();
                  _elem691.read(iprot);
                  struct.partitions.add(_elem691);
                }
                iprot.readListEnd();
              }
              struct.setPartitionsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLETS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list693 = iprot.readListBegin();
                struct.tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(_list693.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TTabletLocation _elem694;
                for (int _i695 = 0; _i695 < _list693.size; ++_i695)
                {
                  _elem694 = new org.apache.doris.thrift.TTabletLocation();
                  _elem694.read(iprot);
                  struct.tablets.add(_elem694);
                }
                iprot.readListEnd();
              }
              struct.setTabletsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // NODES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list696 = iprot.readListBegin();
                struct.nodes = new java.util.ArrayList<org.apache.doris.thrift.TNodeInfo>(_list696.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TNodeInfo _elem697;
                for (int _i698 = 0; _i698 < _list696.size; ++_i698)
                {
                  _elem697 = new org.apache.doris.thrift.TNodeInfo();
                  _elem697.read(iprot);
                  struct.nodes.add(_elem697);
                }
                iprot.readListEnd();
              }
              struct.setNodesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // SLAVE_TABLETS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list699 = iprot.readListBegin();
                struct.slave_tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(_list699.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TTabletLocation _elem700;
                for (int _i701 = 0; _i701 < _list699.size; ++_i701)
                {
                  _elem700 = new org.apache.doris.thrift.TTabletLocation();
                  _elem700.read(iprot);
                  struct.slave_tablets.add(_elem700);
                }
                iprot.readListEnd();
              }
              struct.setSlaveTabletsIsSet(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, TReplacePartitionResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.status != null) {
        if (struct.isSetStatus()) {
          oprot.writeFieldBegin(STATUS_FIELD_DESC);
          struct.status.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.partitions != null) {
        if (struct.isSetPartitions()) {
          oprot.writeFieldBegin(PARTITIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.partitions.size()));
            for (org.apache.doris.thrift.TOlapTablePartition _iter702 : struct.partitions)
            {
              _iter702.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.tablets != null) {
        if (struct.isSetTablets()) {
          oprot.writeFieldBegin(TABLETS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tablets.size()));
            for (org.apache.doris.thrift.TTabletLocation _iter703 : struct.tablets)
            {
              _iter703.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.nodes != null) {
        if (struct.isSetNodes()) {
          oprot.writeFieldBegin(NODES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.nodes.size()));
            for (org.apache.doris.thrift.TNodeInfo _iter704 : struct.nodes)
            {
              _iter704.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.slave_tablets != null) {
        if (struct.isSetSlaveTablets()) {
          oprot.writeFieldBegin(SLAVE_TABLETS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.slave_tablets.size()));
            for (org.apache.doris.thrift.TTabletLocation _iter705 : struct.slave_tablets)
            {
              _iter705.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TReplacePartitionResultTupleScheme extends org.apache.thrift.scheme.TupleScheme<TReplacePartitionResult> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TReplacePartitionResult 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.isSetStatus()) {
        optionals.set(0);
      }
      if (struct.isSetPartitions()) {
        optionals.set(1);
      }
      if (struct.isSetTablets()) {
        optionals.set(2);
      }
      if (struct.isSetNodes()) {
        optionals.set(3);
      }
      if (struct.isSetSlaveTablets()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetStatus()) {
        struct.status.write(oprot);
      }
      if (struct.isSetPartitions()) {
        {
          oprot.writeI32(struct.partitions.size());
          for (org.apache.doris.thrift.TOlapTablePartition _iter706 : struct.partitions)
          {
            _iter706.write(oprot);
          }
        }
      }
      if (struct.isSetTablets()) {
        {
          oprot.writeI32(struct.tablets.size());
          for (org.apache.doris.thrift.TTabletLocation _iter707 : struct.tablets)
          {
            _iter707.write(oprot);
          }
        }
      }
      if (struct.isSetNodes()) {
        {
          oprot.writeI32(struct.nodes.size());
          for (org.apache.doris.thrift.TNodeInfo _iter708 : struct.nodes)
          {
            _iter708.write(oprot);
          }
        }
      }
      if (struct.isSetSlaveTablets()) {
        {
          oprot.writeI32(struct.slave_tablets.size());
          for (org.apache.doris.thrift.TTabletLocation _iter709 : struct.slave_tablets)
          {
            _iter709.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TReplacePartitionResult 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.status = new org.apache.doris.thrift.TStatus();
        struct.status.read(iprot);
        struct.setStatusIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list710 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.partitions = new java.util.ArrayList<org.apache.doris.thrift.TOlapTablePartition>(_list710.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TOlapTablePartition _elem711;
          for (int _i712 = 0; _i712 < _list710.size; ++_i712)
          {
            _elem711 = new org.apache.doris.thrift.TOlapTablePartition();
            _elem711.read(iprot);
            struct.partitions.add(_elem711);
          }
        }
        struct.setPartitionsIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list713 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(_list713.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TTabletLocation _elem714;
          for (int _i715 = 0; _i715 < _list713.size; ++_i715)
          {
            _elem714 = new org.apache.doris.thrift.TTabletLocation();
            _elem714.read(iprot);
            struct.tablets.add(_elem714);
          }
        }
        struct.setTabletsIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list716 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.nodes = new java.util.ArrayList<org.apache.doris.thrift.TNodeInfo>(_list716.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TNodeInfo _elem717;
          for (int _i718 = 0; _i718 < _list716.size; ++_i718)
          {
            _elem717 = new org.apache.doris.thrift.TNodeInfo();
            _elem717.read(iprot);
            struct.nodes.add(_elem717);
          }
        }
        struct.setNodesIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list719 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.slave_tablets = new java.util.ArrayList<org.apache.doris.thrift.TTabletLocation>(_list719.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TTabletLocation _elem720;
          for (int _i721 = 0; _i721 < _list719.size; ++_i721)
          {
            _elem720 = new org.apache.doris.thrift.TTabletLocation();
            _elem720.read(iprot);
            struct.slave_tablets.add(_elem720);
          }
        }
        struct.setSlaveTabletsIsSet(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();
  }
}