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

com.xiaomi.infra.galaxy.sds.thrift.ScanRequest Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaomi.infra.galaxy.sds.thrift;

import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;

import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.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"})
/**
 * 范围查询,支持主键和二级索引查询,
 * 查询范围为闭开区间[startKey, endKey),
 * 当指定索引时,查询范围的entity group必须唯一指定
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-21")
public class ScanRequest implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("ScanRequest");

  private static final libthrift091.protocol.TField TABLE_NAME_FIELD_DESC = new libthrift091.protocol.TField("tableName", libthrift091.protocol.TType.STRING, (short)1);
  private static final libthrift091.protocol.TField INDEX_NAME_FIELD_DESC = new libthrift091.protocol.TField("indexName", libthrift091.protocol.TType.STRING, (short)2);
  private static final libthrift091.protocol.TField START_KEY_FIELD_DESC = new libthrift091.protocol.TField("startKey", libthrift091.protocol.TType.MAP, (short)3);
  private static final libthrift091.protocol.TField STOP_KEY_FIELD_DESC = new libthrift091.protocol.TField("stopKey", libthrift091.protocol.TType.MAP, (short)4);
  private static final libthrift091.protocol.TField ATTRIBUTES_FIELD_DESC = new libthrift091.protocol.TField("attributes", libthrift091.protocol.TType.LIST, (short)5);
  private static final libthrift091.protocol.TField CONDITION_FIELD_DESC = new libthrift091.protocol.TField("condition", libthrift091.protocol.TType.STRING, (short)6);
  private static final libthrift091.protocol.TField LIMIT_FIELD_DESC = new libthrift091.protocol.TField("limit", libthrift091.protocol.TType.I32, (short)7);
  private static final libthrift091.protocol.TField REVERSE_FIELD_DESC = new libthrift091.protocol.TField("reverse", libthrift091.protocol.TType.BOOL, (short)8);
  private static final libthrift091.protocol.TField IN_GLOBAL_ORDER_FIELD_DESC = new libthrift091.protocol.TField("inGlobalOrder", libthrift091.protocol.TType.BOOL, (short)9);
  private static final libthrift091.protocol.TField CACHE_RESULT_FIELD_DESC = new libthrift091.protocol.TField("cacheResult", libthrift091.protocol.TType.BOOL, (short)10);
  private static final libthrift091.protocol.TField LOOK_AHEAD_STEP_FIELD_DESC = new libthrift091.protocol.TField("lookAheadStep", libthrift091.protocol.TType.I32, (short)11);
  private static final libthrift091.protocol.TField ACTION_FIELD_DESC = new libthrift091.protocol.TField("action", libthrift091.protocol.TType.STRUCT, (short)12);

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

  public String tableName; // optional
  /**
   * 不指定表示通过主键进行查询
   */
  public String indexName; // optional
  /**
   * 查询范围开始,包含startKey,
   * 如果startKey不是完整键,而是部分key的前缀,则实际查询的startKey为{startKey, 小可能的后缀}补全形式
   */
  public Map startKey; // optional
  /**
   * 查询范围结束,不包含stopKey,
   * 如果stopKey不是完整键,而是部分key的前缀,则实际查询的stopKey为{stopKey, 最大可能的后缀}补全形式
   */
  public Map stopKey; // optional
  /**
   * 需要返回的属性列表,不指定表示返回所有属性
   */
  public List attributes; // optional
  /**
   * 类SQL WHERE语句的查询条件。
   * 注意:与SQL不同,此条件仅作为过滤条件,不影响具体查询计划(index, startKey, endKey),
   * 进行范围查询时需要显示设置index和startKey以及endKey。每个扫描的记录均计入读配额,
   * 即使不满足查询条件。尽量避免使用条件过滤,尤其是当过滤掉的记录占一半以上时,强烈不建议使用。
   */
  public String condition; // optional
  /**
   * 返回记录的最大数目,返回数目可能小于此值(如超出表的读配额时)
   */
  public int limit; // optional
  /**
   * 是否进行逆序扫描,进行逆序扫描时startKey应大于endKey,
   * 注意:逆序查询效率较低,谨慎使用,建议设置对应的Key为逆序存储
   */
  public boolean reverse; // optional
  /**
   * 是否全局有序扫描
   */
  public boolean inGlobalOrder; // optional
  /**
   * 是否将结果放入cache,对于类似MapReduce的大批量扫描的应用应该关闭此选项
   */
  public boolean cacheResult; // optional
  /**
   * 查找属性在seek之前进行顺序skip的次数。非必要情况,请不要设置
   */
  public int lookAheadStep; // optional
  /**
   * scan时的连带操作,包括COUNT,DELETE和UPDATE
   */
  public ScanAction action; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements libthrift091.TFieldIdEnum {
    TABLE_NAME((short)1, "tableName"),
    /**
     * 不指定表示通过主键进行查询
     */
    INDEX_NAME((short)2, "indexName"),
    /**
     * 查询范围开始,包含startKey,
     * 如果startKey不是完整键,而是部分key的前缀,则实际查询的startKey为{startKey, 小可能的后缀}补全形式
     */
    START_KEY((short)3, "startKey"),
    /**
     * 查询范围结束,不包含stopKey,
     * 如果stopKey不是完整键,而是部分key的前缀,则实际查询的stopKey为{stopKey, 最大可能的后缀}补全形式
     */
    STOP_KEY((short)4, "stopKey"),
    /**
     * 需要返回的属性列表,不指定表示返回所有属性
     */
    ATTRIBUTES((short)5, "attributes"),
    /**
     * 类SQL WHERE语句的查询条件。
     * 注意:与SQL不同,此条件仅作为过滤条件,不影响具体查询计划(index, startKey, endKey),
     * 进行范围查询时需要显示设置index和startKey以及endKey。每个扫描的记录均计入读配额,
     * 即使不满足查询条件。尽量避免使用条件过滤,尤其是当过滤掉的记录占一半以上时,强烈不建议使用。
     */
    CONDITION((short)6, "condition"),
    /**
     * 返回记录的最大数目,返回数目可能小于此值(如超出表的读配额时)
     */
    LIMIT((short)7, "limit"),
    /**
     * 是否进行逆序扫描,进行逆序扫描时startKey应大于endKey,
     * 注意:逆序查询效率较低,谨慎使用,建议设置对应的Key为逆序存储
     */
    REVERSE((short)8, "reverse"),
    /**
     * 是否全局有序扫描
     */
    IN_GLOBAL_ORDER((short)9, "inGlobalOrder"),
    /**
     * 是否将结果放入cache,对于类似MapReduce的大批量扫描的应用应该关闭此选项
     */
    CACHE_RESULT((short)10, "cacheResult"),
    /**
     * 查找属性在seek之前进行顺序skip的次数。非必要情况,请不要设置
     */
    LOOK_AHEAD_STEP((short)11, "lookAheadStep"),
    /**
     * scan时的连带操作,包括COUNT,DELETE和UPDATE
     */
    ACTION((short)12, "action");

    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: // TABLE_NAME
          return TABLE_NAME;
        case 2: // INDEX_NAME
          return INDEX_NAME;
        case 3: // START_KEY
          return START_KEY;
        case 4: // STOP_KEY
          return STOP_KEY;
        case 5: // ATTRIBUTES
          return ATTRIBUTES;
        case 6: // CONDITION
          return CONDITION;
        case 7: // LIMIT
          return LIMIT;
        case 8: // REVERSE
          return REVERSE;
        case 9: // IN_GLOBAL_ORDER
          return IN_GLOBAL_ORDER;
        case 10: // CACHE_RESULT
          return CACHE_RESULT;
        case 11: // LOOK_AHEAD_STEP
          return LOOK_AHEAD_STEP;
        case 12: // ACTION
          return ACTION;
        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 __LIMIT_ISSET_ID = 0;
  private static final int __REVERSE_ISSET_ID = 1;
  private static final int __INGLOBALORDER_ISSET_ID = 2;
  private static final int __CACHERESULT_ISSET_ID = 3;
  private static final int __LOOKAHEADSTEP_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TABLE_NAME,_Fields.INDEX_NAME,_Fields.START_KEY,_Fields.STOP_KEY,_Fields.ATTRIBUTES,_Fields.CONDITION,_Fields.LIMIT,_Fields.REVERSE,_Fields.IN_GLOBAL_ORDER,_Fields.CACHE_RESULT,_Fields.LOOK_AHEAD_STEP,_Fields.ACTION};
  public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TABLE_NAME, new libthrift091.meta_data.FieldMetaData("tableName", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
    tmpMap.put(_Fields.INDEX_NAME, new libthrift091.meta_data.FieldMetaData("indexName", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
    tmpMap.put(_Fields.START_KEY, new libthrift091.meta_data.FieldMetaData("startKey", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.MAP        , "Dictionary")));
    tmpMap.put(_Fields.STOP_KEY, new libthrift091.meta_data.FieldMetaData("stopKey", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.MAP        , "Dictionary")));
    tmpMap.put(_Fields.ATTRIBUTES, new libthrift091.meta_data.FieldMetaData("attributes", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.LIST        , "Attributes")));
    tmpMap.put(_Fields.CONDITION, new libthrift091.meta_data.FieldMetaData("condition", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
    tmpMap.put(_Fields.LIMIT, new libthrift091.meta_data.FieldMetaData("limit", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I32)));
    tmpMap.put(_Fields.REVERSE, new libthrift091.meta_data.FieldMetaData("reverse", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IN_GLOBAL_ORDER, new libthrift091.meta_data.FieldMetaData("inGlobalOrder", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
    tmpMap.put(_Fields.CACHE_RESULT, new libthrift091.meta_data.FieldMetaData("cacheResult", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.BOOL)));
    tmpMap.put(_Fields.LOOK_AHEAD_STEP, new libthrift091.meta_data.FieldMetaData("lookAheadStep", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I32)));
    tmpMap.put(_Fields.ACTION, new libthrift091.meta_data.FieldMetaData("action", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, ScanAction.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(ScanRequest.class, metaDataMap);
  }

  public ScanRequest() {
    this.limit = 10;

    this.reverse = false;

    this.inGlobalOrder = true;

    this.cacheResult = true;

    this.lookAheadStep = 0;

  }

  /**
   * Performs a deep copy on other.
   */
  public ScanRequest(ScanRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetTableName()) {
      this.tableName = other.tableName;
    }
    if (other.isSetIndexName()) {
      this.indexName = other.indexName;
    }
    if (other.isSetStartKey()) {
      this.startKey = other.startKey;
    }
    if (other.isSetStopKey()) {
      this.stopKey = other.stopKey;
    }
    if (other.isSetAttributes()) {
      this.attributes = other.attributes;
    }
    if (other.isSetCondition()) {
      this.condition = other.condition;
    }
    this.limit = other.limit;
    this.reverse = other.reverse;
    this.inGlobalOrder = other.inGlobalOrder;
    this.cacheResult = other.cacheResult;
    this.lookAheadStep = other.lookAheadStep;
    if (other.isSetAction()) {
      this.action = new ScanAction(other.action);
    }
  }

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

  @Override
  public void clear() {
    this.tableName = null;
    this.indexName = null;
    this.startKey = null;
    this.stopKey = null;
    this.attributes = null;
    this.condition = null;
    this.limit = 10;

    this.reverse = false;

    this.inGlobalOrder = true;

    this.cacheResult = true;

    this.lookAheadStep = 0;

    this.action = null;
  }

  public String getTableName() {
    return this.tableName;
  }

  public ScanRequest setTableName(String tableName) {
    this.tableName = tableName;
    return this;
  }

  public void unsetTableName() {
    this.tableName = null;
  }

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

  public void setTableNameIsSet(boolean value) {
    if (!value) {
      this.tableName = null;
    }
  }

  /**
   * 不指定表示通过主键进行查询
   */
  public String getIndexName() {
    return this.indexName;
  }

  /**
   * 不指定表示通过主键进行查询
   */
  public ScanRequest setIndexName(String indexName) {
    this.indexName = indexName;
    return this;
  }

  public void unsetIndexName() {
    this.indexName = null;
  }

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

  public void setIndexNameIsSet(boolean value) {
    if (!value) {
      this.indexName = null;
    }
  }

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

  public void putToStartKey(String key, Datum val) {
    if (this.startKey == null) {
      this.startKey = new HashMap();
    }
    this.startKey.put(key, val);
  }

  /**
   * 查询范围开始,包含startKey,
   * 如果startKey不是完整键,而是部分key的前缀,则实际查询的startKey为{startKey, 小可能的后缀}补全形式
   */
  public Map getStartKey() {
    return this.startKey;
  }

  /**
   * 查询范围开始,包含startKey,
   * 如果startKey不是完整键,而是部分key的前缀,则实际查询的startKey为{startKey, 小可能的后缀}补全形式
   */
  public ScanRequest setStartKey(Map startKey) {
    this.startKey = startKey;
    return this;
  }

  public void unsetStartKey() {
    this.startKey = null;
  }

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

  public void setStartKeyIsSet(boolean value) {
    if (!value) {
      this.startKey = null;
    }
  }

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

  public void putToStopKey(String key, Datum val) {
    if (this.stopKey == null) {
      this.stopKey = new HashMap();
    }
    this.stopKey.put(key, val);
  }

  /**
   * 查询范围结束,不包含stopKey,
   * 如果stopKey不是完整键,而是部分key的前缀,则实际查询的stopKey为{stopKey, 最大可能的后缀}补全形式
   */
  public Map getStopKey() {
    return this.stopKey;
  }

  /**
   * 查询范围结束,不包含stopKey,
   * 如果stopKey不是完整键,而是部分key的前缀,则实际查询的stopKey为{stopKey, 最大可能的后缀}补全形式
   */
  public ScanRequest setStopKey(Map stopKey) {
    this.stopKey = stopKey;
    return this;
  }

  public void unsetStopKey() {
    this.stopKey = null;
  }

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

  public void setStopKeyIsSet(boolean value) {
    if (!value) {
      this.stopKey = null;
    }
  }

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

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

  public void addToAttributes(String elem) {
    if (this.attributes == null) {
      this.attributes = new ArrayList();
    }
    this.attributes.add(elem);
  }

  /**
   * 需要返回的属性列表,不指定表示返回所有属性
   */
  public List getAttributes() {
    return this.attributes;
  }

  /**
   * 需要返回的属性列表,不指定表示返回所有属性
   */
  public ScanRequest setAttributes(List attributes) {
    this.attributes = attributes;
    return this;
  }

  public void unsetAttributes() {
    this.attributes = null;
  }

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

  public void setAttributesIsSet(boolean value) {
    if (!value) {
      this.attributes = null;
    }
  }

  /**
   * 类SQL WHERE语句的查询条件。
   * 注意:与SQL不同,此条件仅作为过滤条件,不影响具体查询计划(index, startKey, endKey),
   * 进行范围查询时需要显示设置index和startKey以及endKey。每个扫描的记录均计入读配额,
   * 即使不满足查询条件。尽量避免使用条件过滤,尤其是当过滤掉的记录占一半以上时,强烈不建议使用。
   */
  public String getCondition() {
    return this.condition;
  }

  /**
   * 类SQL WHERE语句的查询条件。
   * 注意:与SQL不同,此条件仅作为过滤条件,不影响具体查询计划(index, startKey, endKey),
   * 进行范围查询时需要显示设置index和startKey以及endKey。每个扫描的记录均计入读配额,
   * 即使不满足查询条件。尽量避免使用条件过滤,尤其是当过滤掉的记录占一半以上时,强烈不建议使用。
   */
  public ScanRequest setCondition(String condition) {
    this.condition = condition;
    return this;
  }

  public void unsetCondition() {
    this.condition = null;
  }

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

  public void setConditionIsSet(boolean value) {
    if (!value) {
      this.condition = null;
    }
  }

  /**
   * 返回记录的最大数目,返回数目可能小于此值(如超出表的读配额时)
   */
  public int getLimit() {
    return this.limit;
  }

  /**
   * 返回记录的最大数目,返回数目可能小于此值(如超出表的读配额时)
   */
  public ScanRequest setLimit(int limit) {
    this.limit = limit;
    setLimitIsSet(true);
    return this;
  }

  public void unsetLimit() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIMIT_ISSET_ID);
  }

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

  public void setLimitIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIMIT_ISSET_ID, value);
  }

  /**
   * 是否进行逆序扫描,进行逆序扫描时startKey应大于endKey,
   * 注意:逆序查询效率较低,谨慎使用,建议设置对应的Key为逆序存储
   */
  public boolean isReverse() {
    return this.reverse;
  }

  /**
   * 是否进行逆序扫描,进行逆序扫描时startKey应大于endKey,
   * 注意:逆序查询效率较低,谨慎使用,建议设置对应的Key为逆序存储
   */
  public ScanRequest setReverse(boolean reverse) {
    this.reverse = reverse;
    setReverseIsSet(true);
    return this;
  }

  public void unsetReverse() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __REVERSE_ISSET_ID);
  }

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

  public void setReverseIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __REVERSE_ISSET_ID, value);
  }

  /**
   * 是否全局有序扫描
   */
  public boolean isInGlobalOrder() {
    return this.inGlobalOrder;
  }

  /**
   * 是否全局有序扫描
   */
  public ScanRequest setInGlobalOrder(boolean inGlobalOrder) {
    this.inGlobalOrder = inGlobalOrder;
    setInGlobalOrderIsSet(true);
    return this;
  }

  public void unsetInGlobalOrder() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INGLOBALORDER_ISSET_ID);
  }

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

  public void setInGlobalOrderIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INGLOBALORDER_ISSET_ID, value);
  }

  /**
   * 是否将结果放入cache,对于类似MapReduce的大批量扫描的应用应该关闭此选项
   */
  public boolean isCacheResult() {
    return this.cacheResult;
  }

  /**
   * 是否将结果放入cache,对于类似MapReduce的大批量扫描的应用应该关闭此选项
   */
  public ScanRequest setCacheResult(boolean cacheResult) {
    this.cacheResult = cacheResult;
    setCacheResultIsSet(true);
    return this;
  }

  public void unsetCacheResult() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CACHERESULT_ISSET_ID);
  }

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

  public void setCacheResultIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CACHERESULT_ISSET_ID, value);
  }

  /**
   * 查找属性在seek之前进行顺序skip的次数。非必要情况,请不要设置
   */
  public int getLookAheadStep() {
    return this.lookAheadStep;
  }

  /**
   * 查找属性在seek之前进行顺序skip的次数。非必要情况,请不要设置
   */
  public ScanRequest setLookAheadStep(int lookAheadStep) {
    this.lookAheadStep = lookAheadStep;
    setLookAheadStepIsSet(true);
    return this;
  }

  public void unsetLookAheadStep() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LOOKAHEADSTEP_ISSET_ID);
  }

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

  public void setLookAheadStepIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LOOKAHEADSTEP_ISSET_ID, value);
  }

  /**
   * scan时的连带操作,包括COUNT,DELETE和UPDATE
   */
  public ScanAction getAction() {
    return this.action;
  }

  /**
   * scan时的连带操作,包括COUNT,DELETE和UPDATE
   */
  public ScanRequest setAction(ScanAction action) {
    this.action = action;
    return this;
  }

  public void unsetAction() {
    this.action = null;
  }

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

  public void setActionIsSet(boolean value) {
    if (!value) {
      this.action = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TABLE_NAME:
      if (value == null) {
        unsetTableName();
      } else {
        setTableName((String)value);
      }
      break;

    case INDEX_NAME:
      if (value == null) {
        unsetIndexName();
      } else {
        setIndexName((String)value);
      }
      break;

    case START_KEY:
      if (value == null) {
        unsetStartKey();
      } else {
        setStartKey((Map)value);
      }
      break;

    case STOP_KEY:
      if (value == null) {
        unsetStopKey();
      } else {
        setStopKey((Map)value);
      }
      break;

    case ATTRIBUTES:
      if (value == null) {
        unsetAttributes();
      } else {
        setAttributes((List)value);
      }
      break;

    case CONDITION:
      if (value == null) {
        unsetCondition();
      } else {
        setCondition((String)value);
      }
      break;

    case LIMIT:
      if (value == null) {
        unsetLimit();
      } else {
        setLimit((Integer)value);
      }
      break;

    case REVERSE:
      if (value == null) {
        unsetReverse();
      } else {
        setReverse((Boolean)value);
      }
      break;

    case IN_GLOBAL_ORDER:
      if (value == null) {
        unsetInGlobalOrder();
      } else {
        setInGlobalOrder((Boolean)value);
      }
      break;

    case CACHE_RESULT:
      if (value == null) {
        unsetCacheResult();
      } else {
        setCacheResult((Boolean)value);
      }
      break;

    case LOOK_AHEAD_STEP:
      if (value == null) {
        unsetLookAheadStep();
      } else {
        setLookAheadStep((Integer)value);
      }
      break;

    case ACTION:
      if (value == null) {
        unsetAction();
      } else {
        setAction((ScanAction)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TABLE_NAME:
      return getTableName();

    case INDEX_NAME:
      return getIndexName();

    case START_KEY:
      return getStartKey();

    case STOP_KEY:
      return getStopKey();

    case ATTRIBUTES:
      return getAttributes();

    case CONDITION:
      return getCondition();

    case LIMIT:
      return Integer.valueOf(getLimit());

    case REVERSE:
      return Boolean.valueOf(isReverse());

    case IN_GLOBAL_ORDER:
      return Boolean.valueOf(isInGlobalOrder());

    case CACHE_RESULT:
      return Boolean.valueOf(isCacheResult());

    case LOOK_AHEAD_STEP:
      return Integer.valueOf(getLookAheadStep());

    case ACTION:
      return getAction();

    }
    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 TABLE_NAME:
      return isSetTableName();
    case INDEX_NAME:
      return isSetIndexName();
    case START_KEY:
      return isSetStartKey();
    case STOP_KEY:
      return isSetStopKey();
    case ATTRIBUTES:
      return isSetAttributes();
    case CONDITION:
      return isSetCondition();
    case LIMIT:
      return isSetLimit();
    case REVERSE:
      return isSetReverse();
    case IN_GLOBAL_ORDER:
      return isSetInGlobalOrder();
    case CACHE_RESULT:
      return isSetCacheResult();
    case LOOK_AHEAD_STEP:
      return isSetLookAheadStep();
    case ACTION:
      return isSetAction();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_tableName = true && this.isSetTableName();
    boolean that_present_tableName = true && that.isSetTableName();
    if (this_present_tableName || that_present_tableName) {
      if (!(this_present_tableName && that_present_tableName))
        return false;
      if (!this.tableName.equals(that.tableName))
        return false;
    }

    boolean this_present_indexName = true && this.isSetIndexName();
    boolean that_present_indexName = true && that.isSetIndexName();
    if (this_present_indexName || that_present_indexName) {
      if (!(this_present_indexName && that_present_indexName))
        return false;
      if (!this.indexName.equals(that.indexName))
        return false;
    }

    boolean this_present_startKey = true && this.isSetStartKey();
    boolean that_present_startKey = true && that.isSetStartKey();
    if (this_present_startKey || that_present_startKey) {
      if (!(this_present_startKey && that_present_startKey))
        return false;
      if (!this.startKey.equals(that.startKey))
        return false;
    }

    boolean this_present_stopKey = true && this.isSetStopKey();
    boolean that_present_stopKey = true && that.isSetStopKey();
    if (this_present_stopKey || that_present_stopKey) {
      if (!(this_present_stopKey && that_present_stopKey))
        return false;
      if (!this.stopKey.equals(that.stopKey))
        return false;
    }

    boolean this_present_attributes = true && this.isSetAttributes();
    boolean that_present_attributes = true && that.isSetAttributes();
    if (this_present_attributes || that_present_attributes) {
      if (!(this_present_attributes && that_present_attributes))
        return false;
      if (!this.attributes.equals(that.attributes))
        return false;
    }

    boolean this_present_condition = true && this.isSetCondition();
    boolean that_present_condition = true && that.isSetCondition();
    if (this_present_condition || that_present_condition) {
      if (!(this_present_condition && that_present_condition))
        return false;
      if (!this.condition.equals(that.condition))
        return false;
    }

    boolean this_present_limit = true && this.isSetLimit();
    boolean that_present_limit = true && that.isSetLimit();
    if (this_present_limit || that_present_limit) {
      if (!(this_present_limit && that_present_limit))
        return false;
      if (this.limit != that.limit)
        return false;
    }

    boolean this_present_reverse = true && this.isSetReverse();
    boolean that_present_reverse = true && that.isSetReverse();
    if (this_present_reverse || that_present_reverse) {
      if (!(this_present_reverse && that_present_reverse))
        return false;
      if (this.reverse != that.reverse)
        return false;
    }

    boolean this_present_inGlobalOrder = true && this.isSetInGlobalOrder();
    boolean that_present_inGlobalOrder = true && that.isSetInGlobalOrder();
    if (this_present_inGlobalOrder || that_present_inGlobalOrder) {
      if (!(this_present_inGlobalOrder && that_present_inGlobalOrder))
        return false;
      if (this.inGlobalOrder != that.inGlobalOrder)
        return false;
    }

    boolean this_present_cacheResult = true && this.isSetCacheResult();
    boolean that_present_cacheResult = true && that.isSetCacheResult();
    if (this_present_cacheResult || that_present_cacheResult) {
      if (!(this_present_cacheResult && that_present_cacheResult))
        return false;
      if (this.cacheResult != that.cacheResult)
        return false;
    }

    boolean this_present_lookAheadStep = true && this.isSetLookAheadStep();
    boolean that_present_lookAheadStep = true && that.isSetLookAheadStep();
    if (this_present_lookAheadStep || that_present_lookAheadStep) {
      if (!(this_present_lookAheadStep && that_present_lookAheadStep))
        return false;
      if (this.lookAheadStep != that.lookAheadStep)
        return false;
    }

    boolean this_present_action = true && this.isSetAction();
    boolean that_present_action = true && that.isSetAction();
    if (this_present_action || that_present_action) {
      if (!(this_present_action && that_present_action))
        return false;
      if (!this.action.equals(that.action))
        return false;
    }

    return true;
  }

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

    boolean present_tableName = true && (isSetTableName());
    list.add(present_tableName);
    if (present_tableName)
      list.add(tableName);

    boolean present_indexName = true && (isSetIndexName());
    list.add(present_indexName);
    if (present_indexName)
      list.add(indexName);

    boolean present_startKey = true && (isSetStartKey());
    list.add(present_startKey);
    if (present_startKey)
      list.add(startKey);

    boolean present_stopKey = true && (isSetStopKey());
    list.add(present_stopKey);
    if (present_stopKey)
      list.add(stopKey);

    boolean present_attributes = true && (isSetAttributes());
    list.add(present_attributes);
    if (present_attributes)
      list.add(attributes);

    boolean present_condition = true && (isSetCondition());
    list.add(present_condition);
    if (present_condition)
      list.add(condition);

    boolean present_limit = true && (isSetLimit());
    list.add(present_limit);
    if (present_limit)
      list.add(limit);

    boolean present_reverse = true && (isSetReverse());
    list.add(present_reverse);
    if (present_reverse)
      list.add(reverse);

    boolean present_inGlobalOrder = true && (isSetInGlobalOrder());
    list.add(present_inGlobalOrder);
    if (present_inGlobalOrder)
      list.add(inGlobalOrder);

    boolean present_cacheResult = true && (isSetCacheResult());
    list.add(present_cacheResult);
    if (present_cacheResult)
      list.add(cacheResult);

    boolean present_lookAheadStep = true && (isSetLookAheadStep());
    list.add(present_lookAheadStep);
    if (present_lookAheadStep)
      list.add(lookAheadStep);

    boolean present_action = true && (isSetAction());
    list.add(present_action);
    if (present_action)
      list.add(action);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTableName()).compareTo(other.isSetTableName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTableName()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.tableName, other.tableName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIndexName()).compareTo(other.isSetIndexName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndexName()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.indexName, other.indexName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(other.isSetStartKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartKey()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.startKey, other.startKey);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStopKey()).compareTo(other.isSetStopKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStopKey()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.stopKey, other.stopKey);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(other.isSetAttributes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAttributes()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.attributes, other.attributes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCondition()).compareTo(other.isSetCondition());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCondition()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.condition, other.condition);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLimit()).compareTo(other.isSetLimit());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLimit()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.limit, other.limit);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReverse()).compareTo(other.isSetReverse());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReverse()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.reverse, other.reverse);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInGlobalOrder()).compareTo(other.isSetInGlobalOrder());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInGlobalOrder()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.inGlobalOrder, other.inGlobalOrder);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCacheResult()).compareTo(other.isSetCacheResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCacheResult()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.cacheResult, other.cacheResult);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLookAheadStep()).compareTo(other.isSetLookAheadStep());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLookAheadStep()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.lookAheadStep, other.lookAheadStep);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAction()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.action, other.action);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

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

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

    if (isSetTableName()) {
      sb.append("tableName:");
      if (this.tableName == null) {
        sb.append("null");
      } else {
        sb.append(this.tableName);
      }
      first = false;
    }
    if (isSetIndexName()) {
      if (!first) sb.append(", ");
      sb.append("indexName:");
      if (this.indexName == null) {
        sb.append("null");
      } else {
        sb.append(this.indexName);
      }
      first = false;
    }
    if (isSetStartKey()) {
      if (!first) sb.append(", ");
      sb.append("startKey:");
      if (this.startKey == null) {
        sb.append("null");
      } else {
        sb.append(this.startKey);
      }
      first = false;
    }
    if (isSetStopKey()) {
      if (!first) sb.append(", ");
      sb.append("stopKey:");
      if (this.stopKey == null) {
        sb.append("null");
      } else {
        sb.append(this.stopKey);
      }
      first = false;
    }
    if (isSetAttributes()) {
      if (!first) sb.append(", ");
      sb.append("attributes:");
      if (this.attributes == null) {
        sb.append("null");
      } else {
        sb.append(this.attributes);
      }
      first = false;
    }
    if (isSetCondition()) {
      if (!first) sb.append(", ");
      sb.append("condition:");
      if (this.condition == null) {
        sb.append("null");
      } else {
        sb.append(this.condition);
      }
      first = false;
    }
    if (isSetLimit()) {
      if (!first) sb.append(", ");
      sb.append("limit:");
      sb.append(this.limit);
      first = false;
    }
    if (isSetReverse()) {
      if (!first) sb.append(", ");
      sb.append("reverse:");
      sb.append(this.reverse);
      first = false;
    }
    if (isSetInGlobalOrder()) {
      if (!first) sb.append(", ");
      sb.append("inGlobalOrder:");
      sb.append(this.inGlobalOrder);
      first = false;
    }
    if (isSetCacheResult()) {
      if (!first) sb.append(", ");
      sb.append("cacheResult:");
      sb.append(this.cacheResult);
      first = false;
    }
    if (isSetLookAheadStep()) {
      if (!first) sb.append(", ");
      sb.append("lookAheadStep:");
      sb.append(this.lookAheadStep);
      first = false;
    }
    if (isSetAction()) {
      if (!first) sb.append(", ");
      sb.append("action:");
      if (this.action == null) {
        sb.append("null");
      } else {
        sb.append(this.action);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws libthrift091.TException {
    // check for required fields
    // check for sub-struct validity
    if (action != null) {
      action.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out)));
    } catch (libthrift091.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 libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
    } catch (libthrift091.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ScanRequestStandardSchemeFactory implements SchemeFactory {
    public ScanRequestStandardScheme getScheme() {
      return new ScanRequestStandardScheme();
    }
  }

  private static class ScanRequestStandardScheme extends StandardScheme {

    public void read(libthrift091.protocol.TProtocol iprot, ScanRequest struct) throws libthrift091.TException {
      libthrift091.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == libthrift091.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // TABLE_NAME
            if (schemeField.type == libthrift091.protocol.TType.STRING) {
              struct.tableName = iprot.readString();
              struct.setTableNameIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // INDEX_NAME
            if (schemeField.type == libthrift091.protocol.TType.STRING) {
              struct.indexName = iprot.readString();
              struct.setIndexNameIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // START_KEY
            if (schemeField.type == libthrift091.protocol.TType.MAP) {
              {
                libthrift091.protocol.TMap _map240 = iprot.readMapBegin();
                struct.startKey = new HashMap(2*_map240.size);
                String _key241;
                Datum _val242;
                for (int _i243 = 0; _i243 < _map240.size; ++_i243)
                {
                  _key241 = iprot.readString();
                  _val242 = new Datum();
                  _val242.read(iprot);
                  struct.startKey.put(_key241, _val242);
                }
                iprot.readMapEnd();
              }
              struct.setStartKeyIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // STOP_KEY
            if (schemeField.type == libthrift091.protocol.TType.MAP) {
              {
                libthrift091.protocol.TMap _map244 = iprot.readMapBegin();
                struct.stopKey = new HashMap(2*_map244.size);
                String _key245;
                Datum _val246;
                for (int _i247 = 0; _i247 < _map244.size; ++_i247)
                {
                  _key245 = iprot.readString();
                  _val246 = new Datum();
                  _val246.read(iprot);
                  struct.stopKey.put(_key245, _val246);
                }
                iprot.readMapEnd();
              }
              struct.setStopKeyIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // ATTRIBUTES
            if (schemeField.type == libthrift091.protocol.TType.LIST) {
              {
                libthrift091.protocol.TList _list248 = iprot.readListBegin();
                struct.attributes = new ArrayList(_list248.size);
                String _elem249;
                for (int _i250 = 0; _i250 < _list248.size; ++_i250)
                {
                  _elem249 = iprot.readString();
                  struct.attributes.add(_elem249);
                }
                iprot.readListEnd();
              }
              struct.setAttributesIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // CONDITION
            if (schemeField.type == libthrift091.protocol.TType.STRING) {
              struct.condition = iprot.readString();
              struct.setConditionIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // LIMIT
            if (schemeField.type == libthrift091.protocol.TType.I32) {
              struct.limit = iprot.readI32();
              struct.setLimitIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // REVERSE
            if (schemeField.type == libthrift091.protocol.TType.BOOL) {
              struct.reverse = iprot.readBool();
              struct.setReverseIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // IN_GLOBAL_ORDER
            if (schemeField.type == libthrift091.protocol.TType.BOOL) {
              struct.inGlobalOrder = iprot.readBool();
              struct.setInGlobalOrderIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // CACHE_RESULT
            if (schemeField.type == libthrift091.protocol.TType.BOOL) {
              struct.cacheResult = iprot.readBool();
              struct.setCacheResultIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // LOOK_AHEAD_STEP
            if (schemeField.type == libthrift091.protocol.TType.I32) {
              struct.lookAheadStep = iprot.readI32();
              struct.setLookAheadStepIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // ACTION
            if (schemeField.type == libthrift091.protocol.TType.STRUCT) {
              struct.action = new ScanAction();
              struct.action.read(iprot);
              struct.setActionIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            libthrift091.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(libthrift091.protocol.TProtocol oprot, ScanRequest struct) throws libthrift091.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.tableName != null) {
        if (struct.isSetTableName()) {
          oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
          oprot.writeString(struct.tableName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.indexName != null) {
        if (struct.isSetIndexName()) {
          oprot.writeFieldBegin(INDEX_NAME_FIELD_DESC);
          oprot.writeString(struct.indexName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.startKey != null) {
        if (struct.isSetStartKey()) {
          oprot.writeFieldBegin(START_KEY_FIELD_DESC);
          {
            oprot.writeMapBegin(new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRUCT, struct.startKey.size()));
            for (Map.Entry _iter251 : struct.startKey.entrySet())
            {
              oprot.writeString(_iter251.getKey());
              _iter251.getValue().write(oprot);
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.stopKey != null) {
        if (struct.isSetStopKey()) {
          oprot.writeFieldBegin(STOP_KEY_FIELD_DESC);
          {
            oprot.writeMapBegin(new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRUCT, struct.stopKey.size()));
            for (Map.Entry _iter252 : struct.stopKey.entrySet())
            {
              oprot.writeString(_iter252.getKey());
              _iter252.getValue().write(oprot);
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.attributes != null) {
        if (struct.isSetAttributes()) {
          oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
          {
            oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRING, struct.attributes.size()));
            for (String _iter253 : struct.attributes)
            {
              oprot.writeString(_iter253);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.condition != null) {
        if (struct.isSetCondition()) {
          oprot.writeFieldBegin(CONDITION_FIELD_DESC);
          oprot.writeString(struct.condition);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetLimit()) {
        oprot.writeFieldBegin(LIMIT_FIELD_DESC);
        oprot.writeI32(struct.limit);
        oprot.writeFieldEnd();
      }
      if (struct.isSetReverse()) {
        oprot.writeFieldBegin(REVERSE_FIELD_DESC);
        oprot.writeBool(struct.reverse);
        oprot.writeFieldEnd();
      }
      if (struct.isSetInGlobalOrder()) {
        oprot.writeFieldBegin(IN_GLOBAL_ORDER_FIELD_DESC);
        oprot.writeBool(struct.inGlobalOrder);
        oprot.writeFieldEnd();
      }
      if (struct.isSetCacheResult()) {
        oprot.writeFieldBegin(CACHE_RESULT_FIELD_DESC);
        oprot.writeBool(struct.cacheResult);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLookAheadStep()) {
        oprot.writeFieldBegin(LOOK_AHEAD_STEP_FIELD_DESC);
        oprot.writeI32(struct.lookAheadStep);
        oprot.writeFieldEnd();
      }
      if (struct.action != null) {
        if (struct.isSetAction()) {
          oprot.writeFieldBegin(ACTION_FIELD_DESC);
          struct.action.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ScanRequestTupleSchemeFactory implements SchemeFactory {
    public ScanRequestTupleScheme getScheme() {
      return new ScanRequestTupleScheme();
    }
  }

  private static class ScanRequestTupleScheme extends TupleScheme {

    @Override
    public void write(libthrift091.protocol.TProtocol prot, ScanRequest struct) throws libthrift091.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTableName()) {
        optionals.set(0);
      }
      if (struct.isSetIndexName()) {
        optionals.set(1);
      }
      if (struct.isSetStartKey()) {
        optionals.set(2);
      }
      if (struct.isSetStopKey()) {
        optionals.set(3);
      }
      if (struct.isSetAttributes()) {
        optionals.set(4);
      }
      if (struct.isSetCondition()) {
        optionals.set(5);
      }
      if (struct.isSetLimit()) {
        optionals.set(6);
      }
      if (struct.isSetReverse()) {
        optionals.set(7);
      }
      if (struct.isSetInGlobalOrder()) {
        optionals.set(8);
      }
      if (struct.isSetCacheResult()) {
        optionals.set(9);
      }
      if (struct.isSetLookAheadStep()) {
        optionals.set(10);
      }
      if (struct.isSetAction()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetTableName()) {
        oprot.writeString(struct.tableName);
      }
      if (struct.isSetIndexName()) {
        oprot.writeString(struct.indexName);
      }
      if (struct.isSetStartKey()) {
        {
          oprot.writeI32(struct.startKey.size());
          for (Map.Entry _iter254 : struct.startKey.entrySet())
          {
            oprot.writeString(_iter254.getKey());
            _iter254.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetStopKey()) {
        {
          oprot.writeI32(struct.stopKey.size());
          for (Map.Entry _iter255 : struct.stopKey.entrySet())
          {
            oprot.writeString(_iter255.getKey());
            _iter255.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetAttributes()) {
        {
          oprot.writeI32(struct.attributes.size());
          for (String _iter256 : struct.attributes)
          {
            oprot.writeString(_iter256);
          }
        }
      }
      if (struct.isSetCondition()) {
        oprot.writeString(struct.condition);
      }
      if (struct.isSetLimit()) {
        oprot.writeI32(struct.limit);
      }
      if (struct.isSetReverse()) {
        oprot.writeBool(struct.reverse);
      }
      if (struct.isSetInGlobalOrder()) {
        oprot.writeBool(struct.inGlobalOrder);
      }
      if (struct.isSetCacheResult()) {
        oprot.writeBool(struct.cacheResult);
      }
      if (struct.isSetLookAheadStep()) {
        oprot.writeI32(struct.lookAheadStep);
      }
      if (struct.isSetAction()) {
        struct.action.write(oprot);
      }
    }

    @Override
    public void read(libthrift091.protocol.TProtocol prot, ScanRequest struct) throws libthrift091.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.tableName = iprot.readString();
        struct.setTableNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.indexName = iprot.readString();
        struct.setIndexNameIsSet(true);
      }
      if (incoming.get(2)) {
        {
          libthrift091.protocol.TMap _map257 = new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRUCT, iprot.readI32());
          struct.startKey = new HashMap(2*_map257.size);
          String _key258;
          Datum _val259;
          for (int _i260 = 0; _i260 < _map257.size; ++_i260)
          {
            _key258 = iprot.readString();
            _val259 = new Datum();
            _val259.read(iprot);
            struct.startKey.put(_key258, _val259);
          }
        }
        struct.setStartKeyIsSet(true);
      }
      if (incoming.get(3)) {
        {
          libthrift091.protocol.TMap _map261 = new libthrift091.protocol.TMap(libthrift091.protocol.TType.STRING, libthrift091.protocol.TType.STRUCT, iprot.readI32());
          struct.stopKey = new HashMap(2*_map261.size);
          String _key262;
          Datum _val263;
          for (int _i264 = 0; _i264 < _map261.size; ++_i264)
          {
            _key262 = iprot.readString();
            _val263 = new Datum();
            _val263.read(iprot);
            struct.stopKey.put(_key262, _val263);
          }
        }
        struct.setStopKeyIsSet(true);
      }
      if (incoming.get(4)) {
        {
          libthrift091.protocol.TList _list265 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRING, iprot.readI32());
          struct.attributes = new ArrayList(_list265.size);
          String _elem266;
          for (int _i267 = 0; _i267 < _list265.size; ++_i267)
          {
            _elem266 = iprot.readString();
            struct.attributes.add(_elem266);
          }
        }
        struct.setAttributesIsSet(true);
      }
      if (incoming.get(5)) {
        struct.condition = iprot.readString();
        struct.setConditionIsSet(true);
      }
      if (incoming.get(6)) {
        struct.limit = iprot.readI32();
        struct.setLimitIsSet(true);
      }
      if (incoming.get(7)) {
        struct.reverse = iprot.readBool();
        struct.setReverseIsSet(true);
      }
      if (incoming.get(8)) {
        struct.inGlobalOrder = iprot.readBool();
        struct.setInGlobalOrderIsSet(true);
      }
      if (incoming.get(9)) {
        struct.cacheResult = iprot.readBool();
        struct.setCacheResultIsSet(true);
      }
      if (incoming.get(10)) {
        struct.lookAheadStep = iprot.readI32();
        struct.setLookAheadStepIsSet(true);
      }
      if (incoming.get(11)) {
        struct.action = new ScanAction();
        struct.action.read(iprot);
        struct.setActionIsSet(true);
      }
    }
  }

}