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

  private static final org.apache.thrift.protocol.TField CONNECT_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("connect_string", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField USE_TRANSACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("use_transaction", org.apache.thrift.protocol.TType.BOOL, (short)3);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String connect_string; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String table; // optional
  public boolean use_transaction; // 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 {
    CONNECT_STRING((short)1, "connect_string"),
    TABLE((short)2, "table"),
    USE_TRANSACTION((short)3, "use_transaction");

    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: // CONNECT_STRING
          return CONNECT_STRING;
        case 2: // TABLE
          return TABLE;
        case 3: // USE_TRANSACTION
          return USE_TRANSACTION;
        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 __USE_TRANSACTION_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.CONNECT_STRING,_Fields.TABLE,_Fields.USE_TRANSACTION};
  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.CONNECT_STRING, new org.apache.thrift.meta_data.FieldMetaData("connect_string", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.USE_TRANSACTION, new org.apache.thrift.meta_data.FieldMetaData("use_transaction", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TOdbcTableSink.class, metaDataMap);
  }

  public TOdbcTableSink() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TOdbcTableSink(TOdbcTableSink other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetConnectString()) {
      this.connect_string = other.connect_string;
    }
    if (other.isSetTable()) {
      this.table = other.table;
    }
    this.use_transaction = other.use_transaction;
  }

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

  @Override
  public void clear() {
    this.connect_string = null;
    this.table = null;
    setUseTransactionIsSet(false);
    this.use_transaction = false;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getConnectString() {
    return this.connect_string;
  }

  public TOdbcTableSink setConnectString(@org.apache.thrift.annotation.Nullable java.lang.String connect_string) {
    this.connect_string = connect_string;
    return this;
  }

  public void unsetConnectString() {
    this.connect_string = null;
  }

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

  public void setConnectStringIsSet(boolean value) {
    if (!value) {
      this.connect_string = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getTable() {
    return this.table;
  }

  public TOdbcTableSink setTable(@org.apache.thrift.annotation.Nullable java.lang.String table) {
    this.table = table;
    return this;
  }

  public void unsetTable() {
    this.table = null;
  }

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

  public void setTableIsSet(boolean value) {
    if (!value) {
      this.table = null;
    }
  }

  public boolean isUseTransaction() {
    return this.use_transaction;
  }

  public TOdbcTableSink setUseTransaction(boolean use_transaction) {
    this.use_transaction = use_transaction;
    setUseTransactionIsSet(true);
    return this;
  }

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

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CONNECT_STRING:
      if (value == null) {
        unsetConnectString();
      } else {
        setConnectString((java.lang.String)value);
      }
      break;

    case TABLE:
      if (value == null) {
        unsetTable();
      } else {
        setTable((java.lang.String)value);
      }
      break;

    case USE_TRANSACTION:
      if (value == null) {
        unsetUseTransaction();
      } else {
        setUseTransaction((java.lang.Boolean)value);
      }
      break;

    }
  }

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

    case TABLE:
      return getTable();

    case USE_TRANSACTION:
      return isUseTransaction();

    }
    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 CONNECT_STRING:
      return isSetConnectString();
    case TABLE:
      return isSetTable();
    case USE_TRANSACTION:
      return isSetUseTransaction();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_connect_string = true && this.isSetConnectString();
    boolean that_present_connect_string = true && that.isSetConnectString();
    if (this_present_connect_string || that_present_connect_string) {
      if (!(this_present_connect_string && that_present_connect_string))
        return false;
      if (!this.connect_string.equals(that.connect_string))
        return false;
    }

    boolean this_present_table = true && this.isSetTable();
    boolean that_present_table = true && that.isSetTable();
    if (this_present_table || that_present_table) {
      if (!(this_present_table && that_present_table))
        return false;
      if (!this.table.equals(that.table))
        return false;
    }

    boolean this_present_use_transaction = true && this.isSetUseTransaction();
    boolean that_present_use_transaction = true && that.isSetUseTransaction();
    if (this_present_use_transaction || that_present_use_transaction) {
      if (!(this_present_use_transaction && that_present_use_transaction))
        return false;
      if (this.use_transaction != that.use_transaction)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetConnectString()) ? 131071 : 524287);
    if (isSetConnectString())
      hashCode = hashCode * 8191 + connect_string.hashCode();

    hashCode = hashCode * 8191 + ((isSetTable()) ? 131071 : 524287);
    if (isSetTable())
      hashCode = hashCode * 8191 + table.hashCode();

    hashCode = hashCode * 8191 + ((isSetUseTransaction()) ? 131071 : 524287);
    if (isSetUseTransaction())
      hashCode = hashCode * 8191 + ((use_transaction) ? 131071 : 524287);

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetConnectString(), other.isSetConnectString());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConnectString()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.connect_string, other.connect_string);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTable(), other.isSetTable());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTable()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, other.table);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUseTransaction(), other.isSetUseTransaction());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUseTransaction()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.use_transaction, other.use_transaction);
      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("TOdbcTableSink(");
    boolean first = true;

    if (isSetConnectString()) {
      sb.append("connect_string:");
      if (this.connect_string == null) {
        sb.append("null");
      } else {
        sb.append(this.connect_string);
      }
      first = false;
    }
    if (isSetTable()) {
      if (!first) sb.append(", ");
      sb.append("table:");
      if (this.table == null) {
        sb.append("null");
      } else {
        sb.append(this.table);
      }
      first = false;
    }
    if (isSetUseTransaction()) {
      if (!first) sb.append(", ");
      sb.append("use_transaction:");
      sb.append(this.use_transaction);
      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 {
      // 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 TOdbcTableSinkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TOdbcTableSinkStandardScheme getScheme() {
      return new TOdbcTableSinkStandardScheme();
    }
  }

  private static class TOdbcTableSinkStandardScheme extends org.apache.thrift.scheme.StandardScheme<TOdbcTableSink> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TOdbcTableSink 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: // CONNECT_STRING
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.connect_string = iprot.readString();
              struct.setConnectStringIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TABLE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.table = iprot.readString();
              struct.setTableIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // USE_TRANSACTION
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.use_transaction = iprot.readBool();
              struct.setUseTransactionIsSet(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, TOdbcTableSink struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.connect_string != null) {
        if (struct.isSetConnectString()) {
          oprot.writeFieldBegin(CONNECT_STRING_FIELD_DESC);
          oprot.writeString(struct.connect_string);
          oprot.writeFieldEnd();
        }
      }
      if (struct.table != null) {
        if (struct.isSetTable()) {
          oprot.writeFieldBegin(TABLE_FIELD_DESC);
          oprot.writeString(struct.table);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetUseTransaction()) {
        oprot.writeFieldBegin(USE_TRANSACTION_FIELD_DESC);
        oprot.writeBool(struct.use_transaction);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TOdbcTableSinkTupleScheme extends org.apache.thrift.scheme.TupleScheme<TOdbcTableSink> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TOdbcTableSink 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.isSetConnectString()) {
        optionals.set(0);
      }
      if (struct.isSetTable()) {
        optionals.set(1);
      }
      if (struct.isSetUseTransaction()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetConnectString()) {
        oprot.writeString(struct.connect_string);
      }
      if (struct.isSetTable()) {
        oprot.writeString(struct.table);
      }
      if (struct.isSetUseTransaction()) {
        oprot.writeBool(struct.use_transaction);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TOdbcTableSink 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.connect_string = iprot.readString();
        struct.setConnectStringIsSet(true);
      }
      if (incoming.get(1)) {
        struct.table = iprot.readString();
        struct.setTableIsSet(true);
      }
      if (incoming.get(2)) {
        struct.use_transaction = iprot.readBool();
        struct.setUseTransactionIsSet(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();
  }
}