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

  private static final org.apache.thrift.protocol.TField MIN_RESERVATION_FIELD_DESC = new org.apache.thrift.protocol.TField("min_reservation", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField MAX_RESERVATION_FIELD_DESC = new org.apache.thrift.protocol.TField("max_reservation", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField SPILLABLE_BUFFER_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("spillable_buffer_size", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField MAX_ROW_BUFFER_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("max_row_buffer_size", org.apache.thrift.protocol.TType.I64, (short)4);

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

  public long min_reservation; // required
  public long max_reservation; // required
  public long spillable_buffer_size; // optional
  public long max_row_buffer_size; // 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 {
    MIN_RESERVATION((short)1, "min_reservation"),
    MAX_RESERVATION((short)2, "max_reservation"),
    SPILLABLE_BUFFER_SIZE((short)3, "spillable_buffer_size"),
    MAX_ROW_BUFFER_SIZE((short)4, "max_row_buffer_size");

    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: // MIN_RESERVATION
          return MIN_RESERVATION;
        case 2: // MAX_RESERVATION
          return MAX_RESERVATION;
        case 3: // SPILLABLE_BUFFER_SIZE
          return SPILLABLE_BUFFER_SIZE;
        case 4: // MAX_ROW_BUFFER_SIZE
          return MAX_ROW_BUFFER_SIZE;
        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 __MIN_RESERVATION_ISSET_ID = 0;
  private static final int __MAX_RESERVATION_ISSET_ID = 1;
  private static final int __SPILLABLE_BUFFER_SIZE_ISSET_ID = 2;
  private static final int __MAX_ROW_BUFFER_SIZE_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.SPILLABLE_BUFFER_SIZE,_Fields.MAX_ROW_BUFFER_SIZE};
  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.MIN_RESERVATION, new org.apache.thrift.meta_data.FieldMetaData("min_reservation", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX_RESERVATION, new org.apache.thrift.meta_data.FieldMetaData("max_reservation", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SPILLABLE_BUFFER_SIZE, new org.apache.thrift.meta_data.FieldMetaData("spillable_buffer_size", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX_ROW_BUFFER_SIZE, new org.apache.thrift.meta_data.FieldMetaData("max_row_buffer_size", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBackendResourceProfile.class, metaDataMap);
  }

  public TBackendResourceProfile() {
    this.min_reservation = 0L;

    this.max_reservation = 12188490189880L;

    this.spillable_buffer_size = 2097152L;

    this.max_row_buffer_size = 4294967296L;

  }

  public TBackendResourceProfile(
    long min_reservation,
    long max_reservation)
  {
    this();
    this.min_reservation = min_reservation;
    setMinReservationIsSet(true);
    this.max_reservation = max_reservation;
    setMaxReservationIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TBackendResourceProfile(TBackendResourceProfile other) {
    __isset_bitfield = other.__isset_bitfield;
    this.min_reservation = other.min_reservation;
    this.max_reservation = other.max_reservation;
    this.spillable_buffer_size = other.spillable_buffer_size;
    this.max_row_buffer_size = other.max_row_buffer_size;
  }

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

  @Override
  public void clear() {
    this.min_reservation = 0L;

    this.max_reservation = 12188490189880L;

    this.spillable_buffer_size = 2097152L;

    this.max_row_buffer_size = 4294967296L;

  }

  public long getMinReservation() {
    return this.min_reservation;
  }

  public TBackendResourceProfile setMinReservation(long min_reservation) {
    this.min_reservation = min_reservation;
    setMinReservationIsSet(true);
    return this;
  }

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

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

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

  public long getMaxReservation() {
    return this.max_reservation;
  }

  public TBackendResourceProfile setMaxReservation(long max_reservation) {
    this.max_reservation = max_reservation;
    setMaxReservationIsSet(true);
    return this;
  }

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

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

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

  public long getSpillableBufferSize() {
    return this.spillable_buffer_size;
  }

  public TBackendResourceProfile setSpillableBufferSize(long spillable_buffer_size) {
    this.spillable_buffer_size = spillable_buffer_size;
    setSpillableBufferSizeIsSet(true);
    return this;
  }

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

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

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

  public long getMaxRowBufferSize() {
    return this.max_row_buffer_size;
  }

  public TBackendResourceProfile setMaxRowBufferSize(long max_row_buffer_size) {
    this.max_row_buffer_size = max_row_buffer_size;
    setMaxRowBufferSizeIsSet(true);
    return this;
  }

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

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

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

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

    case MAX_RESERVATION:
      if (value == null) {
        unsetMaxReservation();
      } else {
        setMaxReservation((java.lang.Long)value);
      }
      break;

    case SPILLABLE_BUFFER_SIZE:
      if (value == null) {
        unsetSpillableBufferSize();
      } else {
        setSpillableBufferSize((java.lang.Long)value);
      }
      break;

    case MAX_ROW_BUFFER_SIZE:
      if (value == null) {
        unsetMaxRowBufferSize();
      } else {
        setMaxRowBufferSize((java.lang.Long)value);
      }
      break;

    }
  }

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

    case MAX_RESERVATION:
      return getMaxReservation();

    case SPILLABLE_BUFFER_SIZE:
      return getSpillableBufferSize();

    case MAX_ROW_BUFFER_SIZE:
      return getMaxRowBufferSize();

    }
    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 MIN_RESERVATION:
      return isSetMinReservation();
    case MAX_RESERVATION:
      return isSetMaxReservation();
    case SPILLABLE_BUFFER_SIZE:
      return isSetSpillableBufferSize();
    case MAX_ROW_BUFFER_SIZE:
      return isSetMaxRowBufferSize();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_min_reservation = true;
    boolean that_present_min_reservation = true;
    if (this_present_min_reservation || that_present_min_reservation) {
      if (!(this_present_min_reservation && that_present_min_reservation))
        return false;
      if (this.min_reservation != that.min_reservation)
        return false;
    }

    boolean this_present_max_reservation = true;
    boolean that_present_max_reservation = true;
    if (this_present_max_reservation || that_present_max_reservation) {
      if (!(this_present_max_reservation && that_present_max_reservation))
        return false;
      if (this.max_reservation != that.max_reservation)
        return false;
    }

    boolean this_present_spillable_buffer_size = true && this.isSetSpillableBufferSize();
    boolean that_present_spillable_buffer_size = true && that.isSetSpillableBufferSize();
    if (this_present_spillable_buffer_size || that_present_spillable_buffer_size) {
      if (!(this_present_spillable_buffer_size && that_present_spillable_buffer_size))
        return false;
      if (this.spillable_buffer_size != that.spillable_buffer_size)
        return false;
    }

    boolean this_present_max_row_buffer_size = true && this.isSetMaxRowBufferSize();
    boolean that_present_max_row_buffer_size = true && that.isSetMaxRowBufferSize();
    if (this_present_max_row_buffer_size || that_present_max_row_buffer_size) {
      if (!(this_present_max_row_buffer_size && that_present_max_row_buffer_size))
        return false;
      if (this.max_row_buffer_size != that.max_row_buffer_size)
        return false;
    }

    return true;
  }

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

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

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

    hashCode = hashCode * 8191 + ((isSetSpillableBufferSize()) ? 131071 : 524287);
    if (isSetSpillableBufferSize())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(spillable_buffer_size);

    hashCode = hashCode * 8191 + ((isSetMaxRowBufferSize()) ? 131071 : 524287);
    if (isSetMaxRowBufferSize())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(max_row_buffer_size);

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetMinReservation(), other.isSetMinReservation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinReservation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.min_reservation, other.min_reservation);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMaxReservation(), other.isSetMaxReservation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxReservation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max_reservation, other.max_reservation);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSpillableBufferSize(), other.isSetSpillableBufferSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpillableBufferSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spillable_buffer_size, other.spillable_buffer_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMaxRowBufferSize(), other.isSetMaxRowBufferSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxRowBufferSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max_row_buffer_size, other.max_row_buffer_size);
      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("TBackendResourceProfile(");
    boolean first = true;

    sb.append("min_reservation:");
    sb.append(this.min_reservation);
    first = false;
    if (!first) sb.append(", ");
    sb.append("max_reservation:");
    sb.append(this.max_reservation);
    first = false;
    if (isSetSpillableBufferSize()) {
      if (!first) sb.append(", ");
      sb.append("spillable_buffer_size:");
      sb.append(this.spillable_buffer_size);
      first = false;
    }
    if (isSetMaxRowBufferSize()) {
      if (!first) sb.append(", ");
      sb.append("max_row_buffer_size:");
      sb.append(this.max_row_buffer_size);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'min_reservation' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'max_reservation' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

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

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

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

  private static class TBackendResourceProfileStandardScheme extends org.apache.thrift.scheme.StandardScheme<TBackendResourceProfile> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TBackendResourceProfile 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: // MIN_RESERVATION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.min_reservation = iprot.readI64();
              struct.setMinReservationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MAX_RESERVATION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.max_reservation = iprot.readI64();
              struct.setMaxReservationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SPILLABLE_BUFFER_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.spillable_buffer_size = iprot.readI64();
              struct.setSpillableBufferSizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // MAX_ROW_BUFFER_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.max_row_buffer_size = iprot.readI64();
              struct.setMaxRowBufferSizeIsSet(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.isSetMinReservation()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'min_reservation' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetMaxReservation()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'max_reservation' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(MIN_RESERVATION_FIELD_DESC);
      oprot.writeI64(struct.min_reservation);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MAX_RESERVATION_FIELD_DESC);
      oprot.writeI64(struct.max_reservation);
      oprot.writeFieldEnd();
      if (struct.isSetSpillableBufferSize()) {
        oprot.writeFieldBegin(SPILLABLE_BUFFER_SIZE_FIELD_DESC);
        oprot.writeI64(struct.spillable_buffer_size);
        oprot.writeFieldEnd();
      }
      if (struct.isSetMaxRowBufferSize()) {
        oprot.writeFieldBegin(MAX_ROW_BUFFER_SIZE_FIELD_DESC);
        oprot.writeI64(struct.max_row_buffer_size);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TBackendResourceProfileTupleScheme extends org.apache.thrift.scheme.TupleScheme<TBackendResourceProfile> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TBackendResourceProfile struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.min_reservation);
      oprot.writeI64(struct.max_reservation);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetSpillableBufferSize()) {
        optionals.set(0);
      }
      if (struct.isSetMaxRowBufferSize()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetSpillableBufferSize()) {
        oprot.writeI64(struct.spillable_buffer_size);
      }
      if (struct.isSetMaxRowBufferSize()) {
        oprot.writeI64(struct.max_row_buffer_size);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TBackendResourceProfile struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.min_reservation = iprot.readI64();
      struct.setMinReservationIsSet(true);
      struct.max_reservation = iprot.readI64();
      struct.setMaxReservationIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.spillable_buffer_size = iprot.readI64();
        struct.setSpillableBufferSizeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.max_row_buffer_size = iprot.readI64();
        struct.setMaxRowBufferSizeIsSet(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();
  }
}