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

  private static final org.apache.thrift.protocol.TField FILE_OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("file_options", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField STORAGE_BACKEND_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("storage_backend_type", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField DEST_NODE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("dest_node_id", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField OUTPUT_TUPLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("output_tuple_id", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField HEADER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("header_type", org.apache.thrift.protocol.TType.STRING, (short)6);

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

  public @org.apache.thrift.annotation.Nullable TResultFileSinkOptions file_options; // optional
  /**
   * 
   * @see org.apache.doris.thrift.TStorageBackendType
   */
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TStorageBackendType storage_backend_type; // optional
  public int dest_node_id; // optional
  public int output_tuple_id; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String header; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String header_type; // 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_OPTIONS((short)1, "file_options"),
    /**
     * 
     * @see org.apache.doris.thrift.TStorageBackendType
     */
    STORAGE_BACKEND_TYPE((short)2, "storage_backend_type"),
    DEST_NODE_ID((short)3, "dest_node_id"),
    OUTPUT_TUPLE_ID((short)4, "output_tuple_id"),
    HEADER((short)5, "header"),
    HEADER_TYPE((short)6, "header_type");

    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_OPTIONS
          return FILE_OPTIONS;
        case 2: // STORAGE_BACKEND_TYPE
          return STORAGE_BACKEND_TYPE;
        case 3: // DEST_NODE_ID
          return DEST_NODE_ID;
        case 4: // OUTPUT_TUPLE_ID
          return OUTPUT_TUPLE_ID;
        case 5: // HEADER
          return HEADER;
        case 6: // HEADER_TYPE
          return HEADER_TYPE;
        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 __DEST_NODE_ID_ISSET_ID = 0;
  private static final int __OUTPUT_TUPLE_ID_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.FILE_OPTIONS,_Fields.STORAGE_BACKEND_TYPE,_Fields.DEST_NODE_ID,_Fields.OUTPUT_TUPLE_ID,_Fields.HEADER,_Fields.HEADER_TYPE};
  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_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("file_options", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TResultFileSinkOptions.class)));
    tmpMap.put(_Fields.STORAGE_BACKEND_TYPE, new org.apache.thrift.meta_data.FieldMetaData("storage_backend_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.doris.thrift.TStorageBackendType.class)));
    tmpMap.put(_Fields.DEST_NODE_ID, new org.apache.thrift.meta_data.FieldMetaData("dest_node_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TPlanNodeId")));
    tmpMap.put(_Fields.OUTPUT_TUPLE_ID, new org.apache.thrift.meta_data.FieldMetaData("output_tuple_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTupleId")));
    tmpMap.put(_Fields.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HEADER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("header_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TResultFileSink.class, metaDataMap);
  }

  public TResultFileSink() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TResultFileSink(TResultFileSink other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetFileOptions()) {
      this.file_options = new TResultFileSinkOptions(other.file_options);
    }
    if (other.isSetStorageBackendType()) {
      this.storage_backend_type = other.storage_backend_type;
    }
    this.dest_node_id = other.dest_node_id;
    this.output_tuple_id = other.output_tuple_id;
    if (other.isSetHeader()) {
      this.header = other.header;
    }
    if (other.isSetHeaderType()) {
      this.header_type = other.header_type;
    }
  }

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

  @Override
  public void clear() {
    this.file_options = null;
    this.storage_backend_type = null;
    setDestNodeIdIsSet(false);
    this.dest_node_id = 0;
    setOutputTupleIdIsSet(false);
    this.output_tuple_id = 0;
    this.header = null;
    this.header_type = null;
  }

  @org.apache.thrift.annotation.Nullable
  public TResultFileSinkOptions getFileOptions() {
    return this.file_options;
  }

  public TResultFileSink setFileOptions(@org.apache.thrift.annotation.Nullable TResultFileSinkOptions file_options) {
    this.file_options = file_options;
    return this;
  }

  public void unsetFileOptions() {
    this.file_options = null;
  }

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

  public void setFileOptionsIsSet(boolean value) {
    if (!value) {
      this.file_options = null;
    }
  }

  /**
   * 
   * @see org.apache.doris.thrift.TStorageBackendType
   */
  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TStorageBackendType getStorageBackendType() {
    return this.storage_backend_type;
  }

  /**
   * 
   * @see org.apache.doris.thrift.TStorageBackendType
   */
  public TResultFileSink setStorageBackendType(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TStorageBackendType storage_backend_type) {
    this.storage_backend_type = storage_backend_type;
    return this;
  }

  public void unsetStorageBackendType() {
    this.storage_backend_type = null;
  }

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

  public void setStorageBackendTypeIsSet(boolean value) {
    if (!value) {
      this.storage_backend_type = null;
    }
  }

  public int getDestNodeId() {
    return this.dest_node_id;
  }

  public TResultFileSink setDestNodeId(int dest_node_id) {
    this.dest_node_id = dest_node_id;
    setDestNodeIdIsSet(true);
    return this;
  }

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

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

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

  public int getOutputTupleId() {
    return this.output_tuple_id;
  }

  public TResultFileSink setOutputTupleId(int output_tuple_id) {
    this.output_tuple_id = output_tuple_id;
    setOutputTupleIdIsSet(true);
    return this;
  }

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

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

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

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

  public TResultFileSink setHeader(@org.apache.thrift.annotation.Nullable java.lang.String header) {
    this.header = header;
    return this;
  }

  public void unsetHeader() {
    this.header = null;
  }

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

  public void setHeaderIsSet(boolean value) {
    if (!value) {
      this.header = null;
    }
  }

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

  public TResultFileSink setHeaderType(@org.apache.thrift.annotation.Nullable java.lang.String header_type) {
    this.header_type = header_type;
    return this;
  }

  public void unsetHeaderType() {
    this.header_type = null;
  }

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

  public void setHeaderTypeIsSet(boolean value) {
    if (!value) {
      this.header_type = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case FILE_OPTIONS:
      if (value == null) {
        unsetFileOptions();
      } else {
        setFileOptions((TResultFileSinkOptions)value);
      }
      break;

    case STORAGE_BACKEND_TYPE:
      if (value == null) {
        unsetStorageBackendType();
      } else {
        setStorageBackendType((org.apache.doris.thrift.TStorageBackendType)value);
      }
      break;

    case DEST_NODE_ID:
      if (value == null) {
        unsetDestNodeId();
      } else {
        setDestNodeId((java.lang.Integer)value);
      }
      break;

    case OUTPUT_TUPLE_ID:
      if (value == null) {
        unsetOutputTupleId();
      } else {
        setOutputTupleId((java.lang.Integer)value);
      }
      break;

    case HEADER:
      if (value == null) {
        unsetHeader();
      } else {
        setHeader((java.lang.String)value);
      }
      break;

    case HEADER_TYPE:
      if (value == null) {
        unsetHeaderType();
      } else {
        setHeaderType((java.lang.String)value);
      }
      break;

    }
  }

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

    case STORAGE_BACKEND_TYPE:
      return getStorageBackendType();

    case DEST_NODE_ID:
      return getDestNodeId();

    case OUTPUT_TUPLE_ID:
      return getOutputTupleId();

    case HEADER:
      return getHeader();

    case HEADER_TYPE:
      return getHeaderType();

    }
    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_OPTIONS:
      return isSetFileOptions();
    case STORAGE_BACKEND_TYPE:
      return isSetStorageBackendType();
    case DEST_NODE_ID:
      return isSetDestNodeId();
    case OUTPUT_TUPLE_ID:
      return isSetOutputTupleId();
    case HEADER:
      return isSetHeader();
    case HEADER_TYPE:
      return isSetHeaderType();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_file_options = true && this.isSetFileOptions();
    boolean that_present_file_options = true && that.isSetFileOptions();
    if (this_present_file_options || that_present_file_options) {
      if (!(this_present_file_options && that_present_file_options))
        return false;
      if (!this.file_options.equals(that.file_options))
        return false;
    }

    boolean this_present_storage_backend_type = true && this.isSetStorageBackendType();
    boolean that_present_storage_backend_type = true && that.isSetStorageBackendType();
    if (this_present_storage_backend_type || that_present_storage_backend_type) {
      if (!(this_present_storage_backend_type && that_present_storage_backend_type))
        return false;
      if (!this.storage_backend_type.equals(that.storage_backend_type))
        return false;
    }

    boolean this_present_dest_node_id = true && this.isSetDestNodeId();
    boolean that_present_dest_node_id = true && that.isSetDestNodeId();
    if (this_present_dest_node_id || that_present_dest_node_id) {
      if (!(this_present_dest_node_id && that_present_dest_node_id))
        return false;
      if (this.dest_node_id != that.dest_node_id)
        return false;
    }

    boolean this_present_output_tuple_id = true && this.isSetOutputTupleId();
    boolean that_present_output_tuple_id = true && that.isSetOutputTupleId();
    if (this_present_output_tuple_id || that_present_output_tuple_id) {
      if (!(this_present_output_tuple_id && that_present_output_tuple_id))
        return false;
      if (this.output_tuple_id != that.output_tuple_id)
        return false;
    }

    boolean this_present_header = true && this.isSetHeader();
    boolean that_present_header = true && that.isSetHeader();
    if (this_present_header || that_present_header) {
      if (!(this_present_header && that_present_header))
        return false;
      if (!this.header.equals(that.header))
        return false;
    }

    boolean this_present_header_type = true && this.isSetHeaderType();
    boolean that_present_header_type = true && that.isSetHeaderType();
    if (this_present_header_type || that_present_header_type) {
      if (!(this_present_header_type && that_present_header_type))
        return false;
      if (!this.header_type.equals(that.header_type))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetFileOptions()) ? 131071 : 524287);
    if (isSetFileOptions())
      hashCode = hashCode * 8191 + file_options.hashCode();

    hashCode = hashCode * 8191 + ((isSetStorageBackendType()) ? 131071 : 524287);
    if (isSetStorageBackendType())
      hashCode = hashCode * 8191 + storage_backend_type.getValue();

    hashCode = hashCode * 8191 + ((isSetDestNodeId()) ? 131071 : 524287);
    if (isSetDestNodeId())
      hashCode = hashCode * 8191 + dest_node_id;

    hashCode = hashCode * 8191 + ((isSetOutputTupleId()) ? 131071 : 524287);
    if (isSetOutputTupleId())
      hashCode = hashCode * 8191 + output_tuple_id;

    hashCode = hashCode * 8191 + ((isSetHeader()) ? 131071 : 524287);
    if (isSetHeader())
      hashCode = hashCode * 8191 + header.hashCode();

    hashCode = hashCode * 8191 + ((isSetHeaderType()) ? 131071 : 524287);
    if (isSetHeaderType())
      hashCode = hashCode * 8191 + header_type.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetFileOptions(), other.isSetFileOptions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFileOptions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.file_options, other.file_options);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStorageBackendType(), other.isSetStorageBackendType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStorageBackendType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storage_backend_type, other.storage_backend_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDestNodeId(), other.isSetDestNodeId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDestNodeId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dest_node_id, other.dest_node_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetOutputTupleId(), other.isSetOutputTupleId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOutputTupleId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.output_tuple_id, other.output_tuple_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHeader(), other.isSetHeader());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHeader()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, other.header);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHeaderType(), other.isSetHeaderType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHeaderType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header_type, other.header_type);
      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("TResultFileSink(");
    boolean first = true;

    if (isSetFileOptions()) {
      sb.append("file_options:");
      if (this.file_options == null) {
        sb.append("null");
      } else {
        sb.append(this.file_options);
      }
      first = false;
    }
    if (isSetStorageBackendType()) {
      if (!first) sb.append(", ");
      sb.append("storage_backend_type:");
      if (this.storage_backend_type == null) {
        sb.append("null");
      } else {
        sb.append(this.storage_backend_type);
      }
      first = false;
    }
    if (isSetDestNodeId()) {
      if (!first) sb.append(", ");
      sb.append("dest_node_id:");
      sb.append(this.dest_node_id);
      first = false;
    }
    if (isSetOutputTupleId()) {
      if (!first) sb.append(", ");
      sb.append("output_tuple_id:");
      sb.append(this.output_tuple_id);
      first = false;
    }
    if (isSetHeader()) {
      if (!first) sb.append(", ");
      sb.append("header:");
      if (this.header == null) {
        sb.append("null");
      } else {
        sb.append(this.header);
      }
      first = false;
    }
    if (isSetHeaderType()) {
      if (!first) sb.append(", ");
      sb.append("header_type:");
      if (this.header_type == null) {
        sb.append("null");
      } else {
        sb.append(this.header_type);
      }
      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 (file_options != null) {
      file_options.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 TResultFileSinkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TResultFileSinkStandardScheme getScheme() {
      return new TResultFileSinkStandardScheme();
    }
  }

  private static class TResultFileSinkStandardScheme extends org.apache.thrift.scheme.StandardScheme<TResultFileSink> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TResultFileSink 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_OPTIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.file_options = new TResultFileSinkOptions();
              struct.file_options.read(iprot);
              struct.setFileOptionsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STORAGE_BACKEND_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.storage_backend_type = org.apache.doris.thrift.TStorageBackendType.findByValue(iprot.readI32());
              struct.setStorageBackendTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DEST_NODE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.dest_node_id = iprot.readI32();
              struct.setDestNodeIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // OUTPUT_TUPLE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.output_tuple_id = iprot.readI32();
              struct.setOutputTupleIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // HEADER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.header = iprot.readString();
              struct.setHeaderIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // HEADER_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.header_type = iprot.readString();
              struct.setHeaderTypeIsSet(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, TResultFileSink struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.file_options != null) {
        if (struct.isSetFileOptions()) {
          oprot.writeFieldBegin(FILE_OPTIONS_FIELD_DESC);
          struct.file_options.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.storage_backend_type != null) {
        if (struct.isSetStorageBackendType()) {
          oprot.writeFieldBegin(STORAGE_BACKEND_TYPE_FIELD_DESC);
          oprot.writeI32(struct.storage_backend_type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetDestNodeId()) {
        oprot.writeFieldBegin(DEST_NODE_ID_FIELD_DESC);
        oprot.writeI32(struct.dest_node_id);
        oprot.writeFieldEnd();
      }
      if (struct.isSetOutputTupleId()) {
        oprot.writeFieldBegin(OUTPUT_TUPLE_ID_FIELD_DESC);
        oprot.writeI32(struct.output_tuple_id);
        oprot.writeFieldEnd();
      }
      if (struct.header != null) {
        if (struct.isSetHeader()) {
          oprot.writeFieldBegin(HEADER_FIELD_DESC);
          oprot.writeString(struct.header);
          oprot.writeFieldEnd();
        }
      }
      if (struct.header_type != null) {
        if (struct.isSetHeaderType()) {
          oprot.writeFieldBegin(HEADER_TYPE_FIELD_DESC);
          oprot.writeString(struct.header_type);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TResultFileSinkTupleScheme extends org.apache.thrift.scheme.TupleScheme<TResultFileSink> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TResultFileSink 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.isSetFileOptions()) {
        optionals.set(0);
      }
      if (struct.isSetStorageBackendType()) {
        optionals.set(1);
      }
      if (struct.isSetDestNodeId()) {
        optionals.set(2);
      }
      if (struct.isSetOutputTupleId()) {
        optionals.set(3);
      }
      if (struct.isSetHeader()) {
        optionals.set(4);
      }
      if (struct.isSetHeaderType()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetFileOptions()) {
        struct.file_options.write(oprot);
      }
      if (struct.isSetStorageBackendType()) {
        oprot.writeI32(struct.storage_backend_type.getValue());
      }
      if (struct.isSetDestNodeId()) {
        oprot.writeI32(struct.dest_node_id);
      }
      if (struct.isSetOutputTupleId()) {
        oprot.writeI32(struct.output_tuple_id);
      }
      if (struct.isSetHeader()) {
        oprot.writeString(struct.header);
      }
      if (struct.isSetHeaderType()) {
        oprot.writeString(struct.header_type);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TResultFileSink struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.file_options = new TResultFileSinkOptions();
        struct.file_options.read(iprot);
        struct.setFileOptionsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.storage_backend_type = org.apache.doris.thrift.TStorageBackendType.findByValue(iprot.readI32());
        struct.setStorageBackendTypeIsSet(true);
      }
      if (incoming.get(2)) {
        struct.dest_node_id = iprot.readI32();
        struct.setDestNodeIdIsSet(true);
      }
      if (incoming.get(3)) {
        struct.output_tuple_id = iprot.readI32();
        struct.setOutputTupleIdIsSet(true);
      }
      if (incoming.get(4)) {
        struct.header = iprot.readString();
        struct.setHeaderIsSet(true);
      }
      if (incoming.get(5)) {
        struct.header_type = iprot.readString();
        struct.setHeaderTypeIsSet(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();
  }
}