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

  private static final org.apache.thrift.protocol.TField ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("rows", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField IS_COMPRESSED_FIELD_DESC = new org.apache.thrift.protocol.TField("is_compressed", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField PACKET_SEQ_FIELD_DESC = new org.apache.thrift.protocol.TField("packet_seq", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField ATTACHED_INFOS_FIELD_DESC = new org.apache.thrift.protocol.TField("attached_infos", org.apache.thrift.protocol.TType.MAP, (short)4);

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

  public @org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> rows; // required
  public boolean is_compressed; // required
  public long packet_seq; // required
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> attached_infos; // 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 {
    ROWS((short)1, "rows"),
    IS_COMPRESSED((short)2, "is_compressed"),
    PACKET_SEQ((short)3, "packet_seq"),
    ATTACHED_INFOS((short)4, "attached_infos");

    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: // ROWS
          return ROWS;
        case 2: // IS_COMPRESSED
          return IS_COMPRESSED;
        case 3: // PACKET_SEQ
          return PACKET_SEQ;
        case 4: // ATTACHED_INFOS
          return ATTACHED_INFOS;
        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 __IS_COMPRESSED_ISSET_ID = 0;
  private static final int __PACKET_SEQ_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.ATTACHED_INFOS};
  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.ROWS, new org.apache.thrift.meta_data.FieldMetaData("rows", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , true))));
    tmpMap.put(_Fields.IS_COMPRESSED, new org.apache.thrift.meta_data.FieldMetaData("is_compressed", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.PACKET_SEQ, new org.apache.thrift.meta_data.FieldMetaData("packet_seq", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ATTACHED_INFOS, new org.apache.thrift.meta_data.FieldMetaData("attached_infos", 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.STRING), 
            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(TResultBatch.class, metaDataMap);
  }

  public TResultBatch() {
  }

  public TResultBatch(
    java.util.List<java.nio.ByteBuffer> rows,
    boolean is_compressed,
    long packet_seq)
  {
    this();
    this.rows = rows;
    this.is_compressed = is_compressed;
    setIsCompressedIsSet(true);
    this.packet_seq = packet_seq;
    setPacketSeqIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TResultBatch(TResultBatch other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetRows()) {
      java.util.List<java.nio.ByteBuffer> __this__rows = new java.util.ArrayList<java.nio.ByteBuffer>(other.rows);
      this.rows = __this__rows;
    }
    this.is_compressed = other.is_compressed;
    this.packet_seq = other.packet_seq;
    if (other.isSetAttachedInfos()) {
      java.util.Map<java.lang.String,java.lang.String> __this__attached_infos = new java.util.HashMap<java.lang.String,java.lang.String>(other.attached_infos);
      this.attached_infos = __this__attached_infos;
    }
  }

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

  @Override
  public void clear() {
    this.rows = null;
    setIsCompressedIsSet(false);
    this.is_compressed = false;
    setPacketSeqIsSet(false);
    this.packet_seq = 0;
    this.attached_infos = null;
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.nio.ByteBuffer> getRowsIterator() {
    return (this.rows == null) ? null : this.rows.iterator();
  }

  public void addToRows(java.nio.ByteBuffer elem) {
    if (this.rows == null) {
      this.rows = new java.util.ArrayList<java.nio.ByteBuffer>();
    }
    this.rows.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.nio.ByteBuffer> getRows() {
    return this.rows;
  }

  public TResultBatch setRows(@org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> rows) {
    this.rows = rows;
    return this;
  }

  public void unsetRows() {
    this.rows = null;
  }

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

  public void setRowsIsSet(boolean value) {
    if (!value) {
      this.rows = null;
    }
  }

  public boolean isIsCompressed() {
    return this.is_compressed;
  }

  public TResultBatch setIsCompressed(boolean is_compressed) {
    this.is_compressed = is_compressed;
    setIsCompressedIsSet(true);
    return this;
  }

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

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

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

  public long getPacketSeq() {
    return this.packet_seq;
  }

  public TResultBatch setPacketSeq(long packet_seq) {
    this.packet_seq = packet_seq;
    setPacketSeqIsSet(true);
    return this;
  }

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

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

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

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

  public void putToAttachedInfos(java.lang.String key, java.lang.String val) {
    if (this.attached_infos == null) {
      this.attached_infos = new java.util.HashMap<java.lang.String,java.lang.String>();
    }
    this.attached_infos.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.String> getAttachedInfos() {
    return this.attached_infos;
  }

  public TResultBatch setAttachedInfos(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> attached_infos) {
    this.attached_infos = attached_infos;
    return this;
  }

  public void unsetAttachedInfos() {
    this.attached_infos = null;
  }

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

  public void setAttachedInfosIsSet(boolean value) {
    if (!value) {
      this.attached_infos = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ROWS:
      if (value == null) {
        unsetRows();
      } else {
        setRows((java.util.List<java.nio.ByteBuffer>)value);
      }
      break;

    case IS_COMPRESSED:
      if (value == null) {
        unsetIsCompressed();
      } else {
        setIsCompressed((java.lang.Boolean)value);
      }
      break;

    case PACKET_SEQ:
      if (value == null) {
        unsetPacketSeq();
      } else {
        setPacketSeq((java.lang.Long)value);
      }
      break;

    case ATTACHED_INFOS:
      if (value == null) {
        unsetAttachedInfos();
      } else {
        setAttachedInfos((java.util.Map<java.lang.String,java.lang.String>)value);
      }
      break;

    }
  }

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

    case IS_COMPRESSED:
      return isIsCompressed();

    case PACKET_SEQ:
      return getPacketSeq();

    case ATTACHED_INFOS:
      return getAttachedInfos();

    }
    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 ROWS:
      return isSetRows();
    case IS_COMPRESSED:
      return isSetIsCompressed();
    case PACKET_SEQ:
      return isSetPacketSeq();
    case ATTACHED_INFOS:
      return isSetAttachedInfos();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_rows = true && this.isSetRows();
    boolean that_present_rows = true && that.isSetRows();
    if (this_present_rows || that_present_rows) {
      if (!(this_present_rows && that_present_rows))
        return false;
      if (!this.rows.equals(that.rows))
        return false;
    }

    boolean this_present_is_compressed = true;
    boolean that_present_is_compressed = true;
    if (this_present_is_compressed || that_present_is_compressed) {
      if (!(this_present_is_compressed && that_present_is_compressed))
        return false;
      if (this.is_compressed != that.is_compressed)
        return false;
    }

    boolean this_present_packet_seq = true;
    boolean that_present_packet_seq = true;
    if (this_present_packet_seq || that_present_packet_seq) {
      if (!(this_present_packet_seq && that_present_packet_seq))
        return false;
      if (this.packet_seq != that.packet_seq)
        return false;
    }

    boolean this_present_attached_infos = true && this.isSetAttachedInfos();
    boolean that_present_attached_infos = true && that.isSetAttachedInfos();
    if (this_present_attached_infos || that_present_attached_infos) {
      if (!(this_present_attached_infos && that_present_attached_infos))
        return false;
      if (!this.attached_infos.equals(that.attached_infos))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetRows()) ? 131071 : 524287);
    if (isSetRows())
      hashCode = hashCode * 8191 + rows.hashCode();

    hashCode = hashCode * 8191 + ((is_compressed) ? 131071 : 524287);

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

    hashCode = hashCode * 8191 + ((isSetAttachedInfos()) ? 131071 : 524287);
    if (isSetAttachedInfos())
      hashCode = hashCode * 8191 + attached_infos.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetRows(), other.isSetRows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRows()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rows, other.rows);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsCompressed(), other.isSetIsCompressed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCompressed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_compressed, other.is_compressed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPacketSeq(), other.isSetPacketSeq());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPacketSeq()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet_seq, other.packet_seq);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetAttachedInfos(), other.isSetAttachedInfos());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAttachedInfos()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attached_infos, other.attached_infos);
      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("TResultBatch(");
    boolean first = true;

    sb.append("rows:");
    if (this.rows == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.rows, sb);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("is_compressed:");
    sb.append(this.is_compressed);
    first = false;
    if (!first) sb.append(", ");
    sb.append("packet_seq:");
    sb.append(this.packet_seq);
    first = false;
    if (isSetAttachedInfos()) {
      if (!first) sb.append(", ");
      sb.append("attached_infos:");
      if (this.attached_infos == null) {
        sb.append("null");
      } else {
        sb.append(this.attached_infos);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (rows == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'rows' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'is_compressed' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'packet_seq' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

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

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

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

  private static class TResultBatchStandardScheme extends org.apache.thrift.scheme.StandardScheme<TResultBatch> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TResultBatch 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: // ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
                struct.rows = new java.util.ArrayList<java.nio.ByteBuffer>(_list16.size);
                @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem17;
                for (int _i18 = 0; _i18 < _list16.size; ++_i18)
                {
                  _elem17 = iprot.readBinary();
                  struct.rows.add(_elem17);
                }
                iprot.readListEnd();
              }
              struct.setRowsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // IS_COMPRESSED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_compressed = iprot.readBool();
              struct.setIsCompressedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PACKET_SEQ
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.packet_seq = iprot.readI64();
              struct.setPacketSeqIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ATTACHED_INFOS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map19 = iprot.readMapBegin();
                struct.attached_infos = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map19.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key20;
                @org.apache.thrift.annotation.Nullable java.lang.String _val21;
                for (int _i22 = 0; _i22 < _map19.size; ++_i22)
                {
                  _key20 = iprot.readString();
                  _val21 = iprot.readString();
                  struct.attached_infos.put(_key20, _val21);
                }
                iprot.readMapEnd();
              }
              struct.setAttachedInfosIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetIsCompressed()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'is_compressed' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetPacketSeq()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'packet_seq' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.rows != null) {
        oprot.writeFieldBegin(ROWS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.rows.size()));
          for (java.nio.ByteBuffer _iter23 : struct.rows)
          {
            oprot.writeBinary(_iter23);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(IS_COMPRESSED_FIELD_DESC);
      oprot.writeBool(struct.is_compressed);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(PACKET_SEQ_FIELD_DESC);
      oprot.writeI64(struct.packet_seq);
      oprot.writeFieldEnd();
      if (struct.attached_infos != null) {
        if (struct.isSetAttachedInfos()) {
          oprot.writeFieldBegin(ATTACHED_INFOS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attached_infos.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter24 : struct.attached_infos.entrySet())
            {
              oprot.writeString(_iter24.getKey());
              oprot.writeString(_iter24.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TResultBatchTupleScheme extends org.apache.thrift.scheme.TupleScheme<TResultBatch> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TResultBatch struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.rows.size());
        for (java.nio.ByteBuffer _iter25 : struct.rows)
        {
          oprot.writeBinary(_iter25);
        }
      }
      oprot.writeBool(struct.is_compressed);
      oprot.writeI64(struct.packet_seq);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetAttachedInfos()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetAttachedInfos()) {
        {
          oprot.writeI32(struct.attached_infos.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter26 : struct.attached_infos.entrySet())
          {
            oprot.writeString(_iter26.getKey());
            oprot.writeString(_iter26.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TResultBatch struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list27 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
        struct.rows = new java.util.ArrayList<java.nio.ByteBuffer>(_list27.size);
        @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem28;
        for (int _i29 = 0; _i29 < _list27.size; ++_i29)
        {
          _elem28 = iprot.readBinary();
          struct.rows.add(_elem28);
        }
      }
      struct.setRowsIsSet(true);
      struct.is_compressed = iprot.readBool();
      struct.setIsCompressedIsSet(true);
      struct.packet_seq = iprot.readI64();
      struct.setPacketSeqIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TMap _map30 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); 
          struct.attached_infos = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map30.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key31;
          @org.apache.thrift.annotation.Nullable java.lang.String _val32;
          for (int _i33 = 0; _i33 < _map30.size; ++_i33)
          {
            _key31 = iprot.readString();
            _val32 = iprot.readString();
            struct.attached_infos.put(_key31, _val32);
          }
        }
        struct.setAttachedInfosIsSet(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();
  }
}