TScanRange.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TScanRange implements org.apache.thrift.TBase<TScanRange, TScanRange._Fields>, java.io.Serializable, Cloneable, Comparable<TScanRange> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScanRange");

  private static final org.apache.thrift.protocol.TField PALO_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("palo_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)4);
  private static final org.apache.thrift.protocol.TField KUDU_SCAN_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("kudu_scan_token", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField BROKER_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("broker_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)6);
  private static final org.apache.thrift.protocol.TField ES_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("es_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField EXT_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("ext_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)8);
  private static final org.apache.thrift.protocol.TField DATA_GEN_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("data_gen_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)9);
  private static final org.apache.thrift.protocol.TField META_SCAN_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("meta_scan_range", org.apache.thrift.protocol.TType.STRUCT, (short)10);

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

  public @org.apache.thrift.annotation.Nullable TPaloScanRange palo_scan_range; // optional
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer kudu_scan_token; // optional
  public @org.apache.thrift.annotation.Nullable TBrokerScanRange broker_scan_range; // optional
  public @org.apache.thrift.annotation.Nullable TEsScanRange es_scan_range; // optional
  public @org.apache.thrift.annotation.Nullable TExternalScanRange ext_scan_range; // optional
  public @org.apache.thrift.annotation.Nullable TDataGenScanRange data_gen_scan_range; // optional
  public @org.apache.thrift.annotation.Nullable TMetaScanRange meta_scan_range; // 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 {
    PALO_SCAN_RANGE((short)4, "palo_scan_range"),
    KUDU_SCAN_TOKEN((short)5, "kudu_scan_token"),
    BROKER_SCAN_RANGE((short)6, "broker_scan_range"),
    ES_SCAN_RANGE((short)7, "es_scan_range"),
    EXT_SCAN_RANGE((short)8, "ext_scan_range"),
    DATA_GEN_SCAN_RANGE((short)9, "data_gen_scan_range"),
    META_SCAN_RANGE((short)10, "meta_scan_range");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 4: // PALO_SCAN_RANGE
          return PALO_SCAN_RANGE;
        case 5: // KUDU_SCAN_TOKEN
          return KUDU_SCAN_TOKEN;
        case 6: // BROKER_SCAN_RANGE
          return BROKER_SCAN_RANGE;
        case 7: // ES_SCAN_RANGE
          return ES_SCAN_RANGE;
        case 8: // EXT_SCAN_RANGE
          return EXT_SCAN_RANGE;
        case 9: // DATA_GEN_SCAN_RANGE
          return DATA_GEN_SCAN_RANGE;
        case 10: // META_SCAN_RANGE
          return META_SCAN_RANGE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.PALO_SCAN_RANGE,_Fields.KUDU_SCAN_TOKEN,_Fields.BROKER_SCAN_RANGE,_Fields.ES_SCAN_RANGE,_Fields.EXT_SCAN_RANGE,_Fields.DATA_GEN_SCAN_RANGE,_Fields.META_SCAN_RANGE};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.PALO_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("palo_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPaloScanRange.class)));
    tmpMap.put(_Fields.KUDU_SCAN_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("kudu_scan_token", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.BROKER_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("broker_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TBrokerScanRange.class)));
    tmpMap.put(_Fields.ES_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("es_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TEsScanRange.class)));
    tmpMap.put(_Fields.EXT_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("ext_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TExternalScanRange.class)));
    tmpMap.put(_Fields.DATA_GEN_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("data_gen_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDataGenScanRange.class)));
    tmpMap.put(_Fields.META_SCAN_RANGE, new org.apache.thrift.meta_data.FieldMetaData("meta_scan_range", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TMetaScanRange.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TScanRange.class, metaDataMap);
  }

  public TScanRange() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TScanRange(TScanRange other) {
    if (other.isSetPaloScanRange()) {
      this.palo_scan_range = new TPaloScanRange(other.palo_scan_range);
    }
    if (other.isSetKuduScanToken()) {
      this.kudu_scan_token = org.apache.thrift.TBaseHelper.copyBinary(other.kudu_scan_token);
    }
    if (other.isSetBrokerScanRange()) {
      this.broker_scan_range = new TBrokerScanRange(other.broker_scan_range);
    }
    if (other.isSetEsScanRange()) {
      this.es_scan_range = new TEsScanRange(other.es_scan_range);
    }
    if (other.isSetExtScanRange()) {
      this.ext_scan_range = new TExternalScanRange(other.ext_scan_range);
    }
    if (other.isSetDataGenScanRange()) {
      this.data_gen_scan_range = new TDataGenScanRange(other.data_gen_scan_range);
    }
    if (other.isSetMetaScanRange()) {
      this.meta_scan_range = new TMetaScanRange(other.meta_scan_range);
    }
  }

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

  @Override
  public void clear() {
    this.palo_scan_range = null;
    this.kudu_scan_token = null;
    this.broker_scan_range = null;
    this.es_scan_range = null;
    this.ext_scan_range = null;
    this.data_gen_scan_range = null;
    this.meta_scan_range = null;
  }

  @org.apache.thrift.annotation.Nullable
  public TPaloScanRange getPaloScanRange() {
    return this.palo_scan_range;
  }

  public TScanRange setPaloScanRange(@org.apache.thrift.annotation.Nullable TPaloScanRange palo_scan_range) {
    this.palo_scan_range = palo_scan_range;
    return this;
  }

  public void unsetPaloScanRange() {
    this.palo_scan_range = null;
  }

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

  public void setPaloScanRangeIsSet(boolean value) {
    if (!value) {
      this.palo_scan_range = null;
    }
  }

  public byte[] getKuduScanToken() {
    setKuduScanToken(org.apache.thrift.TBaseHelper.rightSize(kudu_scan_token));
    return kudu_scan_token == null ? null : kudu_scan_token.array();
  }

  public java.nio.ByteBuffer bufferForKuduScanToken() {
    return org.apache.thrift.TBaseHelper.copyBinary(kudu_scan_token);
  }

  public TScanRange setKuduScanToken(byte[] kudu_scan_token) {
    this.kudu_scan_token = kudu_scan_token == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(kudu_scan_token.clone());
    return this;
  }

  public TScanRange setKuduScanToken(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer kudu_scan_token) {
    this.kudu_scan_token = org.apache.thrift.TBaseHelper.copyBinary(kudu_scan_token);
    return this;
  }

  public void unsetKuduScanToken() {
    this.kudu_scan_token = null;
  }

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

  public void setKuduScanTokenIsSet(boolean value) {
    if (!value) {
      this.kudu_scan_token = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TBrokerScanRange getBrokerScanRange() {
    return this.broker_scan_range;
  }

  public TScanRange setBrokerScanRange(@org.apache.thrift.annotation.Nullable TBrokerScanRange broker_scan_range) {
    this.broker_scan_range = broker_scan_range;
    return this;
  }

  public void unsetBrokerScanRange() {
    this.broker_scan_range = null;
  }

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

  public void setBrokerScanRangeIsSet(boolean value) {
    if (!value) {
      this.broker_scan_range = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TEsScanRange getEsScanRange() {
    return this.es_scan_range;
  }

  public TScanRange setEsScanRange(@org.apache.thrift.annotation.Nullable TEsScanRange es_scan_range) {
    this.es_scan_range = es_scan_range;
    return this;
  }

  public void unsetEsScanRange() {
    this.es_scan_range = null;
  }

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

  public void setEsScanRangeIsSet(boolean value) {
    if (!value) {
      this.es_scan_range = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TExternalScanRange getExtScanRange() {
    return this.ext_scan_range;
  }

  public TScanRange setExtScanRange(@org.apache.thrift.annotation.Nullable TExternalScanRange ext_scan_range) {
    this.ext_scan_range = ext_scan_range;
    return this;
  }

  public void unsetExtScanRange() {
    this.ext_scan_range = null;
  }

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

  public void setExtScanRangeIsSet(boolean value) {
    if (!value) {
      this.ext_scan_range = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TDataGenScanRange getDataGenScanRange() {
    return this.data_gen_scan_range;
  }

  public TScanRange setDataGenScanRange(@org.apache.thrift.annotation.Nullable TDataGenScanRange data_gen_scan_range) {
    this.data_gen_scan_range = data_gen_scan_range;
    return this;
  }

  public void unsetDataGenScanRange() {
    this.data_gen_scan_range = null;
  }

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

  public void setDataGenScanRangeIsSet(boolean value) {
    if (!value) {
      this.data_gen_scan_range = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TMetaScanRange getMetaScanRange() {
    return this.meta_scan_range;
  }

  public TScanRange setMetaScanRange(@org.apache.thrift.annotation.Nullable TMetaScanRange meta_scan_range) {
    this.meta_scan_range = meta_scan_range;
    return this;
  }

  public void unsetMetaScanRange() {
    this.meta_scan_range = null;
  }

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

  public void setMetaScanRangeIsSet(boolean value) {
    if (!value) {
      this.meta_scan_range = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case PALO_SCAN_RANGE:
      if (value == null) {
        unsetPaloScanRange();
      } else {
        setPaloScanRange((TPaloScanRange)value);
      }
      break;

    case KUDU_SCAN_TOKEN:
      if (value == null) {
        unsetKuduScanToken();
      } else {
        if (value instanceof byte[]) {
          setKuduScanToken((byte[])value);
        } else {
          setKuduScanToken((java.nio.ByteBuffer)value);
        }
      }
      break;

    case BROKER_SCAN_RANGE:
      if (value == null) {
        unsetBrokerScanRange();
      } else {
        setBrokerScanRange((TBrokerScanRange)value);
      }
      break;

    case ES_SCAN_RANGE:
      if (value == null) {
        unsetEsScanRange();
      } else {
        setEsScanRange((TEsScanRange)value);
      }
      break;

    case EXT_SCAN_RANGE:
      if (value == null) {
        unsetExtScanRange();
      } else {
        setExtScanRange((TExternalScanRange)value);
      }
      break;

    case DATA_GEN_SCAN_RANGE:
      if (value == null) {
        unsetDataGenScanRange();
      } else {
        setDataGenScanRange((TDataGenScanRange)value);
      }
      break;

    case META_SCAN_RANGE:
      if (value == null) {
        unsetMetaScanRange();
      } else {
        setMetaScanRange((TMetaScanRange)value);
      }
      break;

    }
  }

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

    case KUDU_SCAN_TOKEN:
      return getKuduScanToken();

    case BROKER_SCAN_RANGE:
      return getBrokerScanRange();

    case ES_SCAN_RANGE:
      return getEsScanRange();

    case EXT_SCAN_RANGE:
      return getExtScanRange();

    case DATA_GEN_SCAN_RANGE:
      return getDataGenScanRange();

    case META_SCAN_RANGE:
      return getMetaScanRange();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case PALO_SCAN_RANGE:
      return isSetPaloScanRange();
    case KUDU_SCAN_TOKEN:
      return isSetKuduScanToken();
    case BROKER_SCAN_RANGE:
      return isSetBrokerScanRange();
    case ES_SCAN_RANGE:
      return isSetEsScanRange();
    case EXT_SCAN_RANGE:
      return isSetExtScanRange();
    case DATA_GEN_SCAN_RANGE:
      return isSetDataGenScanRange();
    case META_SCAN_RANGE:
      return isSetMetaScanRange();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_palo_scan_range = true && this.isSetPaloScanRange();
    boolean that_present_palo_scan_range = true && that.isSetPaloScanRange();
    if (this_present_palo_scan_range || that_present_palo_scan_range) {
      if (!(this_present_palo_scan_range && that_present_palo_scan_range))
        return false;
      if (!this.palo_scan_range.equals(that.palo_scan_range))
        return false;
    }

    boolean this_present_kudu_scan_token = true && this.isSetKuduScanToken();
    boolean that_present_kudu_scan_token = true && that.isSetKuduScanToken();
    if (this_present_kudu_scan_token || that_present_kudu_scan_token) {
      if (!(this_present_kudu_scan_token && that_present_kudu_scan_token))
        return false;
      if (!this.kudu_scan_token.equals(that.kudu_scan_token))
        return false;
    }

    boolean this_present_broker_scan_range = true && this.isSetBrokerScanRange();
    boolean that_present_broker_scan_range = true && that.isSetBrokerScanRange();
    if (this_present_broker_scan_range || that_present_broker_scan_range) {
      if (!(this_present_broker_scan_range && that_present_broker_scan_range))
        return false;
      if (!this.broker_scan_range.equals(that.broker_scan_range))
        return false;
    }

    boolean this_present_es_scan_range = true && this.isSetEsScanRange();
    boolean that_present_es_scan_range = true && that.isSetEsScanRange();
    if (this_present_es_scan_range || that_present_es_scan_range) {
      if (!(this_present_es_scan_range && that_present_es_scan_range))
        return false;
      if (!this.es_scan_range.equals(that.es_scan_range))
        return false;
    }

    boolean this_present_ext_scan_range = true && this.isSetExtScanRange();
    boolean that_present_ext_scan_range = true && that.isSetExtScanRange();
    if (this_present_ext_scan_range || that_present_ext_scan_range) {
      if (!(this_present_ext_scan_range && that_present_ext_scan_range))
        return false;
      if (!this.ext_scan_range.equals(that.ext_scan_range))
        return false;
    }

    boolean this_present_data_gen_scan_range = true && this.isSetDataGenScanRange();
    boolean that_present_data_gen_scan_range = true && that.isSetDataGenScanRange();
    if (this_present_data_gen_scan_range || that_present_data_gen_scan_range) {
      if (!(this_present_data_gen_scan_range && that_present_data_gen_scan_range))
        return false;
      if (!this.data_gen_scan_range.equals(that.data_gen_scan_range))
        return false;
    }

    boolean this_present_meta_scan_range = true && this.isSetMetaScanRange();
    boolean that_present_meta_scan_range = true && that.isSetMetaScanRange();
    if (this_present_meta_scan_range || that_present_meta_scan_range) {
      if (!(this_present_meta_scan_range && that_present_meta_scan_range))
        return false;
      if (!this.meta_scan_range.equals(that.meta_scan_range))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetPaloScanRange()) ? 131071 : 524287);
    if (isSetPaloScanRange())
      hashCode = hashCode * 8191 + palo_scan_range.hashCode();

    hashCode = hashCode * 8191 + ((isSetKuduScanToken()) ? 131071 : 524287);
    if (isSetKuduScanToken())
      hashCode = hashCode * 8191 + kudu_scan_token.hashCode();

    hashCode = hashCode * 8191 + ((isSetBrokerScanRange()) ? 131071 : 524287);
    if (isSetBrokerScanRange())
      hashCode = hashCode * 8191 + broker_scan_range.hashCode();

    hashCode = hashCode * 8191 + ((isSetEsScanRange()) ? 131071 : 524287);
    if (isSetEsScanRange())
      hashCode = hashCode * 8191 + es_scan_range.hashCode();

    hashCode = hashCode * 8191 + ((isSetExtScanRange()) ? 131071 : 524287);
    if (isSetExtScanRange())
      hashCode = hashCode * 8191 + ext_scan_range.hashCode();

    hashCode = hashCode * 8191 + ((isSetDataGenScanRange()) ? 131071 : 524287);
    if (isSetDataGenScanRange())
      hashCode = hashCode * 8191 + data_gen_scan_range.hashCode();

    hashCode = hashCode * 8191 + ((isSetMetaScanRange()) ? 131071 : 524287);
    if (isSetMetaScanRange())
      hashCode = hashCode * 8191 + meta_scan_range.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetPaloScanRange(), other.isSetPaloScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPaloScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.palo_scan_range, other.palo_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetKuduScanToken(), other.isSetKuduScanToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKuduScanToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.kudu_scan_token, other.kudu_scan_token);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBrokerScanRange(), other.isSetBrokerScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBrokerScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.broker_scan_range, other.broker_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEsScanRange(), other.isSetEsScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEsScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.es_scan_range, other.es_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetExtScanRange(), other.isSetExtScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExtScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ext_scan_range, other.ext_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDataGenScanRange(), other.isSetDataGenScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDataGenScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data_gen_scan_range, other.data_gen_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMetaScanRange(), other.isSetMetaScanRange());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMetaScanRange()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.meta_scan_range, other.meta_scan_range);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TScanRange(");
    boolean first = true;

    if (isSetPaloScanRange()) {
      sb.append("palo_scan_range:");
      if (this.palo_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.palo_scan_range);
      }
      first = false;
    }
    if (isSetKuduScanToken()) {
      if (!first) sb.append(", ");
      sb.append("kudu_scan_token:");
      if (this.kudu_scan_token == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.kudu_scan_token, sb);
      }
      first = false;
    }
    if (isSetBrokerScanRange()) {
      if (!first) sb.append(", ");
      sb.append("broker_scan_range:");
      if (this.broker_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.broker_scan_range);
      }
      first = false;
    }
    if (isSetEsScanRange()) {
      if (!first) sb.append(", ");
      sb.append("es_scan_range:");
      if (this.es_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.es_scan_range);
      }
      first = false;
    }
    if (isSetExtScanRange()) {
      if (!first) sb.append(", ");
      sb.append("ext_scan_range:");
      if (this.ext_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.ext_scan_range);
      }
      first = false;
    }
    if (isSetDataGenScanRange()) {
      if (!first) sb.append(", ");
      sb.append("data_gen_scan_range:");
      if (this.data_gen_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.data_gen_scan_range);
      }
      first = false;
    }
    if (isSetMetaScanRange()) {
      if (!first) sb.append(", ");
      sb.append("meta_scan_range:");
      if (this.meta_scan_range == null) {
        sb.append("null");
      } else {
        sb.append(this.meta_scan_range);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (palo_scan_range != null) {
      palo_scan_range.validate();
    }
    if (broker_scan_range != null) {
      broker_scan_range.validate();
    }
    if (es_scan_range != null) {
      es_scan_range.validate();
    }
    if (ext_scan_range != null) {
      ext_scan_range.validate();
    }
    if (data_gen_scan_range != null) {
      data_gen_scan_range.validate();
    }
    if (meta_scan_range != null) {
      meta_scan_range.validate();
    }
  }

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      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 TScanRangeStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TScanRangeStandardScheme getScheme() {
      return new TScanRangeStandardScheme();
    }
  }

  private static class TScanRangeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TScanRange> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TScanRange 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 4: // PALO_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.palo_scan_range = new TPaloScanRange();
              struct.palo_scan_range.read(iprot);
              struct.setPaloScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // KUDU_SCAN_TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.kudu_scan_token = iprot.readBinary();
              struct.setKuduScanTokenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // BROKER_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.broker_scan_range = new TBrokerScanRange();
              struct.broker_scan_range.read(iprot);
              struct.setBrokerScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // ES_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.es_scan_range = new TEsScanRange();
              struct.es_scan_range.read(iprot);
              struct.setEsScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // EXT_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.ext_scan_range = new TExternalScanRange();
              struct.ext_scan_range.read(iprot);
              struct.setExtScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // DATA_GEN_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.data_gen_scan_range = new TDataGenScanRange();
              struct.data_gen_scan_range.read(iprot);
              struct.setDataGenScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // META_SCAN_RANGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.meta_scan_range = new TMetaScanRange();
              struct.meta_scan_range.read(iprot);
              struct.setMetaScanRangeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.palo_scan_range != null) {
        if (struct.isSetPaloScanRange()) {
          oprot.writeFieldBegin(PALO_SCAN_RANGE_FIELD_DESC);
          struct.palo_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.kudu_scan_token != null) {
        if (struct.isSetKuduScanToken()) {
          oprot.writeFieldBegin(KUDU_SCAN_TOKEN_FIELD_DESC);
          oprot.writeBinary(struct.kudu_scan_token);
          oprot.writeFieldEnd();
        }
      }
      if (struct.broker_scan_range != null) {
        if (struct.isSetBrokerScanRange()) {
          oprot.writeFieldBegin(BROKER_SCAN_RANGE_FIELD_DESC);
          struct.broker_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.es_scan_range != null) {
        if (struct.isSetEsScanRange()) {
          oprot.writeFieldBegin(ES_SCAN_RANGE_FIELD_DESC);
          struct.es_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.ext_scan_range != null) {
        if (struct.isSetExtScanRange()) {
          oprot.writeFieldBegin(EXT_SCAN_RANGE_FIELD_DESC);
          struct.ext_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.data_gen_scan_range != null) {
        if (struct.isSetDataGenScanRange()) {
          oprot.writeFieldBegin(DATA_GEN_SCAN_RANGE_FIELD_DESC);
          struct.data_gen_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.meta_scan_range != null) {
        if (struct.isSetMetaScanRange()) {
          oprot.writeFieldBegin(META_SCAN_RANGE_FIELD_DESC);
          struct.meta_scan_range.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TScanRangeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TScanRange> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TScanRange struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetPaloScanRange()) {
        optionals.set(0);
      }
      if (struct.isSetKuduScanToken()) {
        optionals.set(1);
      }
      if (struct.isSetBrokerScanRange()) {
        optionals.set(2);
      }
      if (struct.isSetEsScanRange()) {
        optionals.set(3);
      }
      if (struct.isSetExtScanRange()) {
        optionals.set(4);
      }
      if (struct.isSetDataGenScanRange()) {
        optionals.set(5);
      }
      if (struct.isSetMetaScanRange()) {
        optionals.set(6);
      }
      oprot.writeBitSet(optionals, 7);
      if (struct.isSetPaloScanRange()) {
        struct.palo_scan_range.write(oprot);
      }
      if (struct.isSetKuduScanToken()) {
        oprot.writeBinary(struct.kudu_scan_token);
      }
      if (struct.isSetBrokerScanRange()) {
        struct.broker_scan_range.write(oprot);
      }
      if (struct.isSetEsScanRange()) {
        struct.es_scan_range.write(oprot);
      }
      if (struct.isSetExtScanRange()) {
        struct.ext_scan_range.write(oprot);
      }
      if (struct.isSetDataGenScanRange()) {
        struct.data_gen_scan_range.write(oprot);
      }
      if (struct.isSetMetaScanRange()) {
        struct.meta_scan_range.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TScanRange struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(7);
      if (incoming.get(0)) {
        struct.palo_scan_range = new TPaloScanRange();
        struct.palo_scan_range.read(iprot);
        struct.setPaloScanRangeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.kudu_scan_token = iprot.readBinary();
        struct.setKuduScanTokenIsSet(true);
      }
      if (incoming.get(2)) {
        struct.broker_scan_range = new TBrokerScanRange();
        struct.broker_scan_range.read(iprot);
        struct.setBrokerScanRangeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.es_scan_range = new TEsScanRange();
        struct.es_scan_range.read(iprot);
        struct.setEsScanRangeIsSet(true);
      }
      if (incoming.get(4)) {
        struct.ext_scan_range = new TExternalScanRange();
        struct.ext_scan_range.read(iprot);
        struct.setExtScanRangeIsSet(true);
      }
      if (incoming.get(5)) {
        struct.data_gen_scan_range = new TDataGenScanRange();
        struct.data_gen_scan_range.read(iprot);
        struct.setDataGenScanRangeIsSet(true);
      }
      if (incoming.get(6)) {
        struct.meta_scan_range = new TMetaScanRange();
        struct.meta_scan_range.read(iprot);
        struct.setMetaScanRangeIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}