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

  private static final org.apache.thrift.protocol.TField FILE_CACHE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("file_cache_size", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField HOT_TABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("hot_tables", org.apache.thrift.protocol.TType.LIST, (short)2);

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

  public long file_cache_size; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<THotTableMessage> hot_tables; // 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 {
    FILE_CACHE_SIZE((short)1, "file_cache_size"),
    HOT_TABLES((short)2, "hot_tables");

    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: // FILE_CACHE_SIZE
          return FILE_CACHE_SIZE;
        case 2: // HOT_TABLES
          return HOT_TABLES;
        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 __FILE_CACHE_SIZE_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.HOT_TABLES};
  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.FILE_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("file_cache_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.HOT_TABLES, new org.apache.thrift.meta_data.FieldMetaData("hot_tables", 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, THotTableMessage.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetTopNHotPartitionsResponse.class, metaDataMap);
  }

  public TGetTopNHotPartitionsResponse() {
  }

  public TGetTopNHotPartitionsResponse(
    long file_cache_size)
  {
    this();
    this.file_cache_size = file_cache_size;
    setFileCacheSizeIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TGetTopNHotPartitionsResponse(TGetTopNHotPartitionsResponse other) {
    __isset_bitfield = other.__isset_bitfield;
    this.file_cache_size = other.file_cache_size;
    if (other.isSetHotTables()) {
      java.util.List<THotTableMessage> __this__hot_tables = new java.util.ArrayList<THotTableMessage>(other.hot_tables.size());
      for (THotTableMessage other_element : other.hot_tables) {
        __this__hot_tables.add(new THotTableMessage(other_element));
      }
      this.hot_tables = __this__hot_tables;
    }
  }

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

  @Override
  public void clear() {
    setFileCacheSizeIsSet(false);
    this.file_cache_size = 0;
    this.hot_tables = null;
  }

  public long getFileCacheSize() {
    return this.file_cache_size;
  }

  public TGetTopNHotPartitionsResponse setFileCacheSize(long file_cache_size) {
    this.file_cache_size = file_cache_size;
    setFileCacheSizeIsSet(true);
    return this;
  }

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

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

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

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

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

  public void addToHotTables(THotTableMessage elem) {
    if (this.hot_tables == null) {
      this.hot_tables = new java.util.ArrayList<THotTableMessage>();
    }
    this.hot_tables.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<THotTableMessage> getHotTables() {
    return this.hot_tables;
  }

  public TGetTopNHotPartitionsResponse setHotTables(@org.apache.thrift.annotation.Nullable java.util.List<THotTableMessage> hot_tables) {
    this.hot_tables = hot_tables;
    return this;
  }

  public void unsetHotTables() {
    this.hot_tables = null;
  }

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

  public void setHotTablesIsSet(boolean value) {
    if (!value) {
      this.hot_tables = null;
    }
  }

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

    case HOT_TABLES:
      if (value == null) {
        unsetHotTables();
      } else {
        setHotTables((java.util.List<THotTableMessage>)value);
      }
      break;

    }
  }

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

    case HOT_TABLES:
      return getHotTables();

    }
    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 FILE_CACHE_SIZE:
      return isSetFileCacheSize();
    case HOT_TABLES:
      return isSetHotTables();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_file_cache_size = true;
    boolean that_present_file_cache_size = true;
    if (this_present_file_cache_size || that_present_file_cache_size) {
      if (!(this_present_file_cache_size && that_present_file_cache_size))
        return false;
      if (this.file_cache_size != that.file_cache_size)
        return false;
    }

    boolean this_present_hot_tables = true && this.isSetHotTables();
    boolean that_present_hot_tables = true && that.isSetHotTables();
    if (this_present_hot_tables || that_present_hot_tables) {
      if (!(this_present_hot_tables && that_present_hot_tables))
        return false;
      if (!this.hot_tables.equals(that.hot_tables))
        return false;
    }

    return true;
  }

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

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

    hashCode = hashCode * 8191 + ((isSetHotTables()) ? 131071 : 524287);
    if (isSetHotTables())
      hashCode = hashCode * 8191 + hot_tables.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetFileCacheSize(), other.isSetFileCacheSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFileCacheSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.file_cache_size, other.file_cache_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHotTables(), other.isSetHotTables());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHotTables()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hot_tables, other.hot_tables);
      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("TGetTopNHotPartitionsResponse(");
    boolean first = true;

    sb.append("file_cache_size:");
    sb.append(this.file_cache_size);
    first = false;
    if (isSetHotTables()) {
      if (!first) sb.append(", ");
      sb.append("hot_tables:");
      if (this.hot_tables == null) {
        sb.append("null");
      } else {
        sb.append(this.hot_tables);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'file_cache_size' 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 TGetTopNHotPartitionsResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TGetTopNHotPartitionsResponseStandardScheme getScheme() {
      return new TGetTopNHotPartitionsResponseStandardScheme();
    }
  }

  private static class TGetTopNHotPartitionsResponseStandardScheme extends org.apache.thrift.scheme.StandardScheme<TGetTopNHotPartitionsResponse> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TGetTopNHotPartitionsResponse 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: // FILE_CACHE_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.file_cache_size = iprot.readI64();
              struct.setFileCacheSizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // HOT_TABLES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list114 = iprot.readListBegin();
                struct.hot_tables = new java.util.ArrayList<THotTableMessage>(_list114.size);
                @org.apache.thrift.annotation.Nullable THotTableMessage _elem115;
                for (int _i116 = 0; _i116 < _list114.size; ++_i116)
                {
                  _elem115 = new THotTableMessage();
                  _elem115.read(iprot);
                  struct.hot_tables.add(_elem115);
                }
                iprot.readListEnd();
              }
              struct.setHotTablesIsSet(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.isSetFileCacheSize()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'file_cache_size' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(FILE_CACHE_SIZE_FIELD_DESC);
      oprot.writeI64(struct.file_cache_size);
      oprot.writeFieldEnd();
      if (struct.hot_tables != null) {
        if (struct.isSetHotTables()) {
          oprot.writeFieldBegin(HOT_TABLES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.hot_tables.size()));
            for (THotTableMessage _iter117 : struct.hot_tables)
            {
              _iter117.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TGetTopNHotPartitionsResponseTupleScheme extends org.apache.thrift.scheme.TupleScheme<TGetTopNHotPartitionsResponse> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TGetTopNHotPartitionsResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.file_cache_size);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetHotTables()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetHotTables()) {
        {
          oprot.writeI32(struct.hot_tables.size());
          for (THotTableMessage _iter118 : struct.hot_tables)
          {
            _iter118.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TGetTopNHotPartitionsResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.file_cache_size = iprot.readI64();
      struct.setFileCacheSizeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list119 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.hot_tables = new java.util.ArrayList<THotTableMessage>(_list119.size);
          @org.apache.thrift.annotation.Nullable THotTableMessage _elem120;
          for (int _i121 = 0; _i121 < _list119.size; ++_i121)
          {
            _elem120 = new THotTableMessage();
            _elem120.read(iprot);
            struct.hot_tables.add(_elem120);
          }
        }
        struct.setHotTablesIsSet(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();
  }
}