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

  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)1);
  private static final org.apache.thrift.protocol.TField INDEX_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("index_id", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField HOT_PARTITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("hot_partitions", org.apache.thrift.protocol.TType.LIST, (short)3);

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

  public long table_id; // required
  public long index_id; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<THotPartition> hot_partitions; // 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 {
    TABLE_ID((short)1, "table_id"),
    INDEX_ID((short)2, "index_id"),
    HOT_PARTITIONS((short)3, "hot_partitions");

    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: // TABLE_ID
          return TABLE_ID;
        case 2: // INDEX_ID
          return INDEX_ID;
        case 3: // HOT_PARTITIONS
          return HOT_PARTITIONS;
        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 __TABLE_ID_ISSET_ID = 0;
  private static final int __INDEX_ID_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.HOT_PARTITIONS};
  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.TABLE_ID, new org.apache.thrift.meta_data.FieldMetaData("table_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.INDEX_ID, new org.apache.thrift.meta_data.FieldMetaData("index_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.HOT_PARTITIONS, new org.apache.thrift.meta_data.FieldMetaData("hot_partitions", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, THotPartition.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(THotTableMessage.class, metaDataMap);
  }

  public THotTableMessage() {
  }

  public THotTableMessage(
    long table_id,
    long index_id)
  {
    this();
    this.table_id = table_id;
    setTableIdIsSet(true);
    this.index_id = index_id;
    setIndexIdIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public THotTableMessage(THotTableMessage other) {
    __isset_bitfield = other.__isset_bitfield;
    this.table_id = other.table_id;
    this.index_id = other.index_id;
    if (other.isSetHotPartitions()) {
      java.util.List<THotPartition> __this__hot_partitions = new java.util.ArrayList<THotPartition>(other.hot_partitions.size());
      for (THotPartition other_element : other.hot_partitions) {
        __this__hot_partitions.add(new THotPartition(other_element));
      }
      this.hot_partitions = __this__hot_partitions;
    }
  }

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

  @Override
  public void clear() {
    setTableIdIsSet(false);
    this.table_id = 0;
    setIndexIdIsSet(false);
    this.index_id = 0;
    this.hot_partitions = null;
  }

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

  public THotTableMessage 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 long getIndexId() {
    return this.index_id;
  }

  public THotTableMessage setIndexId(long index_id) {
    this.index_id = index_id;
    setIndexIdIsSet(true);
    return this;
  }

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

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

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

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

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

  public void addToHotPartitions(THotPartition elem) {
    if (this.hot_partitions == null) {
      this.hot_partitions = new java.util.ArrayList<THotPartition>();
    }
    this.hot_partitions.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<THotPartition> getHotPartitions() {
    return this.hot_partitions;
  }

  public THotTableMessage setHotPartitions(@org.apache.thrift.annotation.Nullable java.util.List<THotPartition> hot_partitions) {
    this.hot_partitions = hot_partitions;
    return this;
  }

  public void unsetHotPartitions() {
    this.hot_partitions = null;
  }

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

  public void setHotPartitionsIsSet(boolean value) {
    if (!value) {
      this.hot_partitions = null;
    }
  }

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

    case INDEX_ID:
      if (value == null) {
        unsetIndexId();
      } else {
        setIndexId((java.lang.Long)value);
      }
      break;

    case HOT_PARTITIONS:
      if (value == null) {
        unsetHotPartitions();
      } else {
        setHotPartitions((java.util.List<THotPartition>)value);
      }
      break;

    }
  }

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

    case INDEX_ID:
      return getIndexId();

    case HOT_PARTITIONS:
      return getHotPartitions();

    }
    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 TABLE_ID:
      return isSetTableId();
    case INDEX_ID:
      return isSetIndexId();
    case HOT_PARTITIONS:
      return isSetHotPartitions();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_table_id = true;
    boolean that_present_table_id = true;
    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_index_id = true;
    boolean that_present_index_id = true;
    if (this_present_index_id || that_present_index_id) {
      if (!(this_present_index_id && that_present_index_id))
        return false;
      if (this.index_id != that.index_id)
        return false;
    }

    boolean this_present_hot_partitions = true && this.isSetHotPartitions();
    boolean that_present_hot_partitions = true && that.isSetHotPartitions();
    if (this_present_hot_partitions || that_present_hot_partitions) {
      if (!(this_present_hot_partitions && that_present_hot_partitions))
        return false;
      if (!this.hot_partitions.equals(that.hot_partitions))
        return false;
    }

    return true;
  }

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

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

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

    hashCode = hashCode * 8191 + ((isSetHotPartitions()) ? 131071 : 524287);
    if (isSetHotPartitions())
      hashCode = hashCode * 8191 + hot_partitions.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    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(isSetIndexId(), other.isSetIndexId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndexId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_id, other.index_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHotPartitions(), other.isSetHotPartitions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHotPartitions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hot_partitions, other.hot_partitions);
      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("THotTableMessage(");
    boolean first = true;

    sb.append("table_id:");
    sb.append(this.table_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("index_id:");
    sb.append(this.index_id);
    first = false;
    if (isSetHotPartitions()) {
      if (!first) sb.append(", ");
      sb.append("hot_partitions:");
      if (this.hot_partitions == null) {
        sb.append("null");
      } else {
        sb.append(this.hot_partitions);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'table_id' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'index_id' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

  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 THotTableMessageStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public THotTableMessageStandardScheme getScheme() {
      return new THotTableMessageStandardScheme();
    }
  }

  private static class THotTableMessageStandardScheme extends org.apache.thrift.scheme.StandardScheme<THotTableMessage> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, THotTableMessage 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: // 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 2: // INDEX_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.index_id = iprot.readI64();
              struct.setIndexIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // HOT_PARTITIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list106 = iprot.readListBegin();
                struct.hot_partitions = new java.util.ArrayList<THotPartition>(_list106.size);
                @org.apache.thrift.annotation.Nullable THotPartition _elem107;
                for (int _i108 = 0; _i108 < _list106.size; ++_i108)
                {
                  _elem107 = new THotPartition();
                  _elem107.read(iprot);
                  struct.hot_partitions.add(_elem107);
                }
                iprot.readListEnd();
              }
              struct.setHotPartitionsIsSet(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.isSetTableId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'table_id' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetIndexId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'index_id' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(TABLE_ID_FIELD_DESC);
      oprot.writeI64(struct.table_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(INDEX_ID_FIELD_DESC);
      oprot.writeI64(struct.index_id);
      oprot.writeFieldEnd();
      if (struct.hot_partitions != null) {
        if (struct.isSetHotPartitions()) {
          oprot.writeFieldBegin(HOT_PARTITIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.hot_partitions.size()));
            for (THotPartition _iter109 : struct.hot_partitions)
            {
              _iter109.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class THotTableMessageTupleScheme extends org.apache.thrift.scheme.TupleScheme<THotTableMessage> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, THotTableMessage struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.table_id);
      oprot.writeI64(struct.index_id);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetHotPartitions()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetHotPartitions()) {
        {
          oprot.writeI32(struct.hot_partitions.size());
          for (THotPartition _iter110 : struct.hot_partitions)
          {
            _iter110.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, THotTableMessage struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.table_id = iprot.readI64();
      struct.setTableIdIsSet(true);
      struct.index_id = iprot.readI64();
      struct.setIndexIdIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list111 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.hot_partitions = new java.util.ArrayList<THotPartition>(_list111.size);
          @org.apache.thrift.annotation.Nullable THotPartition _elem112;
          for (int _i113 = 0; _i113 < _list111.size; ++_i113)
          {
            _elem112 = new THotPartition();
            _elem112.read(iprot);
            struct.hot_partitions.add(_elem112);
          }
        }
        struct.setHotPartitionsIsSet(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();
  }
}