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

  private static final org.apache.thrift.protocol.TField OVERWRITE_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("overwrite_group_id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DB_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("db_id", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField TABLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("table_id", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField PARTITION_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("partition_ids", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField BE_ENDPOINT_FIELD_DESC = new org.apache.thrift.protocol.TField("be_endpoint", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField WRITE_SINGLE_REPLICA_FIELD_DESC = new org.apache.thrift.protocol.TField("write_single_replica", org.apache.thrift.protocol.TType.BOOL, (short)6);
  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)7);

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

  public long overwrite_group_id; // optional
  public long db_id; // optional
  public long table_id; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> partition_ids; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String be_endpoint; // optional
  public boolean write_single_replica; // optional
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId query_id; // 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 {
    OVERWRITE_GROUP_ID((short)1, "overwrite_group_id"),
    DB_ID((short)2, "db_id"),
    TABLE_ID((short)3, "table_id"),
    PARTITION_IDS((short)4, "partition_ids"),
    BE_ENDPOINT((short)5, "be_endpoint"),
    WRITE_SINGLE_REPLICA((short)6, "write_single_replica"),
    QUERY_ID((short)7, "query_id");

    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: // OVERWRITE_GROUP_ID
          return OVERWRITE_GROUP_ID;
        case 2: // DB_ID
          return DB_ID;
        case 3: // TABLE_ID
          return TABLE_ID;
        case 4: // PARTITION_IDS
          return PARTITION_IDS;
        case 5: // BE_ENDPOINT
          return BE_ENDPOINT;
        case 6: // WRITE_SINGLE_REPLICA
          return WRITE_SINGLE_REPLICA;
        case 7: // QUERY_ID
          return QUERY_ID;
        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 int __OVERWRITE_GROUP_ID_ISSET_ID = 0;
  private static final int __DB_ID_ISSET_ID = 1;
  private static final int __TABLE_ID_ISSET_ID = 2;
  private static final int __WRITE_SINGLE_REPLICA_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.OVERWRITE_GROUP_ID,_Fields.DB_ID,_Fields.TABLE_ID,_Fields.PARTITION_IDS,_Fields.BE_ENDPOINT,_Fields.WRITE_SINGLE_REPLICA,_Fields.QUERY_ID};
  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.OVERWRITE_GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("overwrite_group_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DB_ID, new org.apache.thrift.meta_data.FieldMetaData("db_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TABLE_ID, new org.apache.thrift.meta_data.FieldMetaData("table_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PARTITION_IDS, new org.apache.thrift.meta_data.FieldMetaData("partition_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.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.BE_ENDPOINT, new org.apache.thrift.meta_data.FieldMetaData("be_endpoint", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.WRITE_SINGLE_REPLICA, new org.apache.thrift.meta_data.FieldMetaData("write_single_replica", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    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)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TReplacePartitionRequest.class, metaDataMap);
  }

  public TReplacePartitionRequest() {
    this.write_single_replica = false;

  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TReplacePartitionRequest(TReplacePartitionRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    this.overwrite_group_id = other.overwrite_group_id;
    this.db_id = other.db_id;
    this.table_id = other.table_id;
    if (other.isSetPartitionIds()) {
      java.util.List<java.lang.Long> __this__partition_ids = new java.util.ArrayList<java.lang.Long>(other.partition_ids);
      this.partition_ids = __this__partition_ids;
    }
    if (other.isSetBeEndpoint()) {
      this.be_endpoint = other.be_endpoint;
    }
    this.write_single_replica = other.write_single_replica;
    if (other.isSetQueryId()) {
      this.query_id = new org.apache.doris.thrift.TUniqueId(other.query_id);
    }
  }

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

  @Override
  public void clear() {
    setOverwriteGroupIdIsSet(false);
    this.overwrite_group_id = 0;
    setDbIdIsSet(false);
    this.db_id = 0;
    setTableIdIsSet(false);
    this.table_id = 0;
    this.partition_ids = null;
    this.be_endpoint = null;
    this.write_single_replica = false;

    this.query_id = null;
  }

  public long getOverwriteGroupId() {
    return this.overwrite_group_id;
  }

  public TReplacePartitionRequest setOverwriteGroupId(long overwrite_group_id) {
    this.overwrite_group_id = overwrite_group_id;
    setOverwriteGroupIdIsSet(true);
    return this;
  }

  public void unsetOverwriteGroupId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __OVERWRITE_GROUP_ID_ISSET_ID);
  }

  /** Returns true if field overwrite_group_id is set (has been assigned a value) and false otherwise */
  public boolean isSetOverwriteGroupId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __OVERWRITE_GROUP_ID_ISSET_ID);
  }

  public void setOverwriteGroupIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __OVERWRITE_GROUP_ID_ISSET_ID, value);
  }

  public long getDbId() {
    return this.db_id;
  }

  public TReplacePartitionRequest setDbId(long db_id) {
    this.db_id = db_id;
    setDbIdIsSet(true);
    return this;
  }

  public void unsetDbId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DB_ID_ISSET_ID);
  }

  /** Returns true if field db_id is set (has been assigned a value) and false otherwise */
  public boolean isSetDbId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DB_ID_ISSET_ID);
  }

  public void setDbIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DB_ID_ISSET_ID, value);
  }

  public long getTableId() {
    return this.table_id;
  }

  public TReplacePartitionRequest setTableId(long table_id) {
    this.table_id = table_id;
    setTableIdIsSet(true);
    return this;
  }

  public void unsetTableId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TABLE_ID_ISSET_ID);
  }

  /** Returns true if field table_id is set (has been assigned a value) and false otherwise */
  public boolean isSetTableId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TABLE_ID_ISSET_ID);
  }

  public void setTableIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __TABLE_ID_ISSET_ID, value);
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getPartitionIdsIterator() {
    return (this.partition_ids == null) ? null : this.partition_ids.iterator();
  }

  public void addToPartitionIds(long elem) {
    if (this.partition_ids == null) {
      this.partition_ids = new java.util.ArrayList<java.lang.Long>();
    }
    this.partition_ids.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getPartitionIds() {
    return this.partition_ids;
  }

  public TReplacePartitionRequest setPartitionIds(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> partition_ids) {
    this.partition_ids = partition_ids;
    return this;
  }

  public void unsetPartitionIds() {
    this.partition_ids = null;
  }

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

  public void setPartitionIdsIsSet(boolean value) {
    if (!value) {
      this.partition_ids = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getBeEndpoint() {
    return this.be_endpoint;
  }

  public TReplacePartitionRequest setBeEndpoint(@org.apache.thrift.annotation.Nullable java.lang.String be_endpoint) {
    this.be_endpoint = be_endpoint;
    return this;
  }

  public void unsetBeEndpoint() {
    this.be_endpoint = null;
  }

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

  public void setBeEndpointIsSet(boolean value) {
    if (!value) {
      this.be_endpoint = null;
    }
  }

  public boolean isWriteSingleReplica() {
    return this.write_single_replica;
  }

  public TReplacePartitionRequest setWriteSingleReplica(boolean write_single_replica) {
    this.write_single_replica = write_single_replica;
    setWriteSingleReplicaIsSet(true);
    return this;
  }

  public void unsetWriteSingleReplica() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __WRITE_SINGLE_REPLICA_ISSET_ID);
  }

  /** Returns true if field write_single_replica is set (has been assigned a value) and false otherwise */
  public boolean isSetWriteSingleReplica() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __WRITE_SINGLE_REPLICA_ISSET_ID);
  }

  public void setWriteSingleReplicaIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __WRITE_SINGLE_REPLICA_ISSET_ID, value);
  }

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

  public TReplacePartitionRequest 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 void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case OVERWRITE_GROUP_ID:
      if (value == null) {
        unsetOverwriteGroupId();
      } else {
        setOverwriteGroupId((java.lang.Long)value);
      }
      break;

    case DB_ID:
      if (value == null) {
        unsetDbId();
      } else {
        setDbId((java.lang.Long)value);
      }
      break;

    case TABLE_ID:
      if (value == null) {
        unsetTableId();
      } else {
        setTableId((java.lang.Long)value);
      }
      break;

    case PARTITION_IDS:
      if (value == null) {
        unsetPartitionIds();
      } else {
        setPartitionIds((java.util.List<java.lang.Long>)value);
      }
      break;

    case BE_ENDPOINT:
      if (value == null) {
        unsetBeEndpoint();
      } else {
        setBeEndpoint((java.lang.String)value);
      }
      break;

    case WRITE_SINGLE_REPLICA:
      if (value == null) {
        unsetWriteSingleReplica();
      } else {
        setWriteSingleReplica((java.lang.Boolean)value);
      }
      break;

    case QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((org.apache.doris.thrift.TUniqueId)value);
      }
      break;

    }
  }

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

    case DB_ID:
      return getDbId();

    case TABLE_ID:
      return getTableId();

    case PARTITION_IDS:
      return getPartitionIds();

    case BE_ENDPOINT:
      return getBeEndpoint();

    case WRITE_SINGLE_REPLICA:
      return isWriteSingleReplica();

    case QUERY_ID:
      return getQueryId();

    }
    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 OVERWRITE_GROUP_ID:
      return isSetOverwriteGroupId();
    case DB_ID:
      return isSetDbId();
    case TABLE_ID:
      return isSetTableId();
    case PARTITION_IDS:
      return isSetPartitionIds();
    case BE_ENDPOINT:
      return isSetBeEndpoint();
    case WRITE_SINGLE_REPLICA:
      return isSetWriteSingleReplica();
    case QUERY_ID:
      return isSetQueryId();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_overwrite_group_id = true && this.isSetOverwriteGroupId();
    boolean that_present_overwrite_group_id = true && that.isSetOverwriteGroupId();
    if (this_present_overwrite_group_id || that_present_overwrite_group_id) {
      if (!(this_present_overwrite_group_id && that_present_overwrite_group_id))
        return false;
      if (this.overwrite_group_id != that.overwrite_group_id)
        return false;
    }

    boolean this_present_db_id = true && this.isSetDbId();
    boolean that_present_db_id = true && that.isSetDbId();
    if (this_present_db_id || that_present_db_id) {
      if (!(this_present_db_id && that_present_db_id))
        return false;
      if (this.db_id != that.db_id)
        return false;
    }

    boolean this_present_table_id = true && this.isSetTableId();
    boolean that_present_table_id = true && that.isSetTableId();
    if (this_present_table_id || that_present_table_id) {
      if (!(this_present_table_id && that_present_table_id))
        return false;
      if (this.table_id != that.table_id)
        return false;
    }

    boolean this_present_partition_ids = true && this.isSetPartitionIds();
    boolean that_present_partition_ids = true && that.isSetPartitionIds();
    if (this_present_partition_ids || that_present_partition_ids) {
      if (!(this_present_partition_ids && that_present_partition_ids))
        return false;
      if (!this.partition_ids.equals(that.partition_ids))
        return false;
    }

    boolean this_present_be_endpoint = true && this.isSetBeEndpoint();
    boolean that_present_be_endpoint = true && that.isSetBeEndpoint();
    if (this_present_be_endpoint || that_present_be_endpoint) {
      if (!(this_present_be_endpoint && that_present_be_endpoint))
        return false;
      if (!this.be_endpoint.equals(that.be_endpoint))
        return false;
    }

    boolean this_present_write_single_replica = true && this.isSetWriteSingleReplica();
    boolean that_present_write_single_replica = true && that.isSetWriteSingleReplica();
    if (this_present_write_single_replica || that_present_write_single_replica) {
      if (!(this_present_write_single_replica && that_present_write_single_replica))
        return false;
      if (this.write_single_replica != that.write_single_replica)
        return false;
    }

    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;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetOverwriteGroupId()) ? 131071 : 524287);
    if (isSetOverwriteGroupId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(overwrite_group_id);

    hashCode = hashCode * 8191 + ((isSetDbId()) ? 131071 : 524287);
    if (isSetDbId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(db_id);

    hashCode = hashCode * 8191 + ((isSetTableId()) ? 131071 : 524287);
    if (isSetTableId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(table_id);

    hashCode = hashCode * 8191 + ((isSetPartitionIds()) ? 131071 : 524287);
    if (isSetPartitionIds())
      hashCode = hashCode * 8191 + partition_ids.hashCode();

    hashCode = hashCode * 8191 + ((isSetBeEndpoint()) ? 131071 : 524287);
    if (isSetBeEndpoint())
      hashCode = hashCode * 8191 + be_endpoint.hashCode();

    hashCode = hashCode * 8191 + ((isSetWriteSingleReplica()) ? 131071 : 524287);
    if (isSetWriteSingleReplica())
      hashCode = hashCode * 8191 + ((write_single_replica) ? 131071 : 524287);

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

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetOverwriteGroupId(), other.isSetOverwriteGroupId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOverwriteGroupId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.overwrite_group_id, other.overwrite_group_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDbId(), other.isSetDbId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.db_id, other.db_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTableId(), other.isSetTableId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTableId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table_id, other.table_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPartitionIds(), other.isSetPartitionIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartitionIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partition_ids, other.partition_ids);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBeEndpoint(), other.isSetBeEndpoint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBeEndpoint()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.be_endpoint, other.be_endpoint);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWriteSingleReplica(), other.isSetWriteSingleReplica());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWriteSingleReplica()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.write_single_replica, other.write_single_replica);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    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;
      }
    }
    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("TReplacePartitionRequest(");
    boolean first = true;

    if (isSetOverwriteGroupId()) {
      sb.append("overwrite_group_id:");
      sb.append(this.overwrite_group_id);
      first = false;
    }
    if (isSetDbId()) {
      if (!first) sb.append(", ");
      sb.append("db_id:");
      sb.append(this.db_id);
      first = false;
    }
    if (isSetTableId()) {
      if (!first) sb.append(", ");
      sb.append("table_id:");
      sb.append(this.table_id);
      first = false;
    }
    if (isSetPartitionIds()) {
      if (!first) sb.append(", ");
      sb.append("partition_ids:");
      if (this.partition_ids == null) {
        sb.append("null");
      } else {
        sb.append(this.partition_ids);
      }
      first = false;
    }
    if (isSetBeEndpoint()) {
      if (!first) sb.append(", ");
      sb.append("be_endpoint:");
      if (this.be_endpoint == null) {
        sb.append("null");
      } else {
        sb.append(this.be_endpoint);
      }
      first = false;
    }
    if (isSetWriteSingleReplica()) {
      if (!first) sb.append(", ");
      sb.append("write_single_replica:");
      sb.append(this.write_single_replica);
      first = false;
    }
    if (isSetQueryId()) {
      if (!first) sb.append(", ");
      sb.append("query_id:");
      if (this.query_id == null) {
        sb.append("null");
      } else {
        sb.append(this.query_id);
      }
      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 {
      // 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 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 TReplacePartitionRequestStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TReplacePartitionRequestStandardScheme getScheme() {
      return new TReplacePartitionRequestStandardScheme();
    }
  }

  private static class TReplacePartitionRequestStandardScheme extends org.apache.thrift.scheme.StandardScheme<TReplacePartitionRequest> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TReplacePartitionRequest 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: // OVERWRITE_GROUP_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.overwrite_group_id = iprot.readI64();
              struct.setOverwriteGroupIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DB_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.db_id = iprot.readI64();
              struct.setDbIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.table_id = iprot.readI64();
              struct.setTableIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PARTITION_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list682 = iprot.readListBegin();
                struct.partition_ids = new java.util.ArrayList<java.lang.Long>(_list682.size);
                long _elem683;
                for (int _i684 = 0; _i684 < _list682.size; ++_i684)
                {
                  _elem683 = iprot.readI64();
                  struct.partition_ids.add(_elem683);
                }
                iprot.readListEnd();
              }
              struct.setPartitionIdsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // BE_ENDPOINT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.be_endpoint = iprot.readString();
              struct.setBeEndpointIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // WRITE_SINGLE_REPLICA
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.write_single_replica = iprot.readBool();
              struct.setWriteSingleReplicaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // 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;
          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, TReplacePartitionRequest struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetOverwriteGroupId()) {
        oprot.writeFieldBegin(OVERWRITE_GROUP_ID_FIELD_DESC);
        oprot.writeI64(struct.overwrite_group_id);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDbId()) {
        oprot.writeFieldBegin(DB_ID_FIELD_DESC);
        oprot.writeI64(struct.db_id);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTableId()) {
        oprot.writeFieldBegin(TABLE_ID_FIELD_DESC);
        oprot.writeI64(struct.table_id);
        oprot.writeFieldEnd();
      }
      if (struct.partition_ids != null) {
        if (struct.isSetPartitionIds()) {
          oprot.writeFieldBegin(PARTITION_IDS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.partition_ids.size()));
            for (long _iter685 : struct.partition_ids)
            {
              oprot.writeI64(_iter685);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.be_endpoint != null) {
        if (struct.isSetBeEndpoint()) {
          oprot.writeFieldBegin(BE_ENDPOINT_FIELD_DESC);
          oprot.writeString(struct.be_endpoint);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetWriteSingleReplica()) {
        oprot.writeFieldBegin(WRITE_SINGLE_REPLICA_FIELD_DESC);
        oprot.writeBool(struct.write_single_replica);
        oprot.writeFieldEnd();
      }
      if (struct.query_id != null) {
        if (struct.isSetQueryId()) {
          oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
          struct.query_id.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TReplacePartitionRequestTupleScheme extends org.apache.thrift.scheme.TupleScheme<TReplacePartitionRequest> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TReplacePartitionRequest 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.isSetOverwriteGroupId()) {
        optionals.set(0);
      }
      if (struct.isSetDbId()) {
        optionals.set(1);
      }
      if (struct.isSetTableId()) {
        optionals.set(2);
      }
      if (struct.isSetPartitionIds()) {
        optionals.set(3);
      }
      if (struct.isSetBeEndpoint()) {
        optionals.set(4);
      }
      if (struct.isSetWriteSingleReplica()) {
        optionals.set(5);
      }
      if (struct.isSetQueryId()) {
        optionals.set(6);
      }
      oprot.writeBitSet(optionals, 7);
      if (struct.isSetOverwriteGroupId()) {
        oprot.writeI64(struct.overwrite_group_id);
      }
      if (struct.isSetDbId()) {
        oprot.writeI64(struct.db_id);
      }
      if (struct.isSetTableId()) {
        oprot.writeI64(struct.table_id);
      }
      if (struct.isSetPartitionIds()) {
        {
          oprot.writeI32(struct.partition_ids.size());
          for (long _iter686 : struct.partition_ids)
          {
            oprot.writeI64(_iter686);
          }
        }
      }
      if (struct.isSetBeEndpoint()) {
        oprot.writeString(struct.be_endpoint);
      }
      if (struct.isSetWriteSingleReplica()) {
        oprot.writeBool(struct.write_single_replica);
      }
      if (struct.isSetQueryId()) {
        struct.query_id.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TReplacePartitionRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(7);
      if (incoming.get(0)) {
        struct.overwrite_group_id = iprot.readI64();
        struct.setOverwriteGroupIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.db_id = iprot.readI64();
        struct.setDbIdIsSet(true);
      }
      if (incoming.get(2)) {
        struct.table_id = iprot.readI64();
        struct.setTableIdIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list687 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.partition_ids = new java.util.ArrayList<java.lang.Long>(_list687.size);
          long _elem688;
          for (int _i689 = 0; _i689 < _list687.size; ++_i689)
          {
            _elem688 = iprot.readI64();
            struct.partition_ids.add(_elem688);
          }
        }
        struct.setPartitionIdsIsSet(true);
      }
      if (incoming.get(4)) {
        struct.be_endpoint = iprot.readString();
        struct.setBeEndpointIsSet(true);
      }
      if (incoming.get(5)) {
        struct.write_single_replica = iprot.readBool();
        struct.setWriteSingleReplicaIsSet(true);
      }
      if (incoming.get(6)) {
        struct.query_id = new org.apache.doris.thrift.TUniqueId();
        struct.query_id.read(iprot);
        struct.setQueryIdIsSet(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();
  }
}