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

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField START_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("start_key", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField END_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("end_key", org.apache.thrift.protocol.TType.STRUCT, (short)3);
  private static final org.apache.thrift.protocol.TField NUM_BUCKETS_FIELD_DESC = new org.apache.thrift.protocol.TField("num_buckets", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField INDEXES_FIELD_DESC = new org.apache.thrift.protocol.TField("indexes", org.apache.thrift.protocol.TType.LIST, (short)5);
  private static final org.apache.thrift.protocol.TField START_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("start_keys", org.apache.thrift.protocol.TType.LIST, (short)6);
  private static final org.apache.thrift.protocol.TField END_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("end_keys", org.apache.thrift.protocol.TType.LIST, (short)7);
  private static final org.apache.thrift.protocol.TField IN_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("in_keys", org.apache.thrift.protocol.TType.LIST, (short)8);
  private static final org.apache.thrift.protocol.TField IS_MUTABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("is_mutable", org.apache.thrift.protocol.TType.BOOL, (short)9);
  private static final org.apache.thrift.protocol.TField IS_DEFAULT_PARTITION_FIELD_DESC = new org.apache.thrift.protocol.TField("is_default_partition", org.apache.thrift.protocol.TType.BOOL, (short)10);
  private static final org.apache.thrift.protocol.TField LOAD_TABLET_IDX_FIELD_DESC = new org.apache.thrift.protocol.TField("load_tablet_idx", org.apache.thrift.protocol.TType.I64, (short)11);
  private static final org.apache.thrift.protocol.TField TOTAL_REPLICA_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("total_replica_num", org.apache.thrift.protocol.TType.I32, (short)12);
  private static final org.apache.thrift.protocol.TField LOAD_REQUIRED_REPLICA_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("load_required_replica_num", org.apache.thrift.protocol.TType.I32, (short)13);
  private static final org.apache.thrift.protocol.TField TABLET_VERSION_GAP_BACKENDS_FIELD_DESC = new org.apache.thrift.protocol.TField("tablet_version_gap_backends", org.apache.thrift.protocol.TType.MAP, (short)14);

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

  public long id; // required
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode start_key; // optional
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode end_key; // optional
  public int num_buckets; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<TOlapTableIndexTablets> indexes; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> start_keys; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> end_keys; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExprNode>> in_keys; // optional
  public boolean is_mutable; // optional
  public boolean is_default_partition; // optional
  public long load_tablet_idx; // optional
  public int total_replica_num; // optional
  public int load_required_replica_num; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> tablet_version_gap_backends; // 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 {
    ID((short)1, "id"),
    START_KEY((short)2, "start_key"),
    END_KEY((short)3, "end_key"),
    NUM_BUCKETS((short)4, "num_buckets"),
    INDEXES((short)5, "indexes"),
    START_KEYS((short)6, "start_keys"),
    END_KEYS((short)7, "end_keys"),
    IN_KEYS((short)8, "in_keys"),
    IS_MUTABLE((short)9, "is_mutable"),
    IS_DEFAULT_PARTITION((short)10, "is_default_partition"),
    LOAD_TABLET_IDX((short)11, "load_tablet_idx"),
    TOTAL_REPLICA_NUM((short)12, "total_replica_num"),
    LOAD_REQUIRED_REPLICA_NUM((short)13, "load_required_replica_num"),
    TABLET_VERSION_GAP_BACKENDS((short)14, "tablet_version_gap_backends");

    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: // ID
          return ID;
        case 2: // START_KEY
          return START_KEY;
        case 3: // END_KEY
          return END_KEY;
        case 4: // NUM_BUCKETS
          return NUM_BUCKETS;
        case 5: // INDEXES
          return INDEXES;
        case 6: // START_KEYS
          return START_KEYS;
        case 7: // END_KEYS
          return END_KEYS;
        case 8: // IN_KEYS
          return IN_KEYS;
        case 9: // IS_MUTABLE
          return IS_MUTABLE;
        case 10: // IS_DEFAULT_PARTITION
          return IS_DEFAULT_PARTITION;
        case 11: // LOAD_TABLET_IDX
          return LOAD_TABLET_IDX;
        case 12: // TOTAL_REPLICA_NUM
          return TOTAL_REPLICA_NUM;
        case 13: // LOAD_REQUIRED_REPLICA_NUM
          return LOAD_REQUIRED_REPLICA_NUM;
        case 14: // TABLET_VERSION_GAP_BACKENDS
          return TABLET_VERSION_GAP_BACKENDS;
        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 __ID_ISSET_ID = 0;
  private static final int __NUM_BUCKETS_ISSET_ID = 1;
  private static final int __IS_MUTABLE_ISSET_ID = 2;
  private static final int __IS_DEFAULT_PARTITION_ISSET_ID = 3;
  private static final int __LOAD_TABLET_IDX_ISSET_ID = 4;
  private static final int __TOTAL_REPLICA_NUM_ISSET_ID = 5;
  private static final int __LOAD_REQUIRED_REPLICA_NUM_ISSET_ID = 6;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.START_KEY,_Fields.END_KEY,_Fields.START_KEYS,_Fields.END_KEYS,_Fields.IN_KEYS,_Fields.IS_MUTABLE,_Fields.IS_DEFAULT_PARTITION,_Fields.LOAD_TABLET_IDX,_Fields.TOTAL_REPLICA_NUM,_Fields.LOAD_REQUIRED_REPLICA_NUM,_Fields.TABLET_VERSION_GAP_BACKENDS};
  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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.START_KEY, new org.apache.thrift.meta_data.FieldMetaData("start_key", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TExprNode.class)));
    tmpMap.put(_Fields.END_KEY, new org.apache.thrift.meta_data.FieldMetaData("end_key", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TExprNode.class)));
    tmpMap.put(_Fields.NUM_BUCKETS, new org.apache.thrift.meta_data.FieldMetaData("num_buckets", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.INDEXES, new org.apache.thrift.meta_data.FieldMetaData("indexes", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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, TOlapTableIndexTablets.class))));
    tmpMap.put(_Fields.START_KEYS, new org.apache.thrift.meta_data.FieldMetaData("start_keys", 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.TExprNode.class))));
    tmpMap.put(_Fields.END_KEYS, new org.apache.thrift.meta_data.FieldMetaData("end_keys", 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.TExprNode.class))));
    tmpMap.put(_Fields.IN_KEYS, new org.apache.thrift.meta_data.FieldMetaData("in_keys", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            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.TExprNode.class)))));
    tmpMap.put(_Fields.IS_MUTABLE, new org.apache.thrift.meta_data.FieldMetaData("is_mutable", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_DEFAULT_PARTITION, new org.apache.thrift.meta_data.FieldMetaData("is_default_partition", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.LOAD_TABLET_IDX, new org.apache.thrift.meta_data.FieldMetaData("load_tablet_idx", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOTAL_REPLICA_NUM, new org.apache.thrift.meta_data.FieldMetaData("total_replica_num", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LOAD_REQUIRED_REPLICA_NUM, new org.apache.thrift.meta_data.FieldMetaData("load_required_replica_num", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TABLET_VERSION_GAP_BACKENDS, new org.apache.thrift.meta_data.FieldMetaData("tablet_version_gap_backends", 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.I64), 
            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)))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TOlapTablePartition.class, metaDataMap);
  }

  public TOlapTablePartition() {
    this.is_mutable = true;

  }

  public TOlapTablePartition(
    long id,
    int num_buckets,
    java.util.List<TOlapTableIndexTablets> indexes)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.num_buckets = num_buckets;
    setNumBucketsIsSet(true);
    this.indexes = indexes;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TOlapTablePartition(TOlapTablePartition other) {
    __isset_bitfield = other.__isset_bitfield;
    this.id = other.id;
    if (other.isSetStartKey()) {
      this.start_key = new org.apache.doris.thrift.TExprNode(other.start_key);
    }
    if (other.isSetEndKey()) {
      this.end_key = new org.apache.doris.thrift.TExprNode(other.end_key);
    }
    this.num_buckets = other.num_buckets;
    if (other.isSetIndexes()) {
      java.util.List<TOlapTableIndexTablets> __this__indexes = new java.util.ArrayList<TOlapTableIndexTablets>(other.indexes.size());
      for (TOlapTableIndexTablets other_element : other.indexes) {
        __this__indexes.add(new TOlapTableIndexTablets(other_element));
      }
      this.indexes = __this__indexes;
    }
    if (other.isSetStartKeys()) {
      java.util.List<org.apache.doris.thrift.TExprNode> __this__start_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(other.start_keys.size());
      for (org.apache.doris.thrift.TExprNode other_element : other.start_keys) {
        __this__start_keys.add(new org.apache.doris.thrift.TExprNode(other_element));
      }
      this.start_keys = __this__start_keys;
    }
    if (other.isSetEndKeys()) {
      java.util.List<org.apache.doris.thrift.TExprNode> __this__end_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(other.end_keys.size());
      for (org.apache.doris.thrift.TExprNode other_element : other.end_keys) {
        __this__end_keys.add(new org.apache.doris.thrift.TExprNode(other_element));
      }
      this.end_keys = __this__end_keys;
    }
    if (other.isSetInKeys()) {
      java.util.List<java.util.List<org.apache.doris.thrift.TExprNode>> __this__in_keys = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExprNode>>(other.in_keys.size());
      for (java.util.List<org.apache.doris.thrift.TExprNode> other_element : other.in_keys) {
        java.util.List<org.apache.doris.thrift.TExprNode> __this__in_keys_copy = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(other_element.size());
        for (org.apache.doris.thrift.TExprNode other_element_element : other_element) {
          __this__in_keys_copy.add(new org.apache.doris.thrift.TExprNode(other_element_element));
        }
        __this__in_keys.add(__this__in_keys_copy);
      }
      this.in_keys = __this__in_keys;
    }
    this.is_mutable = other.is_mutable;
    this.is_default_partition = other.is_default_partition;
    this.load_tablet_idx = other.load_tablet_idx;
    this.total_replica_num = other.total_replica_num;
    this.load_required_replica_num = other.load_required_replica_num;
    if (other.isSetTabletVersionGapBackends()) {
      java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> __this__tablet_version_gap_backends = new java.util.HashMap<java.lang.Long,java.util.List<java.lang.Long>>(other.tablet_version_gap_backends.size());
      for (java.util.Map.Entry<java.lang.Long, java.util.List<java.lang.Long>> other_element : other.tablet_version_gap_backends.entrySet()) {

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

        java.lang.Long __this__tablet_version_gap_backends_copy_key = other_element_key;

        java.util.List<java.lang.Long> __this__tablet_version_gap_backends_copy_value = new java.util.ArrayList<java.lang.Long>(other_element_value);

        __this__tablet_version_gap_backends.put(__this__tablet_version_gap_backends_copy_key, __this__tablet_version_gap_backends_copy_value);
      }
      this.tablet_version_gap_backends = __this__tablet_version_gap_backends;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.start_key = null;
    this.end_key = null;
    setNumBucketsIsSet(false);
    this.num_buckets = 0;
    this.indexes = null;
    this.start_keys = null;
    this.end_keys = null;
    this.in_keys = null;
    this.is_mutable = true;

    setIsDefaultPartitionIsSet(false);
    this.is_default_partition = false;
    setLoadTabletIdxIsSet(false);
    this.load_tablet_idx = 0;
    setTotalReplicaNumIsSet(false);
    this.total_replica_num = 0;
    setLoadRequiredReplicaNumIsSet(false);
    this.load_required_replica_num = 0;
    this.tablet_version_gap_backends = null;
  }

  public long getId() {
    return this.id;
  }

  public TOlapTablePartition setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TExprNode getStartKey() {
    return this.start_key;
  }

  public TOlapTablePartition setStartKey(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode start_key) {
    this.start_key = start_key;
    return this;
  }

  public void unsetStartKey() {
    this.start_key = null;
  }

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

  public void setStartKeyIsSet(boolean value) {
    if (!value) {
      this.start_key = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TExprNode getEndKey() {
    return this.end_key;
  }

  public TOlapTablePartition setEndKey(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode end_key) {
    this.end_key = end_key;
    return this;
  }

  public void unsetEndKey() {
    this.end_key = null;
  }

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

  public void setEndKeyIsSet(boolean value) {
    if (!value) {
      this.end_key = null;
    }
  }

  public int getNumBuckets() {
    return this.num_buckets;
  }

  public TOlapTablePartition setNumBuckets(int num_buckets) {
    this.num_buckets = num_buckets;
    setNumBucketsIsSet(true);
    return this;
  }

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

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<TOlapTableIndexTablets> getIndexesIterator() {
    return (this.indexes == null) ? null : this.indexes.iterator();
  }

  public void addToIndexes(TOlapTableIndexTablets elem) {
    if (this.indexes == null) {
      this.indexes = new java.util.ArrayList<TOlapTableIndexTablets>();
    }
    this.indexes.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<TOlapTableIndexTablets> getIndexes() {
    return this.indexes;
  }

  public TOlapTablePartition setIndexes(@org.apache.thrift.annotation.Nullable java.util.List<TOlapTableIndexTablets> indexes) {
    this.indexes = indexes;
    return this;
  }

  public void unsetIndexes() {
    this.indexes = null;
  }

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

  public void setIndexesIsSet(boolean value) {
    if (!value) {
      this.indexes = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TExprNode> getStartKeys() {
    return this.start_keys;
  }

  public TOlapTablePartition setStartKeys(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> start_keys) {
    this.start_keys = start_keys;
    return this;
  }

  public void unsetStartKeys() {
    this.start_keys = null;
  }

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

  public void setStartKeysIsSet(boolean value) {
    if (!value) {
      this.start_keys = null;
    }
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TExprNode> getEndKeys() {
    return this.end_keys;
  }

  public TOlapTablePartition setEndKeys(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> end_keys) {
    this.end_keys = end_keys;
    return this;
  }

  public void unsetEndKeys() {
    this.end_keys = null;
  }

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

  public void setEndKeysIsSet(boolean value) {
    if (!value) {
      this.end_keys = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.util.List<org.apache.doris.thrift.TExprNode>> getInKeysIterator() {
    return (this.in_keys == null) ? null : this.in_keys.iterator();
  }

  public void addToInKeys(java.util.List<org.apache.doris.thrift.TExprNode> elem) {
    if (this.in_keys == null) {
      this.in_keys = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExprNode>>();
    }
    this.in_keys.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.util.List<org.apache.doris.thrift.TExprNode>> getInKeys() {
    return this.in_keys;
  }

  public TOlapTablePartition setInKeys(@org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExprNode>> in_keys) {
    this.in_keys = in_keys;
    return this;
  }

  public void unsetInKeys() {
    this.in_keys = null;
  }

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

  public void setInKeysIsSet(boolean value) {
    if (!value) {
      this.in_keys = null;
    }
  }

  public boolean isIsMutable() {
    return this.is_mutable;
  }

  public TOlapTablePartition setIsMutable(boolean is_mutable) {
    this.is_mutable = is_mutable;
    setIsMutableIsSet(true);
    return this;
  }

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

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

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

  public boolean isIsDefaultPartition() {
    return this.is_default_partition;
  }

  public TOlapTablePartition setIsDefaultPartition(boolean is_default_partition) {
    this.is_default_partition = is_default_partition;
    setIsDefaultPartitionIsSet(true);
    return this;
  }

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

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

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

  public long getLoadTabletIdx() {
    return this.load_tablet_idx;
  }

  public TOlapTablePartition setLoadTabletIdx(long load_tablet_idx) {
    this.load_tablet_idx = load_tablet_idx;
    setLoadTabletIdxIsSet(true);
    return this;
  }

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

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

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

  public int getTotalReplicaNum() {
    return this.total_replica_num;
  }

  public TOlapTablePartition setTotalReplicaNum(int total_replica_num) {
    this.total_replica_num = total_replica_num;
    setTotalReplicaNumIsSet(true);
    return this;
  }

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

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

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

  public int getLoadRequiredReplicaNum() {
    return this.load_required_replica_num;
  }

  public TOlapTablePartition setLoadRequiredReplicaNum(int load_required_replica_num) {
    this.load_required_replica_num = load_required_replica_num;
    setLoadRequiredReplicaNumIsSet(true);
    return this;
  }

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

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

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

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

  public void putToTabletVersionGapBackends(long key, java.util.List<java.lang.Long> val) {
    if (this.tablet_version_gap_backends == null) {
      this.tablet_version_gap_backends = new java.util.HashMap<java.lang.Long,java.util.List<java.lang.Long>>();
    }
    this.tablet_version_gap_backends.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> getTabletVersionGapBackends() {
    return this.tablet_version_gap_backends;
  }

  public TOlapTablePartition setTabletVersionGapBackends(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> tablet_version_gap_backends) {
    this.tablet_version_gap_backends = tablet_version_gap_backends;
    return this;
  }

  public void unsetTabletVersionGapBackends() {
    this.tablet_version_gap_backends = null;
  }

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

  public void setTabletVersionGapBackendsIsSet(boolean value) {
    if (!value) {
      this.tablet_version_gap_backends = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((java.lang.Long)value);
      }
      break;

    case START_KEY:
      if (value == null) {
        unsetStartKey();
      } else {
        setStartKey((org.apache.doris.thrift.TExprNode)value);
      }
      break;

    case END_KEY:
      if (value == null) {
        unsetEndKey();
      } else {
        setEndKey((org.apache.doris.thrift.TExprNode)value);
      }
      break;

    case NUM_BUCKETS:
      if (value == null) {
        unsetNumBuckets();
      } else {
        setNumBuckets((java.lang.Integer)value);
      }
      break;

    case INDEXES:
      if (value == null) {
        unsetIndexes();
      } else {
        setIndexes((java.util.List<TOlapTableIndexTablets>)value);
      }
      break;

    case START_KEYS:
      if (value == null) {
        unsetStartKeys();
      } else {
        setStartKeys((java.util.List<org.apache.doris.thrift.TExprNode>)value);
      }
      break;

    case END_KEYS:
      if (value == null) {
        unsetEndKeys();
      } else {
        setEndKeys((java.util.List<org.apache.doris.thrift.TExprNode>)value);
      }
      break;

    case IN_KEYS:
      if (value == null) {
        unsetInKeys();
      } else {
        setInKeys((java.util.List<java.util.List<org.apache.doris.thrift.TExprNode>>)value);
      }
      break;

    case IS_MUTABLE:
      if (value == null) {
        unsetIsMutable();
      } else {
        setIsMutable((java.lang.Boolean)value);
      }
      break;

    case IS_DEFAULT_PARTITION:
      if (value == null) {
        unsetIsDefaultPartition();
      } else {
        setIsDefaultPartition((java.lang.Boolean)value);
      }
      break;

    case LOAD_TABLET_IDX:
      if (value == null) {
        unsetLoadTabletIdx();
      } else {
        setLoadTabletIdx((java.lang.Long)value);
      }
      break;

    case TOTAL_REPLICA_NUM:
      if (value == null) {
        unsetTotalReplicaNum();
      } else {
        setTotalReplicaNum((java.lang.Integer)value);
      }
      break;

    case LOAD_REQUIRED_REPLICA_NUM:
      if (value == null) {
        unsetLoadRequiredReplicaNum();
      } else {
        setLoadRequiredReplicaNum((java.lang.Integer)value);
      }
      break;

    case TABLET_VERSION_GAP_BACKENDS:
      if (value == null) {
        unsetTabletVersionGapBackends();
      } else {
        setTabletVersionGapBackends((java.util.Map<java.lang.Long,java.util.List<java.lang.Long>>)value);
      }
      break;

    }
  }

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

    case START_KEY:
      return getStartKey();

    case END_KEY:
      return getEndKey();

    case NUM_BUCKETS:
      return getNumBuckets();

    case INDEXES:
      return getIndexes();

    case START_KEYS:
      return getStartKeys();

    case END_KEYS:
      return getEndKeys();

    case IN_KEYS:
      return getInKeys();

    case IS_MUTABLE:
      return isIsMutable();

    case IS_DEFAULT_PARTITION:
      return isIsDefaultPartition();

    case LOAD_TABLET_IDX:
      return getLoadTabletIdx();

    case TOTAL_REPLICA_NUM:
      return getTotalReplicaNum();

    case LOAD_REQUIRED_REPLICA_NUM:
      return getLoadRequiredReplicaNum();

    case TABLET_VERSION_GAP_BACKENDS:
      return getTabletVersionGapBackends();

    }
    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 ID:
      return isSetId();
    case START_KEY:
      return isSetStartKey();
    case END_KEY:
      return isSetEndKey();
    case NUM_BUCKETS:
      return isSetNumBuckets();
    case INDEXES:
      return isSetIndexes();
    case START_KEYS:
      return isSetStartKeys();
    case END_KEYS:
      return isSetEndKeys();
    case IN_KEYS:
      return isSetInKeys();
    case IS_MUTABLE:
      return isSetIsMutable();
    case IS_DEFAULT_PARTITION:
      return isSetIsDefaultPartition();
    case LOAD_TABLET_IDX:
      return isSetLoadTabletIdx();
    case TOTAL_REPLICA_NUM:
      return isSetTotalReplicaNum();
    case LOAD_REQUIRED_REPLICA_NUM:
      return isSetLoadRequiredReplicaNum();
    case TABLET_VERSION_GAP_BACKENDS:
      return isSetTabletVersionGapBackends();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_start_key = true && this.isSetStartKey();
    boolean that_present_start_key = true && that.isSetStartKey();
    if (this_present_start_key || that_present_start_key) {
      if (!(this_present_start_key && that_present_start_key))
        return false;
      if (!this.start_key.equals(that.start_key))
        return false;
    }

    boolean this_present_end_key = true && this.isSetEndKey();
    boolean that_present_end_key = true && that.isSetEndKey();
    if (this_present_end_key || that_present_end_key) {
      if (!(this_present_end_key && that_present_end_key))
        return false;
      if (!this.end_key.equals(that.end_key))
        return false;
    }

    boolean this_present_num_buckets = true;
    boolean that_present_num_buckets = true;
    if (this_present_num_buckets || that_present_num_buckets) {
      if (!(this_present_num_buckets && that_present_num_buckets))
        return false;
      if (this.num_buckets != that.num_buckets)
        return false;
    }

    boolean this_present_indexes = true && this.isSetIndexes();
    boolean that_present_indexes = true && that.isSetIndexes();
    if (this_present_indexes || that_present_indexes) {
      if (!(this_present_indexes && that_present_indexes))
        return false;
      if (!this.indexes.equals(that.indexes))
        return false;
    }

    boolean this_present_start_keys = true && this.isSetStartKeys();
    boolean that_present_start_keys = true && that.isSetStartKeys();
    if (this_present_start_keys || that_present_start_keys) {
      if (!(this_present_start_keys && that_present_start_keys))
        return false;
      if (!this.start_keys.equals(that.start_keys))
        return false;
    }

    boolean this_present_end_keys = true && this.isSetEndKeys();
    boolean that_present_end_keys = true && that.isSetEndKeys();
    if (this_present_end_keys || that_present_end_keys) {
      if (!(this_present_end_keys && that_present_end_keys))
        return false;
      if (!this.end_keys.equals(that.end_keys))
        return false;
    }

    boolean this_present_in_keys = true && this.isSetInKeys();
    boolean that_present_in_keys = true && that.isSetInKeys();
    if (this_present_in_keys || that_present_in_keys) {
      if (!(this_present_in_keys && that_present_in_keys))
        return false;
      if (!this.in_keys.equals(that.in_keys))
        return false;
    }

    boolean this_present_is_mutable = true && this.isSetIsMutable();
    boolean that_present_is_mutable = true && that.isSetIsMutable();
    if (this_present_is_mutable || that_present_is_mutable) {
      if (!(this_present_is_mutable && that_present_is_mutable))
        return false;
      if (this.is_mutable != that.is_mutable)
        return false;
    }

    boolean this_present_is_default_partition = true && this.isSetIsDefaultPartition();
    boolean that_present_is_default_partition = true && that.isSetIsDefaultPartition();
    if (this_present_is_default_partition || that_present_is_default_partition) {
      if (!(this_present_is_default_partition && that_present_is_default_partition))
        return false;
      if (this.is_default_partition != that.is_default_partition)
        return false;
    }

    boolean this_present_load_tablet_idx = true && this.isSetLoadTabletIdx();
    boolean that_present_load_tablet_idx = true && that.isSetLoadTabletIdx();
    if (this_present_load_tablet_idx || that_present_load_tablet_idx) {
      if (!(this_present_load_tablet_idx && that_present_load_tablet_idx))
        return false;
      if (this.load_tablet_idx != that.load_tablet_idx)
        return false;
    }

    boolean this_present_total_replica_num = true && this.isSetTotalReplicaNum();
    boolean that_present_total_replica_num = true && that.isSetTotalReplicaNum();
    if (this_present_total_replica_num || that_present_total_replica_num) {
      if (!(this_present_total_replica_num && that_present_total_replica_num))
        return false;
      if (this.total_replica_num != that.total_replica_num)
        return false;
    }

    boolean this_present_load_required_replica_num = true && this.isSetLoadRequiredReplicaNum();
    boolean that_present_load_required_replica_num = true && that.isSetLoadRequiredReplicaNum();
    if (this_present_load_required_replica_num || that_present_load_required_replica_num) {
      if (!(this_present_load_required_replica_num && that_present_load_required_replica_num))
        return false;
      if (this.load_required_replica_num != that.load_required_replica_num)
        return false;
    }

    boolean this_present_tablet_version_gap_backends = true && this.isSetTabletVersionGapBackends();
    boolean that_present_tablet_version_gap_backends = true && that.isSetTabletVersionGapBackends();
    if (this_present_tablet_version_gap_backends || that_present_tablet_version_gap_backends) {
      if (!(this_present_tablet_version_gap_backends && that_present_tablet_version_gap_backends))
        return false;
      if (!this.tablet_version_gap_backends.equals(that.tablet_version_gap_backends))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);

    hashCode = hashCode * 8191 + ((isSetStartKey()) ? 131071 : 524287);
    if (isSetStartKey())
      hashCode = hashCode * 8191 + start_key.hashCode();

    hashCode = hashCode * 8191 + ((isSetEndKey()) ? 131071 : 524287);
    if (isSetEndKey())
      hashCode = hashCode * 8191 + end_key.hashCode();

    hashCode = hashCode * 8191 + num_buckets;

    hashCode = hashCode * 8191 + ((isSetIndexes()) ? 131071 : 524287);
    if (isSetIndexes())
      hashCode = hashCode * 8191 + indexes.hashCode();

    hashCode = hashCode * 8191 + ((isSetStartKeys()) ? 131071 : 524287);
    if (isSetStartKeys())
      hashCode = hashCode * 8191 + start_keys.hashCode();

    hashCode = hashCode * 8191 + ((isSetEndKeys()) ? 131071 : 524287);
    if (isSetEndKeys())
      hashCode = hashCode * 8191 + end_keys.hashCode();

    hashCode = hashCode * 8191 + ((isSetInKeys()) ? 131071 : 524287);
    if (isSetInKeys())
      hashCode = hashCode * 8191 + in_keys.hashCode();

    hashCode = hashCode * 8191 + ((isSetIsMutable()) ? 131071 : 524287);
    if (isSetIsMutable())
      hashCode = hashCode * 8191 + ((is_mutable) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetIsDefaultPartition()) ? 131071 : 524287);
    if (isSetIsDefaultPartition())
      hashCode = hashCode * 8191 + ((is_default_partition) ? 131071 : 524287);

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

    hashCode = hashCode * 8191 + ((isSetTotalReplicaNum()) ? 131071 : 524287);
    if (isSetTotalReplicaNum())
      hashCode = hashCode * 8191 + total_replica_num;

    hashCode = hashCode * 8191 + ((isSetLoadRequiredReplicaNum()) ? 131071 : 524287);
    if (isSetLoadRequiredReplicaNum())
      hashCode = hashCode * 8191 + load_required_replica_num;

    hashCode = hashCode * 8191 + ((isSetTabletVersionGapBackends()) ? 131071 : 524287);
    if (isSetTabletVersionGapBackends())
      hashCode = hashCode * 8191 + tablet_version_gap_backends.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStartKey(), other.isSetStartKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_key, other.start_key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEndKey(), other.isSetEndKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_key, other.end_key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNumBuckets(), other.isSetNumBuckets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumBuckets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_buckets, other.num_buckets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIndexes(), other.isSetIndexes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndexes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexes, other.indexes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStartKeys(), other.isSetStartKeys());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartKeys()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_keys, other.start_keys);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEndKeys(), other.isSetEndKeys());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndKeys()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_keys, other.end_keys);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetInKeys(), other.isSetInKeys());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInKeys()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.in_keys, other.in_keys);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsMutable(), other.isSetIsMutable());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsMutable()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_mutable, other.is_mutable);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsDefaultPartition(), other.isSetIsDefaultPartition());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsDefaultPartition()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_default_partition, other.is_default_partition);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetLoadTabletIdx(), other.isSetLoadTabletIdx());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoadTabletIdx()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.load_tablet_idx, other.load_tablet_idx);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTotalReplicaNum(), other.isSetTotalReplicaNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalReplicaNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_replica_num, other.total_replica_num);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetLoadRequiredReplicaNum(), other.isSetLoadRequiredReplicaNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoadRequiredReplicaNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.load_required_replica_num, other.load_required_replica_num);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTabletVersionGapBackends(), other.isSetTabletVersionGapBackends());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTabletVersionGapBackends()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablet_version_gap_backends, other.tablet_version_gap_backends);
      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("TOlapTablePartition(");
    boolean first = true;

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (isSetStartKey()) {
      if (!first) sb.append(", ");
      sb.append("start_key:");
      if (this.start_key == null) {
        sb.append("null");
      } else {
        sb.append(this.start_key);
      }
      first = false;
    }
    if (isSetEndKey()) {
      if (!first) sb.append(", ");
      sb.append("end_key:");
      if (this.end_key == null) {
        sb.append("null");
      } else {
        sb.append(this.end_key);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("num_buckets:");
    sb.append(this.num_buckets);
    first = false;
    if (!first) sb.append(", ");
    sb.append("indexes:");
    if (this.indexes == null) {
      sb.append("null");
    } else {
      sb.append(this.indexes);
    }
    first = false;
    if (isSetStartKeys()) {
      if (!first) sb.append(", ");
      sb.append("start_keys:");
      if (this.start_keys == null) {
        sb.append("null");
      } else {
        sb.append(this.start_keys);
      }
      first = false;
    }
    if (isSetEndKeys()) {
      if (!first) sb.append(", ");
      sb.append("end_keys:");
      if (this.end_keys == null) {
        sb.append("null");
      } else {
        sb.append(this.end_keys);
      }
      first = false;
    }
    if (isSetInKeys()) {
      if (!first) sb.append(", ");
      sb.append("in_keys:");
      if (this.in_keys == null) {
        sb.append("null");
      } else {
        sb.append(this.in_keys);
      }
      first = false;
    }
    if (isSetIsMutable()) {
      if (!first) sb.append(", ");
      sb.append("is_mutable:");
      sb.append(this.is_mutable);
      first = false;
    }
    if (isSetIsDefaultPartition()) {
      if (!first) sb.append(", ");
      sb.append("is_default_partition:");
      sb.append(this.is_default_partition);
      first = false;
    }
    if (isSetLoadTabletIdx()) {
      if (!first) sb.append(", ");
      sb.append("load_tablet_idx:");
      sb.append(this.load_tablet_idx);
      first = false;
    }
    if (isSetTotalReplicaNum()) {
      if (!first) sb.append(", ");
      sb.append("total_replica_num:");
      sb.append(this.total_replica_num);
      first = false;
    }
    if (isSetLoadRequiredReplicaNum()) {
      if (!first) sb.append(", ");
      sb.append("load_required_replica_num:");
      sb.append(this.load_required_replica_num);
      first = false;
    }
    if (isSetTabletVersionGapBackends()) {
      if (!first) sb.append(", ");
      sb.append("tablet_version_gap_backends:");
      if (this.tablet_version_gap_backends == null) {
        sb.append("null");
      } else {
        sb.append(this.tablet_version_gap_backends);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'id' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'num_buckets' because it's a primitive and you chose the non-beans generator.
    if (indexes == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'indexes' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (start_key != null) {
      start_key.validate();
    }
    if (end_key != null) {
      end_key.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 TOlapTablePartitionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TOlapTablePartitionStandardScheme getScheme() {
      return new TOlapTablePartitionStandardScheme();
    }
  }

  private static class TOlapTablePartitionStandardScheme extends org.apache.thrift.scheme.StandardScheme<TOlapTablePartition> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TOlapTablePartition 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: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.id = iprot.readI64();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // START_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.start_key = new org.apache.doris.thrift.TExprNode();
              struct.start_key.read(iprot);
              struct.setStartKeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // END_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.end_key = new org.apache.doris.thrift.TExprNode();
              struct.end_key.read(iprot);
              struct.setEndKeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // NUM_BUCKETS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.num_buckets = iprot.readI32();
              struct.setNumBucketsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // INDEXES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list56 = iprot.readListBegin();
                struct.indexes = new java.util.ArrayList<TOlapTableIndexTablets>(_list56.size);
                @org.apache.thrift.annotation.Nullable TOlapTableIndexTablets _elem57;
                for (int _i58 = 0; _i58 < _list56.size; ++_i58)
                {
                  _elem57 = new TOlapTableIndexTablets();
                  _elem57.read(iprot);
                  struct.indexes.add(_elem57);
                }
                iprot.readListEnd();
              }
              struct.setIndexesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // START_KEYS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list59 = iprot.readListBegin();
                struct.start_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list59.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem60;
                for (int _i61 = 0; _i61 < _list59.size; ++_i61)
                {
                  _elem60 = new org.apache.doris.thrift.TExprNode();
                  _elem60.read(iprot);
                  struct.start_keys.add(_elem60);
                }
                iprot.readListEnd();
              }
              struct.setStartKeysIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // END_KEYS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
                struct.end_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list62.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem63;
                for (int _i64 = 0; _i64 < _list62.size; ++_i64)
                {
                  _elem63 = new org.apache.doris.thrift.TExprNode();
                  _elem63.read(iprot);
                  struct.end_keys.add(_elem63);
                }
                iprot.readListEnd();
              }
              struct.setEndKeysIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // IN_KEYS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list65 = iprot.readListBegin();
                struct.in_keys = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExprNode>>(_list65.size);
                @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> _elem66;
                for (int _i67 = 0; _i67 < _list65.size; ++_i67)
                {
                  {
                    org.apache.thrift.protocol.TList _list68 = iprot.readListBegin();
                    _elem66 = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list68.size);
                    @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem69;
                    for (int _i70 = 0; _i70 < _list68.size; ++_i70)
                    {
                      _elem69 = new org.apache.doris.thrift.TExprNode();
                      _elem69.read(iprot);
                      _elem66.add(_elem69);
                    }
                    iprot.readListEnd();
                  }
                  struct.in_keys.add(_elem66);
                }
                iprot.readListEnd();
              }
              struct.setInKeysIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // IS_MUTABLE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_mutable = iprot.readBool();
              struct.setIsMutableIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // IS_DEFAULT_PARTITION
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_default_partition = iprot.readBool();
              struct.setIsDefaultPartitionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // LOAD_TABLET_IDX
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.load_tablet_idx = iprot.readI64();
              struct.setLoadTabletIdxIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // TOTAL_REPLICA_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.total_replica_num = iprot.readI32();
              struct.setTotalReplicaNumIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // LOAD_REQUIRED_REPLICA_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.load_required_replica_num = iprot.readI32();
              struct.setLoadRequiredReplicaNumIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // TABLET_VERSION_GAP_BACKENDS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map71 = iprot.readMapBegin();
                struct.tablet_version_gap_backends = new java.util.HashMap<java.lang.Long,java.util.List<java.lang.Long>>(2*_map71.size);
                long _key72;
                @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> _val73;
                for (int _i74 = 0; _i74 < _map71.size; ++_i74)
                {
                  _key72 = iprot.readI64();
                  {
                    org.apache.thrift.protocol.TList _list75 = iprot.readListBegin();
                    _val73 = new java.util.ArrayList<java.lang.Long>(_list75.size);
                    long _elem76;
                    for (int _i77 = 0; _i77 < _list75.size; ++_i77)
                    {
                      _elem76 = iprot.readI64();
                      _val73.add(_elem76);
                    }
                    iprot.readListEnd();
                  }
                  struct.tablet_version_gap_backends.put(_key72, _val73);
                }
                iprot.readMapEnd();
              }
              struct.setTabletVersionGapBackendsIsSet(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
      if (!struct.isSetId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetNumBuckets()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'num_buckets' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ID_FIELD_DESC);
      oprot.writeI64(struct.id);
      oprot.writeFieldEnd();
      if (struct.start_key != null) {
        if (struct.isSetStartKey()) {
          oprot.writeFieldBegin(START_KEY_FIELD_DESC);
          struct.start_key.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.end_key != null) {
        if (struct.isSetEndKey()) {
          oprot.writeFieldBegin(END_KEY_FIELD_DESC);
          struct.end_key.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldBegin(NUM_BUCKETS_FIELD_DESC);
      oprot.writeI32(struct.num_buckets);
      oprot.writeFieldEnd();
      if (struct.indexes != null) {
        oprot.writeFieldBegin(INDEXES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.indexes.size()));
          for (TOlapTableIndexTablets _iter78 : struct.indexes)
          {
            _iter78.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.start_keys != null) {
        if (struct.isSetStartKeys()) {
          oprot.writeFieldBegin(START_KEYS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.start_keys.size()));
            for (org.apache.doris.thrift.TExprNode _iter79 : struct.start_keys)
            {
              _iter79.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.end_keys != null) {
        if (struct.isSetEndKeys()) {
          oprot.writeFieldBegin(END_KEYS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.end_keys.size()));
            for (org.apache.doris.thrift.TExprNode _iter80 : struct.end_keys)
            {
              _iter80.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.in_keys != null) {
        if (struct.isSetInKeys()) {
          oprot.writeFieldBegin(IN_KEYS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.in_keys.size()));
            for (java.util.List<org.apache.doris.thrift.TExprNode> _iter81 : struct.in_keys)
            {
              {
                oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter81.size()));
                for (org.apache.doris.thrift.TExprNode _iter82 : _iter81)
                {
                  _iter82.write(oprot);
                }
                oprot.writeListEnd();
              }
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIsMutable()) {
        oprot.writeFieldBegin(IS_MUTABLE_FIELD_DESC);
        oprot.writeBool(struct.is_mutable);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsDefaultPartition()) {
        oprot.writeFieldBegin(IS_DEFAULT_PARTITION_FIELD_DESC);
        oprot.writeBool(struct.is_default_partition);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLoadTabletIdx()) {
        oprot.writeFieldBegin(LOAD_TABLET_IDX_FIELD_DESC);
        oprot.writeI64(struct.load_tablet_idx);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTotalReplicaNum()) {
        oprot.writeFieldBegin(TOTAL_REPLICA_NUM_FIELD_DESC);
        oprot.writeI32(struct.total_replica_num);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLoadRequiredReplicaNum()) {
        oprot.writeFieldBegin(LOAD_REQUIRED_REPLICA_NUM_FIELD_DESC);
        oprot.writeI32(struct.load_required_replica_num);
        oprot.writeFieldEnd();
      }
      if (struct.tablet_version_gap_backends != null) {
        if (struct.isSetTabletVersionGapBackends()) {
          oprot.writeFieldBegin(TABLET_VERSION_GAP_BACKENDS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.LIST, struct.tablet_version_gap_backends.size()));
            for (java.util.Map.Entry<java.lang.Long, java.util.List<java.lang.Long>> _iter83 : struct.tablet_version_gap_backends.entrySet())
            {
              oprot.writeI64(_iter83.getKey());
              {
                oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, _iter83.getValue().size()));
                for (long _iter84 : _iter83.getValue())
                {
                  oprot.writeI64(_iter84);
                }
                oprot.writeListEnd();
              }
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TOlapTablePartitionTupleScheme extends org.apache.thrift.scheme.TupleScheme<TOlapTablePartition> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TOlapTablePartition struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.id);
      oprot.writeI32(struct.num_buckets);
      {
        oprot.writeI32(struct.indexes.size());
        for (TOlapTableIndexTablets _iter85 : struct.indexes)
        {
          _iter85.write(oprot);
        }
      }
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetStartKey()) {
        optionals.set(0);
      }
      if (struct.isSetEndKey()) {
        optionals.set(1);
      }
      if (struct.isSetStartKeys()) {
        optionals.set(2);
      }
      if (struct.isSetEndKeys()) {
        optionals.set(3);
      }
      if (struct.isSetInKeys()) {
        optionals.set(4);
      }
      if (struct.isSetIsMutable()) {
        optionals.set(5);
      }
      if (struct.isSetIsDefaultPartition()) {
        optionals.set(6);
      }
      if (struct.isSetLoadTabletIdx()) {
        optionals.set(7);
      }
      if (struct.isSetTotalReplicaNum()) {
        optionals.set(8);
      }
      if (struct.isSetLoadRequiredReplicaNum()) {
        optionals.set(9);
      }
      if (struct.isSetTabletVersionGapBackends()) {
        optionals.set(10);
      }
      oprot.writeBitSet(optionals, 11);
      if (struct.isSetStartKey()) {
        struct.start_key.write(oprot);
      }
      if (struct.isSetEndKey()) {
        struct.end_key.write(oprot);
      }
      if (struct.isSetStartKeys()) {
        {
          oprot.writeI32(struct.start_keys.size());
          for (org.apache.doris.thrift.TExprNode _iter86 : struct.start_keys)
          {
            _iter86.write(oprot);
          }
        }
      }
      if (struct.isSetEndKeys()) {
        {
          oprot.writeI32(struct.end_keys.size());
          for (org.apache.doris.thrift.TExprNode _iter87 : struct.end_keys)
          {
            _iter87.write(oprot);
          }
        }
      }
      if (struct.isSetInKeys()) {
        {
          oprot.writeI32(struct.in_keys.size());
          for (java.util.List<org.apache.doris.thrift.TExprNode> _iter88 : struct.in_keys)
          {
            {
              oprot.writeI32(_iter88.size());
              for (org.apache.doris.thrift.TExprNode _iter89 : _iter88)
              {
                _iter89.write(oprot);
              }
            }
          }
        }
      }
      if (struct.isSetIsMutable()) {
        oprot.writeBool(struct.is_mutable);
      }
      if (struct.isSetIsDefaultPartition()) {
        oprot.writeBool(struct.is_default_partition);
      }
      if (struct.isSetLoadTabletIdx()) {
        oprot.writeI64(struct.load_tablet_idx);
      }
      if (struct.isSetTotalReplicaNum()) {
        oprot.writeI32(struct.total_replica_num);
      }
      if (struct.isSetLoadRequiredReplicaNum()) {
        oprot.writeI32(struct.load_required_replica_num);
      }
      if (struct.isSetTabletVersionGapBackends()) {
        {
          oprot.writeI32(struct.tablet_version_gap_backends.size());
          for (java.util.Map.Entry<java.lang.Long, java.util.List<java.lang.Long>> _iter90 : struct.tablet_version_gap_backends.entrySet())
          {
            oprot.writeI64(_iter90.getKey());
            {
              oprot.writeI32(_iter90.getValue().size());
              for (long _iter91 : _iter90.getValue())
              {
                oprot.writeI64(_iter91);
              }
            }
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TOlapTablePartition struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.id = iprot.readI64();
      struct.setIdIsSet(true);
      struct.num_buckets = iprot.readI32();
      struct.setNumBucketsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list92 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.indexes = new java.util.ArrayList<TOlapTableIndexTablets>(_list92.size);
        @org.apache.thrift.annotation.Nullable TOlapTableIndexTablets _elem93;
        for (int _i94 = 0; _i94 < _list92.size; ++_i94)
        {
          _elem93 = new TOlapTableIndexTablets();
          _elem93.read(iprot);
          struct.indexes.add(_elem93);
        }
      }
      struct.setIndexesIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(11);
      if (incoming.get(0)) {
        struct.start_key = new org.apache.doris.thrift.TExprNode();
        struct.start_key.read(iprot);
        struct.setStartKeyIsSet(true);
      }
      if (incoming.get(1)) {
        struct.end_key = new org.apache.doris.thrift.TExprNode();
        struct.end_key.read(iprot);
        struct.setEndKeyIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list95 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.start_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list95.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem96;
          for (int _i97 = 0; _i97 < _list95.size; ++_i97)
          {
            _elem96 = new org.apache.doris.thrift.TExprNode();
            _elem96.read(iprot);
            struct.start_keys.add(_elem96);
          }
        }
        struct.setStartKeysIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list98 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.end_keys = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list98.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem99;
          for (int _i100 = 0; _i100 < _list98.size; ++_i100)
          {
            _elem99 = new org.apache.doris.thrift.TExprNode();
            _elem99.read(iprot);
            struct.end_keys.add(_elem99);
          }
        }
        struct.setEndKeysIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list101 = iprot.readListBegin(org.apache.thrift.protocol.TType.LIST);
          struct.in_keys = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExprNode>>(_list101.size);
          @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExprNode> _elem102;
          for (int _i103 = 0; _i103 < _list101.size; ++_i103)
          {
            {
              org.apache.thrift.protocol.TList _list104 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
              _elem102 = new java.util.ArrayList<org.apache.doris.thrift.TExprNode>(_list104.size);
              @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExprNode _elem105;
              for (int _i106 = 0; _i106 < _list104.size; ++_i106)
              {
                _elem105 = new org.apache.doris.thrift.TExprNode();
                _elem105.read(iprot);
                _elem102.add(_elem105);
              }
            }
            struct.in_keys.add(_elem102);
          }
        }
        struct.setInKeysIsSet(true);
      }
      if (incoming.get(5)) {
        struct.is_mutable = iprot.readBool();
        struct.setIsMutableIsSet(true);
      }
      if (incoming.get(6)) {
        struct.is_default_partition = iprot.readBool();
        struct.setIsDefaultPartitionIsSet(true);
      }
      if (incoming.get(7)) {
        struct.load_tablet_idx = iprot.readI64();
        struct.setLoadTabletIdxIsSet(true);
      }
      if (incoming.get(8)) {
        struct.total_replica_num = iprot.readI32();
        struct.setTotalReplicaNumIsSet(true);
      }
      if (incoming.get(9)) {
        struct.load_required_replica_num = iprot.readI32();
        struct.setLoadRequiredReplicaNumIsSet(true);
      }
      if (incoming.get(10)) {
        {
          org.apache.thrift.protocol.TMap _map107 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.LIST); 
          struct.tablet_version_gap_backends = new java.util.HashMap<java.lang.Long,java.util.List<java.lang.Long>>(2*_map107.size);
          long _key108;
          @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> _val109;
          for (int _i110 = 0; _i110 < _map107.size; ++_i110)
          {
            _key108 = iprot.readI64();
            {
              org.apache.thrift.protocol.TList _list111 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
              _val109 = new java.util.ArrayList<java.lang.Long>(_list111.size);
              long _elem112;
              for (int _i113 = 0; _i113 < _list111.size; ++_i113)
              {
                _elem112 = iprot.readI64();
                _val109.add(_elem112);
              }
            }
            struct.tablet_version_gap_backends.put(_key108, _val109);
          }
        }
        struct.setTabletVersionGapBackendsIsSet(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();
  }
}