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

  private static final org.apache.thrift.protocol.TField BEGIN_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("begin_key", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField END_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("end_key", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField COLUMN_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("column_type", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField COLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("column_name", org.apache.thrift.protocol.TType.STRING, (short)4);

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

  public long begin_key; // required
  public long end_key; // required
  /**
   * 
   * @see org.apache.doris.thrift.TPrimitiveType
   */
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TPrimitiveType column_type; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String column_name; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    BEGIN_KEY((short)1, "begin_key"),
    END_KEY((short)2, "end_key"),
    /**
     * 
     * @see org.apache.doris.thrift.TPrimitiveType
     */
    COLUMN_TYPE((short)3, "column_type"),
    COLUMN_NAME((short)4, "column_name");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // BEGIN_KEY
          return BEGIN_KEY;
        case 2: // END_KEY
          return END_KEY;
        case 3: // COLUMN_TYPE
          return COLUMN_TYPE;
        case 4: // COLUMN_NAME
          return COLUMN_NAME;
        default:
          return null;
      }
    }

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

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

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

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

    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  private static final int __BEGIN_KEY_ISSET_ID = 0;
  private static final int __END_KEY_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  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.BEGIN_KEY, new org.apache.thrift.meta_data.FieldMetaData("begin_key", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.END_KEY, new org.apache.thrift.meta_data.FieldMetaData("end_key", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.COLUMN_TYPE, new org.apache.thrift.meta_data.FieldMetaData("column_type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.doris.thrift.TPrimitiveType.class)));
    tmpMap.put(_Fields.COLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("column_name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TKeyRange.class, metaDataMap);
  }

  public TKeyRange() {
  }

  public TKeyRange(
    long begin_key,
    long end_key,
    org.apache.doris.thrift.TPrimitiveType column_type,
    java.lang.String column_name)
  {
    this();
    this.begin_key = begin_key;
    setBeginKeyIsSet(true);
    this.end_key = end_key;
    setEndKeyIsSet(true);
    this.column_type = column_type;
    this.column_name = column_name;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TKeyRange(TKeyRange other) {
    __isset_bitfield = other.__isset_bitfield;
    this.begin_key = other.begin_key;
    this.end_key = other.end_key;
    if (other.isSetColumnType()) {
      this.column_type = other.column_type;
    }
    if (other.isSetColumnName()) {
      this.column_name = other.column_name;
    }
  }

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

  @Override
  public void clear() {
    setBeginKeyIsSet(false);
    this.begin_key = 0;
    setEndKeyIsSet(false);
    this.end_key = 0;
    this.column_type = null;
    this.column_name = null;
  }

  public long getBeginKey() {
    return this.begin_key;
  }

  public TKeyRange setBeginKey(long begin_key) {
    this.begin_key = begin_key;
    setBeginKeyIsSet(true);
    return this;
  }

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

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

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

  public long getEndKey() {
    return this.end_key;
  }

  public TKeyRange setEndKey(long end_key) {
    this.end_key = end_key;
    setEndKeyIsSet(true);
    return this;
  }

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

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

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

  /**
   * 
   * @see org.apache.doris.thrift.TPrimitiveType
   */
  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TPrimitiveType getColumnType() {
    return this.column_type;
  }

  /**
   * 
   * @see org.apache.doris.thrift.TPrimitiveType
   */
  public TKeyRange setColumnType(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TPrimitiveType column_type) {
    this.column_type = column_type;
    return this;
  }

  public void unsetColumnType() {
    this.column_type = null;
  }

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

  public void setColumnTypeIsSet(boolean value) {
    if (!value) {
      this.column_type = null;
    }
  }

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

  public TKeyRange setColumnName(@org.apache.thrift.annotation.Nullable java.lang.String column_name) {
    this.column_name = column_name;
    return this;
  }

  public void unsetColumnName() {
    this.column_name = null;
  }

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

  public void setColumnNameIsSet(boolean value) {
    if (!value) {
      this.column_name = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case BEGIN_KEY:
      if (value == null) {
        unsetBeginKey();
      } else {
        setBeginKey((java.lang.Long)value);
      }
      break;

    case END_KEY:
      if (value == null) {
        unsetEndKey();
      } else {
        setEndKey((java.lang.Long)value);
      }
      break;

    case COLUMN_TYPE:
      if (value == null) {
        unsetColumnType();
      } else {
        setColumnType((org.apache.doris.thrift.TPrimitiveType)value);
      }
      break;

    case COLUMN_NAME:
      if (value == null) {
        unsetColumnName();
      } else {
        setColumnName((java.lang.String)value);
      }
      break;

    }
  }

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

    case END_KEY:
      return getEndKey();

    case COLUMN_TYPE:
      return getColumnType();

    case COLUMN_NAME:
      return getColumnName();

    }
    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 BEGIN_KEY:
      return isSetBeginKey();
    case END_KEY:
      return isSetEndKey();
    case COLUMN_TYPE:
      return isSetColumnType();
    case COLUMN_NAME:
      return isSetColumnName();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_begin_key = true;
    boolean that_present_begin_key = true;
    if (this_present_begin_key || that_present_begin_key) {
      if (!(this_present_begin_key && that_present_begin_key))
        return false;
      if (this.begin_key != that.begin_key)
        return false;
    }

    boolean this_present_end_key = true;
    boolean that_present_end_key = true;
    if (this_present_end_key || that_present_end_key) {
      if (!(this_present_end_key && that_present_end_key))
        return false;
      if (this.end_key != that.end_key)
        return false;
    }

    boolean this_present_column_type = true && this.isSetColumnType();
    boolean that_present_column_type = true && that.isSetColumnType();
    if (this_present_column_type || that_present_column_type) {
      if (!(this_present_column_type && that_present_column_type))
        return false;
      if (!this.column_type.equals(that.column_type))
        return false;
    }

    boolean this_present_column_name = true && this.isSetColumnName();
    boolean that_present_column_name = true && that.isSetColumnName();
    if (this_present_column_name || that_present_column_name) {
      if (!(this_present_column_name && that_present_column_name))
        return false;
      if (!this.column_name.equals(that.column_name))
        return false;
    }

    return true;
  }

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

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

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

    hashCode = hashCode * 8191 + ((isSetColumnType()) ? 131071 : 524287);
    if (isSetColumnType())
      hashCode = hashCode * 8191 + column_type.getValue();

    hashCode = hashCode * 8191 + ((isSetColumnName()) ? 131071 : 524287);
    if (isSetColumnName())
      hashCode = hashCode * 8191 + column_name.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetBeginKey(), other.isSetBeginKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBeginKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.begin_key, other.begin_key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEndKey(), other.isSetEndKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_key, other.end_key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetColumnType(), other.isSetColumnType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumnType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_type, other.column_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetColumnName(), other.isSetColumnName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumnName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_name, other.column_name);
      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("TKeyRange(");
    boolean first = true;

    sb.append("begin_key:");
    sb.append(this.begin_key);
    first = false;
    if (!first) sb.append(", ");
    sb.append("end_key:");
    sb.append(this.end_key);
    first = false;
    if (!first) sb.append(", ");
    sb.append("column_type:");
    if (this.column_type == null) {
      sb.append("null");
    } else {
      sb.append(this.column_type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("column_name:");
    if (this.column_name == null) {
      sb.append("null");
    } else {
      sb.append(this.column_name);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

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

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

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

  private static class TKeyRangeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TKeyRange> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TKeyRange struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // BEGIN_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.begin_key = iprot.readI64();
              struct.setBeginKeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // END_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.end_key = iprot.readI64();
              struct.setEndKeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // COLUMN_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.column_type = org.apache.doris.thrift.TPrimitiveType.findByValue(iprot.readI32());
              struct.setColumnTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // COLUMN_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.column_name = iprot.readString();
              struct.setColumnNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BEGIN_KEY_FIELD_DESC);
      oprot.writeI64(struct.begin_key);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(END_KEY_FIELD_DESC);
      oprot.writeI64(struct.end_key);
      oprot.writeFieldEnd();
      if (struct.column_type != null) {
        oprot.writeFieldBegin(COLUMN_TYPE_FIELD_DESC);
        oprot.writeI32(struct.column_type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.column_name != null) {
        oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
        oprot.writeString(struct.column_name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TKeyRangeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TKeyRange> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TKeyRange struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.begin_key);
      oprot.writeI64(struct.end_key);
      oprot.writeI32(struct.column_type.getValue());
      oprot.writeString(struct.column_name);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TKeyRange struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.begin_key = iprot.readI64();
      struct.setBeginKeyIsSet(true);
      struct.end_key = iprot.readI64();
      struct.setEndKeyIsSet(true);
      struct.column_type = org.apache.doris.thrift.TPrimitiveType.findByValue(iprot.readI32());
      struct.setColumnTypeIsSet(true);
      struct.column_name = iprot.readString();
      struct.setColumnNameIsSet(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();
  }
}