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

  private static final org.apache.thrift.protocol.TField DICTS_FIELD_DESC = new org.apache.thrift.protocol.TField("dicts", org.apache.thrift.protocol.TType.MAP, (short)1);
  private static final org.apache.thrift.protocol.TField SLOT_DICTS_FIELD_DESC = new org.apache.thrift.protocol.TField("slot_dicts", org.apache.thrift.protocol.TType.MAP, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,TColumnDict> dicts; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,java.lang.Integer> slot_dicts; // 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 {
    DICTS((short)1, "dicts"),
    SLOT_DICTS((short)2, "slot_dicts");

    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: // DICTS
          return DICTS;
        case 2: // SLOT_DICTS
          return SLOT_DICTS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.DICTS,_Fields.SLOT_DICTS};
  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.DICTS, new org.apache.thrift.meta_data.FieldMetaData("dicts", 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.I32), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnDict.class))));
    tmpMap.put(_Fields.SLOT_DICTS, new org.apache.thrift.meta_data.FieldMetaData("slot_dicts", 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.I32), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGlobalDict.class, metaDataMap);
  }

  public TGlobalDict() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TGlobalDict(TGlobalDict other) {
    if (other.isSetDicts()) {
      java.util.Map<java.lang.Integer,TColumnDict> __this__dicts = new java.util.HashMap<java.lang.Integer,TColumnDict>(other.dicts.size());
      for (java.util.Map.Entry<java.lang.Integer, TColumnDict> other_element : other.dicts.entrySet()) {

        java.lang.Integer other_element_key = other_element.getKey();
        TColumnDict other_element_value = other_element.getValue();

        java.lang.Integer __this__dicts_copy_key = other_element_key;

        TColumnDict __this__dicts_copy_value = new TColumnDict(other_element_value);

        __this__dicts.put(__this__dicts_copy_key, __this__dicts_copy_value);
      }
      this.dicts = __this__dicts;
    }
    if (other.isSetSlotDicts()) {
      java.util.Map<java.lang.Integer,java.lang.Integer> __this__slot_dicts = new java.util.HashMap<java.lang.Integer,java.lang.Integer>(other.slot_dicts);
      this.slot_dicts = __this__slot_dicts;
    }
  }

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

  @Override
  public void clear() {
    this.dicts = null;
    this.slot_dicts = null;
  }

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

  public void putToDicts(int key, TColumnDict val) {
    if (this.dicts == null) {
      this.dicts = new java.util.HashMap<java.lang.Integer,TColumnDict>();
    }
    this.dicts.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.Integer,TColumnDict> getDicts() {
    return this.dicts;
  }

  public TGlobalDict setDicts(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,TColumnDict> dicts) {
    this.dicts = dicts;
    return this;
  }

  public void unsetDicts() {
    this.dicts = null;
  }

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

  public void setDictsIsSet(boolean value) {
    if (!value) {
      this.dicts = null;
    }
  }

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

  public void putToSlotDicts(int key, int val) {
    if (this.slot_dicts == null) {
      this.slot_dicts = new java.util.HashMap<java.lang.Integer,java.lang.Integer>();
    }
    this.slot_dicts.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.Integer,java.lang.Integer> getSlotDicts() {
    return this.slot_dicts;
  }

  public TGlobalDict setSlotDicts(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.Integer,java.lang.Integer> slot_dicts) {
    this.slot_dicts = slot_dicts;
    return this;
  }

  public void unsetSlotDicts() {
    this.slot_dicts = null;
  }

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

  public void setSlotDictsIsSet(boolean value) {
    if (!value) {
      this.slot_dicts = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case DICTS:
      if (value == null) {
        unsetDicts();
      } else {
        setDicts((java.util.Map<java.lang.Integer,TColumnDict>)value);
      }
      break;

    case SLOT_DICTS:
      if (value == null) {
        unsetSlotDicts();
      } else {
        setSlotDicts((java.util.Map<java.lang.Integer,java.lang.Integer>)value);
      }
      break;

    }
  }

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

    case SLOT_DICTS:
      return getSlotDicts();

    }
    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 DICTS:
      return isSetDicts();
    case SLOT_DICTS:
      return isSetSlotDicts();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_dicts = true && this.isSetDicts();
    boolean that_present_dicts = true && that.isSetDicts();
    if (this_present_dicts || that_present_dicts) {
      if (!(this_present_dicts && that_present_dicts))
        return false;
      if (!this.dicts.equals(that.dicts))
        return false;
    }

    boolean this_present_slot_dicts = true && this.isSetSlotDicts();
    boolean that_present_slot_dicts = true && that.isSetSlotDicts();
    if (this_present_slot_dicts || that_present_slot_dicts) {
      if (!(this_present_slot_dicts && that_present_slot_dicts))
        return false;
      if (!this.slot_dicts.equals(that.slot_dicts))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetDicts()) ? 131071 : 524287);
    if (isSetDicts())
      hashCode = hashCode * 8191 + dicts.hashCode();

    hashCode = hashCode * 8191 + ((isSetSlotDicts()) ? 131071 : 524287);
    if (isSetSlotDicts())
      hashCode = hashCode * 8191 + slot_dicts.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetDicts(), other.isSetDicts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDicts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dicts, other.dicts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSlotDicts(), other.isSetSlotDicts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSlotDicts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.slot_dicts, other.slot_dicts);
      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("TGlobalDict(");
    boolean first = true;

    if (isSetDicts()) {
      sb.append("dicts:");
      if (this.dicts == null) {
        sb.append("null");
      } else {
        sb.append(this.dicts);
      }
      first = false;
    }
    if (isSetSlotDicts()) {
      if (!first) sb.append(", ");
      sb.append("slot_dicts:");
      if (this.slot_dicts == null) {
        sb.append("null");
      } else {
        sb.append(this.slot_dicts);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // 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 {
      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 TGlobalDictStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TGlobalDictStandardScheme getScheme() {
      return new TGlobalDictStandardScheme();
    }
  }

  private static class TGlobalDictStandardScheme extends org.apache.thrift.scheme.StandardScheme<TGlobalDict> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TGlobalDict 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: // DICTS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map98 = iprot.readMapBegin();
                struct.dicts = new java.util.HashMap<java.lang.Integer,TColumnDict>(2*_map98.size);
                int _key99;
                @org.apache.thrift.annotation.Nullable TColumnDict _val100;
                for (int _i101 = 0; _i101 < _map98.size; ++_i101)
                {
                  _key99 = iprot.readI32();
                  _val100 = new TColumnDict();
                  _val100.read(iprot);
                  struct.dicts.put(_key99, _val100);
                }
                iprot.readMapEnd();
              }
              struct.setDictsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SLOT_DICTS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map102 = iprot.readMapBegin();
                struct.slot_dicts = new java.util.HashMap<java.lang.Integer,java.lang.Integer>(2*_map102.size);
                int _key103;
                int _val104;
                for (int _i105 = 0; _i105 < _map102.size; ++_i105)
                {
                  _key103 = iprot.readI32();
                  _val104 = iprot.readI32();
                  struct.slot_dicts.put(_key103, _val104);
                }
                iprot.readMapEnd();
              }
              struct.setSlotDictsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.dicts != null) {
        if (struct.isSetDicts()) {
          oprot.writeFieldBegin(DICTS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, struct.dicts.size()));
            for (java.util.Map.Entry<java.lang.Integer, TColumnDict> _iter106 : struct.dicts.entrySet())
            {
              oprot.writeI32(_iter106.getKey());
              _iter106.getValue().write(oprot);
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.slot_dicts != null) {
        if (struct.isSetSlotDicts()) {
          oprot.writeFieldBegin(SLOT_DICTS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.I32, struct.slot_dicts.size()));
            for (java.util.Map.Entry<java.lang.Integer, java.lang.Integer> _iter107 : struct.slot_dicts.entrySet())
            {
              oprot.writeI32(_iter107.getKey());
              oprot.writeI32(_iter107.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TGlobalDictTupleScheme extends org.apache.thrift.scheme.TupleScheme<TGlobalDict> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TGlobalDict struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetDicts()) {
        optionals.set(0);
      }
      if (struct.isSetSlotDicts()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetDicts()) {
        {
          oprot.writeI32(struct.dicts.size());
          for (java.util.Map.Entry<java.lang.Integer, TColumnDict> _iter108 : struct.dicts.entrySet())
          {
            oprot.writeI32(_iter108.getKey());
            _iter108.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetSlotDicts()) {
        {
          oprot.writeI32(struct.slot_dicts.size());
          for (java.util.Map.Entry<java.lang.Integer, java.lang.Integer> _iter109 : struct.slot_dicts.entrySet())
          {
            oprot.writeI32(_iter109.getKey());
            oprot.writeI32(_iter109.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TGlobalDict struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TMap _map110 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT); 
          struct.dicts = new java.util.HashMap<java.lang.Integer,TColumnDict>(2*_map110.size);
          int _key111;
          @org.apache.thrift.annotation.Nullable TColumnDict _val112;
          for (int _i113 = 0; _i113 < _map110.size; ++_i113)
          {
            _key111 = iprot.readI32();
            _val112 = new TColumnDict();
            _val112.read(iprot);
            struct.dicts.put(_key111, _val112);
          }
        }
        struct.setDictsIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TMap _map114 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.I32); 
          struct.slot_dicts = new java.util.HashMap<java.lang.Integer,java.lang.Integer>(2*_map114.size);
          int _key115;
          int _val116;
          for (int _i117 = 0; _i117 < _map114.size; ++_i117)
          {
            _key115 = iprot.readI32();
            _val116 = iprot.readI32();
            struct.slot_dicts.put(_key115, _val116);
          }
        }
        struct.setSlotDictsIsSet(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();
  }
}