All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.snappydata.thrift.RowSet Maven / Gradle / Ivy

There is a newer version: 1.6.7
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package io.snappydata.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-08-09")
public class RowSet implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RowSet");

  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 FLAGS_FIELD_DESC = new org.apache.thrift.protocol.TField("flags", org.apache.thrift.protocol.TType.BYTE, (short)2);
  private static final org.apache.thrift.protocol.TField CURSOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("cursorId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField STATEMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("statementId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField CONN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("connId", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField SOURCE_FIELD_DESC = new org.apache.thrift.protocol.TField("source", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("offset", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("metadata", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField CURSOR_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("cursorName", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField WARNINGS_FIELD_DESC = new org.apache.thrift.protocol.TField("warnings", org.apache.thrift.protocol.TType.STRUCT, (short)11);
  private static final org.apache.thrift.protocol.TField ROW_IDS_FOR_UPDATE_OR_DELETE_FIELD_DESC = new org.apache.thrift.protocol.TField("rowIdsForUpdateOrDelete", org.apache.thrift.protocol.TType.LIST, (short)12);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new RowSetStandardSchemeFactory());
    schemes.put(TupleScheme.class, new RowSetTupleSchemeFactory());
  }

  public List rows; // required
  public byte flags; // required
  public long cursorId; // required
  public long statementId; // required
  public long connId; // required
  public ByteBuffer token; // optional
  public HostAddress source; // optional
  public int offset; // optional
  public List metadata; // optional
  public String cursorName; // optional
  public SnappyExceptionData warnings; // optional
  public List rowIdsForUpdateOrDelete; // 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"),
    FLAGS((short)2, "flags"),
    CURSOR_ID((short)3, "cursorId"),
    STATEMENT_ID((short)4, "statementId"),
    CONN_ID((short)5, "connId"),
    TOKEN((short)6, "token"),
    SOURCE((short)7, "source"),
    OFFSET((short)8, "offset"),
    METADATA((short)9, "metadata"),
    CURSOR_NAME((short)10, "cursorName"),
    WARNINGS((short)11, "warnings"),
    ROW_IDS_FOR_UPDATE_OR_DELETE((short)12, "rowIdsForUpdateOrDelete");

    private static final Map byName = new HashMap();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ROWS
          return ROWS;
        case 2: // FLAGS
          return FLAGS;
        case 3: // CURSOR_ID
          return CURSOR_ID;
        case 4: // STATEMENT_ID
          return STATEMENT_ID;
        case 5: // CONN_ID
          return CONN_ID;
        case 6: // TOKEN
          return TOKEN;
        case 7: // SOURCE
          return SOURCE;
        case 8: // OFFSET
          return OFFSET;
        case 9: // METADATA
          return METADATA;
        case 10: // CURSOR_NAME
          return CURSOR_NAME;
        case 11: // WARNINGS
          return WARNINGS;
        case 12: // ROW_IDS_FOR_UPDATE_OR_DELETE
          return ROW_IDS_FOR_UPDATE_OR_DELETE;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __FLAGS_ISSET_ID = 0;
  private static final int __CURSORID_ISSET_ID = 1;
  private static final int __STATEMENTID_ISSET_ID = 2;
  private static final int __CONNID_ISSET_ID = 3;
  private static final int __OFFSET_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TOKEN,_Fields.SOURCE,_Fields.OFFSET,_Fields.METADATA,_Fields.CURSOR_NAME,_Fields.WARNINGS,_Fields.ROW_IDS_FOR_UPDATE_OR_DELETE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Row.class))));
    tmpMap.put(_Fields.FLAGS, new org.apache.thrift.meta_data.FieldMetaData("flags", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.CURSOR_ID, new org.apache.thrift.meta_data.FieldMetaData("cursorId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.STATEMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("statementId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CONN_ID, new org.apache.thrift.meta_data.FieldMetaData("connId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.SOURCE, new org.apache.thrift.meta_data.FieldMetaData("source", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostAddress.class)));
    tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.METADATA, new org.apache.thrift.meta_data.FieldMetaData("metadata", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnDescriptor.class))));
    tmpMap.put(_Fields.CURSOR_NAME, new org.apache.thrift.meta_data.FieldMetaData("cursorName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.WARNINGS, new org.apache.thrift.meta_data.FieldMetaData("warnings", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SnappyExceptionData.class)));
    tmpMap.put(_Fields.ROW_IDS_FOR_UPDATE_OR_DELETE, new org.apache.thrift.meta_data.FieldMetaData("rowIdsForUpdateOrDelete", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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.I64))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RowSet.class, metaDataMap);
  }

  public RowSet() {
  }

  public RowSet(
    List rows,
    byte flags,
    long cursorId,
    long statementId,
    long connId)
  {
    this();
    this.rows = rows;
    this.flags = flags;
    setFlagsIsSet(true);
    this.cursorId = cursorId;
    setCursorIdIsSet(true);
    this.statementId = statementId;
    setStatementIdIsSet(true);
    this.connId = connId;
    setConnIdIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public RowSet(RowSet other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetRows()) {
      List __this__rows = new ArrayList(other.rows.size());
      for (Row other_element : other.rows) {
        __this__rows.add(new Row(other_element));
      }
      this.rows = __this__rows;
    }
    this.flags = other.flags;
    this.cursorId = other.cursorId;
    this.statementId = other.statementId;
    this.connId = other.connId;
    if (other.isSetToken()) {
      this.token = org.apache.thrift.TBaseHelper.copyBinary(other.token);
    }
    if (other.isSetSource()) {
      this.source = new HostAddress(other.source);
    }
    this.offset = other.offset;
    if (other.isSetMetadata()) {
      List __this__metadata = new ArrayList(other.metadata.size());
      for (ColumnDescriptor other_element : other.metadata) {
        __this__metadata.add(new ColumnDescriptor(other_element));
      }
      this.metadata = __this__metadata;
    }
    if (other.isSetCursorName()) {
      this.cursorName = other.cursorName;
    }
    if (other.isSetWarnings()) {
      this.warnings = new SnappyExceptionData(other.warnings);
    }
    if (other.isSetRowIdsForUpdateOrDelete()) {
      List __this__rowIdsForUpdateOrDelete = new ArrayList(other.rowIdsForUpdateOrDelete);
      this.rowIdsForUpdateOrDelete = __this__rowIdsForUpdateOrDelete;
    }
  }

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

  @Override
  public void clear() {
    this.rows = null;
    setFlagsIsSet(false);
    this.flags = 0;
    setCursorIdIsSet(false);
    this.cursorId = 0;
    setStatementIdIsSet(false);
    this.statementId = 0;
    setConnIdIsSet(false);
    this.connId = 0;
    this.token = null;
    this.source = null;
    setOffsetIsSet(false);
    this.offset = 0;
    this.metadata = null;
    this.cursorName = null;
    this.warnings = null;
    this.rowIdsForUpdateOrDelete = null;
  }

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

  public java.util.Iterator getRowsIterator() {
    return (this.rows == null) ? null : this.rows.iterator();
  }

  public void addToRows(Row elem) {
    if (this.rows == null) {
      this.rows = new ArrayList();
    }
    this.rows.add(elem);
  }

  public List getRows() {
    return this.rows;
  }

  public RowSet setRows(List 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 byte getFlags() {
    return this.flags;
  }

  public RowSet setFlags(byte flags) {
    this.flags = flags;
    setFlagsIsSet(true);
    return this;
  }

  public void unsetFlags() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FLAGS_ISSET_ID);
  }

  /** Returns true if field flags is set (has been assigned a value) and false otherwise */
  public boolean isSetFlags() {
    return EncodingUtils.testBit(__isset_bitfield, __FLAGS_ISSET_ID);
  }

  public void setFlagsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FLAGS_ISSET_ID, value);
  }

  public long getCursorId() {
    return this.cursorId;
  }

  public RowSet setCursorId(long cursorId) {
    this.cursorId = cursorId;
    setCursorIdIsSet(true);
    return this;
  }

  public void unsetCursorId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CURSORID_ISSET_ID);
  }

  /** Returns true if field cursorId is set (has been assigned a value) and false otherwise */
  public boolean isSetCursorId() {
    return EncodingUtils.testBit(__isset_bitfield, __CURSORID_ISSET_ID);
  }

  public void setCursorIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CURSORID_ISSET_ID, value);
  }

  public long getStatementId() {
    return this.statementId;
  }

  public RowSet setStatementId(long statementId) {
    this.statementId = statementId;
    setStatementIdIsSet(true);
    return this;
  }

  public void unsetStatementId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STATEMENTID_ISSET_ID);
  }

  /** Returns true if field statementId is set (has been assigned a value) and false otherwise */
  public boolean isSetStatementId() {
    return EncodingUtils.testBit(__isset_bitfield, __STATEMENTID_ISSET_ID);
  }

  public void setStatementIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STATEMENTID_ISSET_ID, value);
  }

  public long getConnId() {
    return this.connId;
  }

  public RowSet setConnId(long connId) {
    this.connId = connId;
    setConnIdIsSet(true);
    return this;
  }

  public void unsetConnId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CONNID_ISSET_ID);
  }

  /** Returns true if field connId is set (has been assigned a value) and false otherwise */
  public boolean isSetConnId() {
    return EncodingUtils.testBit(__isset_bitfield, __CONNID_ISSET_ID);
  }

  public void setConnIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CONNID_ISSET_ID, value);
  }

  public byte[] getToken() {
    setToken(org.apache.thrift.TBaseHelper.rightSize(token));
    return token == null ? null : token.array();
  }

  public ByteBuffer bufferForToken() {
    return org.apache.thrift.TBaseHelper.copyBinary(token);
  }

  public RowSet setToken(byte[] token) {
    this.token = token == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(token, token.length));
    return this;
  }

  public RowSet setToken(ByteBuffer token) {
    this.token = org.apache.thrift.TBaseHelper.copyBinary(token);
    return this;
  }

  public void unsetToken() {
    this.token = null;
  }

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

  public void setTokenIsSet(boolean value) {
    if (!value) {
      this.token = null;
    }
  }

  public HostAddress getSource() {
    return this.source;
  }

  public RowSet setSource(HostAddress source) {
    this.source = source;
    return this;
  }

  public void unsetSource() {
    this.source = null;
  }

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

  public void setSourceIsSet(boolean value) {
    if (!value) {
      this.source = null;
    }
  }

  public int getOffset() {
    return this.offset;
  }

  public RowSet setOffset(int offset) {
    this.offset = offset;
    setOffsetIsSet(true);
    return this;
  }

  public void unsetOffset() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __OFFSET_ISSET_ID);
  }

  /** Returns true if field offset is set (has been assigned a value) and false otherwise */
  public boolean isSetOffset() {
    return EncodingUtils.testBit(__isset_bitfield, __OFFSET_ISSET_ID);
  }

  public void setOffsetIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OFFSET_ISSET_ID, value);
  }

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

  public java.util.Iterator getMetadataIterator() {
    return (this.metadata == null) ? null : this.metadata.iterator();
  }

  public void addToMetadata(ColumnDescriptor elem) {
    if (this.metadata == null) {
      this.metadata = new ArrayList();
    }
    this.metadata.add(elem);
  }

  public List getMetadata() {
    return this.metadata;
  }

  public RowSet setMetadata(List metadata) {
    this.metadata = metadata;
    return this;
  }

  public void unsetMetadata() {
    this.metadata = null;
  }

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

  public void setMetadataIsSet(boolean value) {
    if (!value) {
      this.metadata = null;
    }
  }

  public String getCursorName() {
    return this.cursorName;
  }

  public RowSet setCursorName(String cursorName) {
    this.cursorName = cursorName;
    return this;
  }

  public void unsetCursorName() {
    this.cursorName = null;
  }

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

  public void setCursorNameIsSet(boolean value) {
    if (!value) {
      this.cursorName = null;
    }
  }

  public SnappyExceptionData getWarnings() {
    return this.warnings;
  }

  public RowSet setWarnings(SnappyExceptionData warnings) {
    this.warnings = warnings;
    return this;
  }

  public void unsetWarnings() {
    this.warnings = null;
  }

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

  public void setWarningsIsSet(boolean value) {
    if (!value) {
      this.warnings = null;
    }
  }

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

  public java.util.Iterator getRowIdsForUpdateOrDeleteIterator() {
    return (this.rowIdsForUpdateOrDelete == null) ? null : this.rowIdsForUpdateOrDelete.iterator();
  }

  public void addToRowIdsForUpdateOrDelete(long elem) {
    if (this.rowIdsForUpdateOrDelete == null) {
      this.rowIdsForUpdateOrDelete = new ArrayList();
    }
    this.rowIdsForUpdateOrDelete.add(elem);
  }

  public List getRowIdsForUpdateOrDelete() {
    return this.rowIdsForUpdateOrDelete;
  }

  public RowSet setRowIdsForUpdateOrDelete(List rowIdsForUpdateOrDelete) {
    this.rowIdsForUpdateOrDelete = rowIdsForUpdateOrDelete;
    return this;
  }

  public void unsetRowIdsForUpdateOrDelete() {
    this.rowIdsForUpdateOrDelete = null;
  }

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

  public void setRowIdsForUpdateOrDeleteIsSet(boolean value) {
    if (!value) {
      this.rowIdsForUpdateOrDelete = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ROWS:
      if (value == null) {
        unsetRows();
      } else {
        setRows((List)value);
      }
      break;

    case FLAGS:
      if (value == null) {
        unsetFlags();
      } else {
        setFlags((Byte)value);
      }
      break;

    case CURSOR_ID:
      if (value == null) {
        unsetCursorId();
      } else {
        setCursorId((Long)value);
      }
      break;

    case STATEMENT_ID:
      if (value == null) {
        unsetStatementId();
      } else {
        setStatementId((Long)value);
      }
      break;

    case CONN_ID:
      if (value == null) {
        unsetConnId();
      } else {
        setConnId((Long)value);
      }
      break;

    case TOKEN:
      if (value == null) {
        unsetToken();
      } else {
        setToken((ByteBuffer)value);
      }
      break;

    case SOURCE:
      if (value == null) {
        unsetSource();
      } else {
        setSource((HostAddress)value);
      }
      break;

    case OFFSET:
      if (value == null) {
        unsetOffset();
      } else {
        setOffset((Integer)value);
      }
      break;

    case METADATA:
      if (value == null) {
        unsetMetadata();
      } else {
        setMetadata((List)value);
      }
      break;

    case CURSOR_NAME:
      if (value == null) {
        unsetCursorName();
      } else {
        setCursorName((String)value);
      }
      break;

    case WARNINGS:
      if (value == null) {
        unsetWarnings();
      } else {
        setWarnings((SnappyExceptionData)value);
      }
      break;

    case ROW_IDS_FOR_UPDATE_OR_DELETE:
      if (value == null) {
        unsetRowIdsForUpdateOrDelete();
      } else {
        setRowIdsForUpdateOrDelete((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ROWS:
      return getRows();

    case FLAGS:
      return getFlags();

    case CURSOR_ID:
      return getCursorId();

    case STATEMENT_ID:
      return getStatementId();

    case CONN_ID:
      return getConnId();

    case TOKEN:
      return getToken();

    case SOURCE:
      return getSource();

    case OFFSET:
      return getOffset();

    case METADATA:
      return getMetadata();

    case CURSOR_NAME:
      return getCursorName();

    case WARNINGS:
      return getWarnings();

    case ROW_IDS_FOR_UPDATE_OR_DELETE:
      return getRowIdsForUpdateOrDelete();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case ROWS:
      return isSetRows();
    case FLAGS:
      return isSetFlags();
    case CURSOR_ID:
      return isSetCursorId();
    case STATEMENT_ID:
      return isSetStatementId();
    case CONN_ID:
      return isSetConnId();
    case TOKEN:
      return isSetToken();
    case SOURCE:
      return isSetSource();
    case OFFSET:
      return isSetOffset();
    case METADATA:
      return isSetMetadata();
    case CURSOR_NAME:
      return isSetCursorName();
    case WARNINGS:
      return isSetWarnings();
    case ROW_IDS_FOR_UPDATE_OR_DELETE:
      return isSetRowIdsForUpdateOrDelete();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof RowSet)
      return this.equals((RowSet)that);
    return false;
  }

  public boolean equals(RowSet that) {
    if (that == null)
      return false;

    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_flags = true;
    boolean that_present_flags = true;
    if (this_present_flags || that_present_flags) {
      if (!(this_present_flags && that_present_flags))
        return false;
      if (this.flags != that.flags)
        return false;
    }

    boolean this_present_cursorId = true;
    boolean that_present_cursorId = true;
    if (this_present_cursorId || that_present_cursorId) {
      if (!(this_present_cursorId && that_present_cursorId))
        return false;
      if (this.cursorId != that.cursorId)
        return false;
    }

    boolean this_present_statementId = true;
    boolean that_present_statementId = true;
    if (this_present_statementId || that_present_statementId) {
      if (!(this_present_statementId && that_present_statementId))
        return false;
      if (this.statementId != that.statementId)
        return false;
    }

    boolean this_present_connId = true;
    boolean that_present_connId = true;
    if (this_present_connId || that_present_connId) {
      if (!(this_present_connId && that_present_connId))
        return false;
      if (this.connId != that.connId)
        return false;
    }

    boolean this_present_token = true && this.isSetToken();
    boolean that_present_token = true && that.isSetToken();
    if (this_present_token || that_present_token) {
      if (!(this_present_token && that_present_token))
        return false;
      if (!this.token.equals(that.token))
        return false;
    }

    boolean this_present_source = true && this.isSetSource();
    boolean that_present_source = true && that.isSetSource();
    if (this_present_source || that_present_source) {
      if (!(this_present_source && that_present_source))
        return false;
      if (!this.source.equals(that.source))
        return false;
    }

    boolean this_present_offset = true && this.isSetOffset();
    boolean that_present_offset = true && that.isSetOffset();
    if (this_present_offset || that_present_offset) {
      if (!(this_present_offset && that_present_offset))
        return false;
      if (this.offset != that.offset)
        return false;
    }

    boolean this_present_metadata = true && this.isSetMetadata();
    boolean that_present_metadata = true && that.isSetMetadata();
    if (this_present_metadata || that_present_metadata) {
      if (!(this_present_metadata && that_present_metadata))
        return false;
      if (!this.metadata.equals(that.metadata))
        return false;
    }

    boolean this_present_cursorName = true && this.isSetCursorName();
    boolean that_present_cursorName = true && that.isSetCursorName();
    if (this_present_cursorName || that_present_cursorName) {
      if (!(this_present_cursorName && that_present_cursorName))
        return false;
      if (!this.cursorName.equals(that.cursorName))
        return false;
    }

    boolean this_present_warnings = true && this.isSetWarnings();
    boolean that_present_warnings = true && that.isSetWarnings();
    if (this_present_warnings || that_present_warnings) {
      if (!(this_present_warnings && that_present_warnings))
        return false;
      if (!this.warnings.equals(that.warnings))
        return false;
    }

    boolean this_present_rowIdsForUpdateOrDelete = true && this.isSetRowIdsForUpdateOrDelete();
    boolean that_present_rowIdsForUpdateOrDelete = true && that.isSetRowIdsForUpdateOrDelete();
    if (this_present_rowIdsForUpdateOrDelete || that_present_rowIdsForUpdateOrDelete) {
      if (!(this_present_rowIdsForUpdateOrDelete && that_present_rowIdsForUpdateOrDelete))
        return false;
      if (!this.rowIdsForUpdateOrDelete.equals(that.rowIdsForUpdateOrDelete))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_rows = true && (isSetRows());
    list.add(present_rows);
    if (present_rows)
      list.add(rows);

    boolean present_flags = true;
    list.add(present_flags);
    if (present_flags)
      list.add(flags);

    boolean present_cursorId = true;
    list.add(present_cursorId);
    if (present_cursorId)
      list.add(cursorId);

    boolean present_statementId = true;
    list.add(present_statementId);
    if (present_statementId)
      list.add(statementId);

    boolean present_connId = true;
    list.add(present_connId);
    if (present_connId)
      list.add(connId);

    boolean present_token = true && (isSetToken());
    list.add(present_token);
    if (present_token)
      list.add(token);

    boolean present_source = true && (isSetSource());
    list.add(present_source);
    if (present_source)
      list.add(source);

    boolean present_offset = true && (isSetOffset());
    list.add(present_offset);
    if (present_offset)
      list.add(offset);

    boolean present_metadata = true && (isSetMetadata());
    list.add(present_metadata);
    if (present_metadata)
      list.add(metadata);

    boolean present_cursorName = true && (isSetCursorName());
    list.add(present_cursorName);
    if (present_cursorName)
      list.add(cursorName);

    boolean present_warnings = true && (isSetWarnings());
    list.add(present_warnings);
    if (present_warnings)
      list.add(warnings);

    boolean present_rowIdsForUpdateOrDelete = true && (isSetRowIdsForUpdateOrDelete());
    list.add(present_rowIdsForUpdateOrDelete);
    if (present_rowIdsForUpdateOrDelete)
      list.add(rowIdsForUpdateOrDelete);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetRows()).compareTo(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 = Boolean.valueOf(isSetFlags()).compareTo(other.isSetFlags());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFlags()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.flags, other.flags);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCursorId()).compareTo(other.isSetCursorId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCursorId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cursorId, other.cursorId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatementId()).compareTo(other.isSetStatementId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatementId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statementId, other.statementId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetConnId()).compareTo(other.isSetConnId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConnId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.connId, other.connId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSource()).compareTo(other.isSetSource());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSource()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.source, other.source);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOffset()).compareTo(other.isSetOffset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOffset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset, other.offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMetadata()).compareTo(other.isSetMetadata());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMetadata()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metadata, other.metadata);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCursorName()).compareTo(other.isSetCursorName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCursorName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cursorName, other.cursorName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetWarnings()).compareTo(other.isSetWarnings());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWarnings()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.warnings, other.warnings);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRowIdsForUpdateOrDelete()).compareTo(other.isSetRowIdsForUpdateOrDelete());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRowIdsForUpdateOrDelete()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rowIdsForUpdateOrDelete, other.rowIdsForUpdateOrDelete);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("RowSet(");
    boolean first = true;

    sb.append("rows:");
    if (this.rows == null) {
      sb.append("null");
    } else {
      sb.append(this.rows);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("flags:");
    sb.append(this.flags);
    first = false;
    if (!first) sb.append(", ");
    sb.append("cursorId:");
    sb.append(this.cursorId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("statementId:");
    sb.append(this.statementId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("connId:");
    sb.append(this.connId);
    first = false;
    if (isSetToken()) {
      if (!first) sb.append(", ");
      sb.append("token:");
      if (this.token == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.token, sb);
      }
      first = false;
    }
    if (isSetSource()) {
      if (!first) sb.append(", ");
      sb.append("source:");
      if (this.source == null) {
        sb.append("null");
      } else {
        sb.append(this.source);
      }
      first = false;
    }
    if (isSetOffset()) {
      if (!first) sb.append(", ");
      sb.append("offset:");
      sb.append(this.offset);
      first = false;
    }
    if (isSetMetadata()) {
      if (!first) sb.append(", ");
      sb.append("metadata:");
      if (this.metadata == null) {
        sb.append("null");
      } else {
        sb.append(this.metadata);
      }
      first = false;
    }
    if (isSetCursorName()) {
      if (!first) sb.append(", ");
      sb.append("cursorName:");
      if (this.cursorName == null) {
        sb.append("null");
      } else {
        sb.append(this.cursorName);
      }
      first = false;
    }
    if (isSetWarnings()) {
      if (!first) sb.append(", ");
      sb.append("warnings:");
      if (this.warnings == null) {
        sb.append("null");
      } else {
        sb.append(this.warnings);
      }
      first = false;
    }
    if (isSetRowIdsForUpdateOrDelete()) {
      if (!first) sb.append(", ");
      sb.append("rowIdsForUpdateOrDelete:");
      if (this.rowIdsForUpdateOrDelete == null) {
        sb.append("null");
      } else {
        sb.append(this.rowIdsForUpdateOrDelete);
      }
      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 'flags' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'cursorId' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'statementId' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'connId' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
    if (source != null) {
      source.validate();
    }
    if (warnings != null) {
      warnings.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, 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 RowSetStandardSchemeFactory implements SchemeFactory {
    public RowSetStandardScheme getScheme() {
      return new RowSetStandardScheme();
    }
  }

  private static class RowSetStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, RowSet 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 _list204 = iprot.readListBegin();
                struct.rows = new ArrayList(_list204.size);
                Row _elem205;
                for (int _i206 = 0; _i206 < _list204.size; ++_i206)
                {
                  _elem205 = new Row();
                  _elem205.read(iprot);
                  struct.rows.add(_elem205);
                }
                iprot.readListEnd();
              }
              struct.setRowsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FLAGS
            if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
              struct.flags = iprot.readByte();
              struct.setFlagsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CURSOR_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.cursorId = iprot.readI64();
              struct.setCursorIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // STATEMENT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.statementId = iprot.readI64();
              struct.setStatementIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // CONN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.connId = iprot.readI64();
              struct.setConnIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.token = iprot.readBinary();
              struct.setTokenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SOURCE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.source = new HostAddress();
              struct.source.read(iprot);
              struct.setSourceIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // OFFSET
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.offset = iprot.readI32();
              struct.setOffsetIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // METADATA
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list207 = iprot.readListBegin();
                struct.metadata = new ArrayList(_list207.size);
                ColumnDescriptor _elem208;
                for (int _i209 = 0; _i209 < _list207.size; ++_i209)
                {
                  _elem208 = new ColumnDescriptor();
                  _elem208.read(iprot);
                  struct.metadata.add(_elem208);
                }
                iprot.readListEnd();
              }
              struct.setMetadataIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // CURSOR_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.cursorName = iprot.readString();
              struct.setCursorNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // WARNINGS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.warnings = new SnappyExceptionData();
              struct.warnings.read(iprot);
              struct.setWarningsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // ROW_IDS_FOR_UPDATE_OR_DELETE
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list210 = iprot.readListBegin();
                struct.rowIdsForUpdateOrDelete = new ArrayList(_list210.size);
                long _elem211;
                for (int _i212 = 0; _i212 < _list210.size; ++_i212)
                {
                  _elem211 = iprot.readI64();
                  struct.rowIdsForUpdateOrDelete.add(_elem211);
                }
                iprot.readListEnd();
              }
              struct.setRowIdsForUpdateOrDeleteIsSet(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.isSetFlags()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'flags' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetCursorId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'cursorId' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetStatementId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'statementId' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetConnId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'connId' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, RowSet 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.STRUCT, struct.rows.size()));
          for (Row _iter213 : struct.rows)
          {
            _iter213.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(FLAGS_FIELD_DESC);
      oprot.writeByte(struct.flags);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CURSOR_ID_FIELD_DESC);
      oprot.writeI64(struct.cursorId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(STATEMENT_ID_FIELD_DESC);
      oprot.writeI64(struct.statementId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(CONN_ID_FIELD_DESC);
      oprot.writeI64(struct.connId);
      oprot.writeFieldEnd();
      if (struct.token != null) {
        if (struct.isSetToken()) {
          oprot.writeFieldBegin(TOKEN_FIELD_DESC);
          oprot.writeBinary(struct.token);
          oprot.writeFieldEnd();
        }
      }
      if (struct.source != null) {
        if (struct.isSetSource()) {
          oprot.writeFieldBegin(SOURCE_FIELD_DESC);
          struct.source.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetOffset()) {
        oprot.writeFieldBegin(OFFSET_FIELD_DESC);
        oprot.writeI32(struct.offset);
        oprot.writeFieldEnd();
      }
      if (struct.metadata != null) {
        if (struct.isSetMetadata()) {
          oprot.writeFieldBegin(METADATA_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.metadata.size()));
            for (ColumnDescriptor _iter214 : struct.metadata)
            {
              _iter214.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.cursorName != null) {
        if (struct.isSetCursorName()) {
          oprot.writeFieldBegin(CURSOR_NAME_FIELD_DESC);
          oprot.writeString(struct.cursorName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.warnings != null) {
        if (struct.isSetWarnings()) {
          oprot.writeFieldBegin(WARNINGS_FIELD_DESC);
          struct.warnings.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.rowIdsForUpdateOrDelete != null) {
        if (struct.isSetRowIdsForUpdateOrDelete()) {
          oprot.writeFieldBegin(ROW_IDS_FOR_UPDATE_OR_DELETE_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.rowIdsForUpdateOrDelete.size()));
            for (long _iter215 : struct.rowIdsForUpdateOrDelete)
            {
              oprot.writeI64(_iter215);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RowSetTupleSchemeFactory implements SchemeFactory {
    public RowSetTupleScheme getScheme() {
      return new RowSetTupleScheme();
    }
  }

  private static class RowSetTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, RowSet struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      {
        oprot.writeI32(struct.rows.size());
        for (Row _iter216 : struct.rows)
        {
          _iter216.write(oprot);
        }
      }
      oprot.writeByte(struct.flags);
      oprot.writeI64(struct.cursorId);
      oprot.writeI64(struct.statementId);
      oprot.writeI64(struct.connId);
      BitSet optionals = new BitSet();
      if (struct.isSetToken()) {
        optionals.set(0);
      }
      if (struct.isSetSource()) {
        optionals.set(1);
      }
      if (struct.isSetOffset()) {
        optionals.set(2);
      }
      if (struct.isSetMetadata()) {
        optionals.set(3);
      }
      if (struct.isSetCursorName()) {
        optionals.set(4);
      }
      if (struct.isSetWarnings()) {
        optionals.set(5);
      }
      if (struct.isSetRowIdsForUpdateOrDelete()) {
        optionals.set(6);
      }
      oprot.writeBitSet(optionals, 7);
      if (struct.isSetToken()) {
        oprot.writeBinary(struct.token);
      }
      if (struct.isSetSource()) {
        struct.source.write(oprot);
      }
      if (struct.isSetOffset()) {
        oprot.writeI32(struct.offset);
      }
      if (struct.isSetMetadata()) {
        {
          oprot.writeI32(struct.metadata.size());
          for (ColumnDescriptor _iter217 : struct.metadata)
          {
            _iter217.write(oprot);
          }
        }
      }
      if (struct.isSetCursorName()) {
        oprot.writeString(struct.cursorName);
      }
      if (struct.isSetWarnings()) {
        struct.warnings.write(oprot);
      }
      if (struct.isSetRowIdsForUpdateOrDelete()) {
        {
          oprot.writeI32(struct.rowIdsForUpdateOrDelete.size());
          for (long _iter218 : struct.rowIdsForUpdateOrDelete)
          {
            oprot.writeI64(_iter218);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, RowSet struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list219 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
        struct.rows = new ArrayList(_list219.size);
        Row _elem220;
        for (int _i221 = 0; _i221 < _list219.size; ++_i221)
        {
          _elem220 = new Row();
          _elem220.read(iprot);
          struct.rows.add(_elem220);
        }
      }
      struct.setRowsIsSet(true);
      struct.flags = iprot.readByte();
      struct.setFlagsIsSet(true);
      struct.cursorId = iprot.readI64();
      struct.setCursorIdIsSet(true);
      struct.statementId = iprot.readI64();
      struct.setStatementIdIsSet(true);
      struct.connId = iprot.readI64();
      struct.setConnIdIsSet(true);
      BitSet incoming = iprot.readBitSet(7);
      if (incoming.get(0)) {
        struct.token = iprot.readBinary();
        struct.setTokenIsSet(true);
      }
      if (incoming.get(1)) {
        struct.source = new HostAddress();
        struct.source.read(iprot);
        struct.setSourceIsSet(true);
      }
      if (incoming.get(2)) {
        struct.offset = iprot.readI32();
        struct.setOffsetIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list222 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.metadata = new ArrayList(_list222.size);
          ColumnDescriptor _elem223;
          for (int _i224 = 0; _i224 < _list222.size; ++_i224)
          {
            _elem223 = new ColumnDescriptor();
            _elem223.read(iprot);
            struct.metadata.add(_elem223);
          }
        }
        struct.setMetadataIsSet(true);
      }
      if (incoming.get(4)) {
        struct.cursorName = iprot.readString();
        struct.setCursorNameIsSet(true);
      }
      if (incoming.get(5)) {
        struct.warnings = new SnappyExceptionData();
        struct.warnings.read(iprot);
        struct.setWarningsIsSet(true);
      }
      if (incoming.get(6)) {
        {
          org.apache.thrift.protocol.TList _list225 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.rowIdsForUpdateOrDelete = new ArrayList(_list225.size);
          long _elem226;
          for (int _i227 = 0; _i227 < _list225.size; ++_i227)
          {
            _elem226 = iprot.readI64();
            struct.rowIdsForUpdateOrDelete.add(_elem226);
          }
        }
        struct.setRowIdsForUpdateOrDeleteIsSet(true);
      }
    }
  }

}