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

  private static final org.apache.thrift.protocol.TField ADDR_FIELD_DESC = new org.apache.thrift.protocol.TField("addr", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField FRAGMENT_INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("fragment_instance_id", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField NODE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("node_id", org.apache.thrift.protocol.TType.I32, (short)3);

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

  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TNetworkAddress addr; // optional
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId fragment_instance_id; // optional
  public int node_id; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ADDR((short)1, "addr"),
    FRAGMENT_INSTANCE_ID((short)2, "fragment_instance_id"),
    NODE_ID((short)3, "node_id");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ADDR
          return ADDR;
        case 2: // FRAGMENT_INSTANCE_ID
          return FRAGMENT_INSTANCE_ID;
        case 3: // NODE_ID
          return NODE_ID;
        default:
          return null;
      }
    }

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

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

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

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

    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  private static final int __NODE_ID_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.ADDR,_Fields.FRAGMENT_INSTANCE_ID,_Fields.NODE_ID};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ADDR, new org.apache.thrift.meta_data.FieldMetaData("addr", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TNetworkAddress.class)));
    tmpMap.put(_Fields.FRAGMENT_INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("fragment_instance_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TUniqueId.class)));
    tmpMap.put(_Fields.NODE_ID, new org.apache.thrift.meta_data.FieldMetaData("node_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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(TRecCTETarget.class, metaDataMap);
  }

  public TRecCTETarget() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TRecCTETarget(TRecCTETarget other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetAddr()) {
      this.addr = new org.apache.doris.thrift.TNetworkAddress(other.addr);
    }
    if (other.isSetFragmentInstanceId()) {
      this.fragment_instance_id = new org.apache.doris.thrift.TUniqueId(other.fragment_instance_id);
    }
    this.node_id = other.node_id;
  }

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

  @Override
  public void clear() {
    this.addr = null;
    this.fragment_instance_id = null;
    setNodeIdIsSet(false);
    this.node_id = 0;
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TNetworkAddress getAddr() {
    return this.addr;
  }

  public TRecCTETarget setAddr(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TNetworkAddress addr) {
    this.addr = addr;
    return this;
  }

  public void unsetAddr() {
    this.addr = null;
  }

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

  public void setAddrIsSet(boolean value) {
    if (!value) {
      this.addr = null;
    }
  }

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

  public TRecCTETarget setFragmentInstanceId(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TUniqueId fragment_instance_id) {
    this.fragment_instance_id = fragment_instance_id;
    return this;
  }

  public void unsetFragmentInstanceId() {
    this.fragment_instance_id = null;
  }

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

  public void setFragmentInstanceIdIsSet(boolean value) {
    if (!value) {
      this.fragment_instance_id = null;
    }
  }

  public int getNodeId() {
    return this.node_id;
  }

  public TRecCTETarget setNodeId(int node_id) {
    this.node_id = node_id;
    setNodeIdIsSet(true);
    return this;
  }

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

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ADDR:
      if (value == null) {
        unsetAddr();
      } else {
        setAddr((org.apache.doris.thrift.TNetworkAddress)value);
      }
      break;

    case FRAGMENT_INSTANCE_ID:
      if (value == null) {
        unsetFragmentInstanceId();
      } else {
        setFragmentInstanceId((org.apache.doris.thrift.TUniqueId)value);
      }
      break;

    case NODE_ID:
      if (value == null) {
        unsetNodeId();
      } else {
        setNodeId((java.lang.Integer)value);
      }
      break;

    }
  }

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

    case FRAGMENT_INSTANCE_ID:
      return getFragmentInstanceId();

    case NODE_ID:
      return getNodeId();

    }
    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 ADDR:
      return isSetAddr();
    case FRAGMENT_INSTANCE_ID:
      return isSetFragmentInstanceId();
    case NODE_ID:
      return isSetNodeId();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_addr = true && this.isSetAddr();
    boolean that_present_addr = true && that.isSetAddr();
    if (this_present_addr || that_present_addr) {
      if (!(this_present_addr && that_present_addr))
        return false;
      if (!this.addr.equals(that.addr))
        return false;
    }

    boolean this_present_fragment_instance_id = true && this.isSetFragmentInstanceId();
    boolean that_present_fragment_instance_id = true && that.isSetFragmentInstanceId();
    if (this_present_fragment_instance_id || that_present_fragment_instance_id) {
      if (!(this_present_fragment_instance_id && that_present_fragment_instance_id))
        return false;
      if (!this.fragment_instance_id.equals(that.fragment_instance_id))
        return false;
    }

    boolean this_present_node_id = true && this.isSetNodeId();
    boolean that_present_node_id = true && that.isSetNodeId();
    if (this_present_node_id || that_present_node_id) {
      if (!(this_present_node_id && that_present_node_id))
        return false;
      if (this.node_id != that.node_id)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetAddr()) ? 131071 : 524287);
    if (isSetAddr())
      hashCode = hashCode * 8191 + addr.hashCode();

    hashCode = hashCode * 8191 + ((isSetFragmentInstanceId()) ? 131071 : 524287);
    if (isSetFragmentInstanceId())
      hashCode = hashCode * 8191 + fragment_instance_id.hashCode();

    hashCode = hashCode * 8191 + ((isSetNodeId()) ? 131071 : 524287);
    if (isSetNodeId())
      hashCode = hashCode * 8191 + node_id;

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetAddr(), other.isSetAddr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAddr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addr, other.addr);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFragmentInstanceId(), other.isSetFragmentInstanceId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFragmentInstanceId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fragment_instance_id, other.fragment_instance_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNodeId(), other.isSetNodeId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNodeId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.node_id, other.node_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TRecCTETarget(");
    boolean first = true;

    if (isSetAddr()) {
      sb.append("addr:");
      if (this.addr == null) {
        sb.append("null");
      } else {
        sb.append(this.addr);
      }
      first = false;
    }
    if (isSetFragmentInstanceId()) {
      if (!first) sb.append(", ");
      sb.append("fragment_instance_id:");
      if (this.fragment_instance_id == null) {
        sb.append("null");
      } else {
        sb.append(this.fragment_instance_id);
      }
      first = false;
    }
    if (isSetNodeId()) {
      if (!first) sb.append(", ");
      sb.append("node_id:");
      sb.append(this.node_id);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (addr != null) {
      addr.validate();
    }
    if (fragment_instance_id != null) {
      fragment_instance_id.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

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

  private static class TRecCTETargetStandardScheme extends org.apache.thrift.scheme.StandardScheme<TRecCTETarget> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TRecCTETarget 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: // ADDR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.addr = new org.apache.doris.thrift.TNetworkAddress();
              struct.addr.read(iprot);
              struct.setAddrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FRAGMENT_INSTANCE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.fragment_instance_id = new org.apache.doris.thrift.TUniqueId();
              struct.fragment_instance_id.read(iprot);
              struct.setFragmentInstanceIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NODE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.node_id = iprot.readI32();
              struct.setNodeIdIsSet(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, TRecCTETarget struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.addr != null) {
        if (struct.isSetAddr()) {
          oprot.writeFieldBegin(ADDR_FIELD_DESC);
          struct.addr.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.fragment_instance_id != null) {
        if (struct.isSetFragmentInstanceId()) {
          oprot.writeFieldBegin(FRAGMENT_INSTANCE_ID_FIELD_DESC);
          struct.fragment_instance_id.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetNodeId()) {
        oprot.writeFieldBegin(NODE_ID_FIELD_DESC);
        oprot.writeI32(struct.node_id);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TRecCTETargetTupleScheme extends org.apache.thrift.scheme.TupleScheme<TRecCTETarget> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TRecCTETarget 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.isSetAddr()) {
        optionals.set(0);
      }
      if (struct.isSetFragmentInstanceId()) {
        optionals.set(1);
      }
      if (struct.isSetNodeId()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetAddr()) {
        struct.addr.write(oprot);
      }
      if (struct.isSetFragmentInstanceId()) {
        struct.fragment_instance_id.write(oprot);
      }
      if (struct.isSetNodeId()) {
        oprot.writeI32(struct.node_id);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TRecCTETarget struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.addr = new org.apache.doris.thrift.TNetworkAddress();
        struct.addr.read(iprot);
        struct.setAddrIsSet(true);
      }
      if (incoming.get(1)) {
        struct.fragment_instance_id = new org.apache.doris.thrift.TUniqueId();
        struct.fragment_instance_id.read(iprot);
        struct.setFragmentInstanceIdIsSet(true);
      }
      if (incoming.get(2)) {
        struct.node_id = iprot.readI32();
        struct.setNodeIdIsSet(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();
  }
}