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

  private static final org.apache.thrift.protocol.TField ORDERING_EXPRS_FIELD_DESC = new org.apache.thrift.protocol.TField("ordering_exprs", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField IS_ASC_ORDER_FIELD_DESC = new org.apache.thrift.protocol.TField("is_asc_order", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField NULLS_FIRST_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls_first", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField SORT_TUPLE_SLOT_EXPRS_FIELD_DESC = new org.apache.thrift.protocol.TField("sort_tuple_slot_exprs", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField USE_TWO_PHASE_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("use_two_phase_read", org.apache.thrift.protocol.TType.BOOL, (short)6);

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

  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> ordering_exprs; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> is_asc_order; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> nulls_first; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> sort_tuple_slot_exprs; // optional
  public boolean use_two_phase_read; // 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 {
    ORDERING_EXPRS((short)1, "ordering_exprs"),
    IS_ASC_ORDER((short)2, "is_asc_order"),
    NULLS_FIRST((short)3, "nulls_first"),
    SORT_TUPLE_SLOT_EXPRS((short)4, "sort_tuple_slot_exprs"),
    USE_TWO_PHASE_READ((short)6, "use_two_phase_read");

    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: // ORDERING_EXPRS
          return ORDERING_EXPRS;
        case 2: // IS_ASC_ORDER
          return IS_ASC_ORDER;
        case 3: // NULLS_FIRST
          return NULLS_FIRST;
        case 4: // SORT_TUPLE_SLOT_EXPRS
          return SORT_TUPLE_SLOT_EXPRS;
        case 6: // USE_TWO_PHASE_READ
          return USE_TWO_PHASE_READ;
        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 __USE_TWO_PHASE_READ_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.SORT_TUPLE_SLOT_EXPRS,_Fields.USE_TWO_PHASE_READ};
  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.ORDERING_EXPRS, new org.apache.thrift.meta_data.FieldMetaData("ordering_exprs", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TExpr.class))));
    tmpMap.put(_Fields.IS_ASC_ORDER, new org.apache.thrift.meta_data.FieldMetaData("is_asc_order", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))));
    tmpMap.put(_Fields.NULLS_FIRST, new org.apache.thrift.meta_data.FieldMetaData("nulls_first", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))));
    tmpMap.put(_Fields.SORT_TUPLE_SLOT_EXPRS, new org.apache.thrift.meta_data.FieldMetaData("sort_tuple_slot_exprs", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.doris.thrift.TExpr.class))));
    tmpMap.put(_Fields.USE_TWO_PHASE_READ, new org.apache.thrift.meta_data.FieldMetaData("use_two_phase_read", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSortInfo.class, metaDataMap);
  }

  public TSortInfo() {
  }

  public TSortInfo(
    java.util.List<org.apache.doris.thrift.TExpr> ordering_exprs,
    java.util.List<java.lang.Boolean> is_asc_order,
    java.util.List<java.lang.Boolean> nulls_first)
  {
    this();
    this.ordering_exprs = ordering_exprs;
    this.is_asc_order = is_asc_order;
    this.nulls_first = nulls_first;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSortInfo(TSortInfo other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetOrderingExprs()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__ordering_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.ordering_exprs.size());
      for (org.apache.doris.thrift.TExpr other_element : other.ordering_exprs) {
        __this__ordering_exprs.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.ordering_exprs = __this__ordering_exprs;
    }
    if (other.isSetIsAscOrder()) {
      java.util.List<java.lang.Boolean> __this__is_asc_order = new java.util.ArrayList<java.lang.Boolean>(other.is_asc_order);
      this.is_asc_order = __this__is_asc_order;
    }
    if (other.isSetNullsFirst()) {
      java.util.List<java.lang.Boolean> __this__nulls_first = new java.util.ArrayList<java.lang.Boolean>(other.nulls_first);
      this.nulls_first = __this__nulls_first;
    }
    if (other.isSetSortTupleSlotExprs()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__sort_tuple_slot_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.sort_tuple_slot_exprs.size());
      for (org.apache.doris.thrift.TExpr other_element : other.sort_tuple_slot_exprs) {
        __this__sort_tuple_slot_exprs.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.sort_tuple_slot_exprs = __this__sort_tuple_slot_exprs;
    }
    this.use_two_phase_read = other.use_two_phase_read;
  }

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

  @Override
  public void clear() {
    this.ordering_exprs = null;
    this.is_asc_order = null;
    this.nulls_first = null;
    this.sort_tuple_slot_exprs = null;
    setUseTwoPhaseReadIsSet(false);
    this.use_two_phase_read = false;
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<org.apache.doris.thrift.TExpr> getOrderingExprsIterator() {
    return (this.ordering_exprs == null) ? null : this.ordering_exprs.iterator();
  }

  public void addToOrderingExprs(org.apache.doris.thrift.TExpr elem) {
    if (this.ordering_exprs == null) {
      this.ordering_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>();
    }
    this.ordering_exprs.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TExpr> getOrderingExprs() {
    return this.ordering_exprs;
  }

  public TSortInfo setOrderingExprs(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> ordering_exprs) {
    this.ordering_exprs = ordering_exprs;
    return this;
  }

  public void unsetOrderingExprs() {
    this.ordering_exprs = null;
  }

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

  public void setOrderingExprsIsSet(boolean value) {
    if (!value) {
      this.ordering_exprs = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Boolean> getIsAscOrderIterator() {
    return (this.is_asc_order == null) ? null : this.is_asc_order.iterator();
  }

  public void addToIsAscOrder(boolean elem) {
    if (this.is_asc_order == null) {
      this.is_asc_order = new java.util.ArrayList<java.lang.Boolean>();
    }
    this.is_asc_order.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Boolean> getIsAscOrder() {
    return this.is_asc_order;
  }

  public TSortInfo setIsAscOrder(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> is_asc_order) {
    this.is_asc_order = is_asc_order;
    return this;
  }

  public void unsetIsAscOrder() {
    this.is_asc_order = null;
  }

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

  public void setIsAscOrderIsSet(boolean value) {
    if (!value) {
      this.is_asc_order = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Boolean> getNullsFirstIterator() {
    return (this.nulls_first == null) ? null : this.nulls_first.iterator();
  }

  public void addToNullsFirst(boolean elem) {
    if (this.nulls_first == null) {
      this.nulls_first = new java.util.ArrayList<java.lang.Boolean>();
    }
    this.nulls_first.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Boolean> getNullsFirst() {
    return this.nulls_first;
  }

  public TSortInfo setNullsFirst(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> nulls_first) {
    this.nulls_first = nulls_first;
    return this;
  }

  public void unsetNullsFirst() {
    this.nulls_first = null;
  }

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

  public void setNullsFirstIsSet(boolean value) {
    if (!value) {
      this.nulls_first = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<org.apache.doris.thrift.TExpr> getSortTupleSlotExprsIterator() {
    return (this.sort_tuple_slot_exprs == null) ? null : this.sort_tuple_slot_exprs.iterator();
  }

  public void addToSortTupleSlotExprs(org.apache.doris.thrift.TExpr elem) {
    if (this.sort_tuple_slot_exprs == null) {
      this.sort_tuple_slot_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>();
    }
    this.sort_tuple_slot_exprs.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<org.apache.doris.thrift.TExpr> getSortTupleSlotExprs() {
    return this.sort_tuple_slot_exprs;
  }

  public TSortInfo setSortTupleSlotExprs(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> sort_tuple_slot_exprs) {
    this.sort_tuple_slot_exprs = sort_tuple_slot_exprs;
    return this;
  }

  public void unsetSortTupleSlotExprs() {
    this.sort_tuple_slot_exprs = null;
  }

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

  public void setSortTupleSlotExprsIsSet(boolean value) {
    if (!value) {
      this.sort_tuple_slot_exprs = null;
    }
  }

  public boolean isUseTwoPhaseRead() {
    return this.use_two_phase_read;
  }

  public TSortInfo setUseTwoPhaseRead(boolean use_two_phase_read) {
    this.use_two_phase_read = use_two_phase_read;
    setUseTwoPhaseReadIsSet(true);
    return this;
  }

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

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ORDERING_EXPRS:
      if (value == null) {
        unsetOrderingExprs();
      } else {
        setOrderingExprs((java.util.List<org.apache.doris.thrift.TExpr>)value);
      }
      break;

    case IS_ASC_ORDER:
      if (value == null) {
        unsetIsAscOrder();
      } else {
        setIsAscOrder((java.util.List<java.lang.Boolean>)value);
      }
      break;

    case NULLS_FIRST:
      if (value == null) {
        unsetNullsFirst();
      } else {
        setNullsFirst((java.util.List<java.lang.Boolean>)value);
      }
      break;

    case SORT_TUPLE_SLOT_EXPRS:
      if (value == null) {
        unsetSortTupleSlotExprs();
      } else {
        setSortTupleSlotExprs((java.util.List<org.apache.doris.thrift.TExpr>)value);
      }
      break;

    case USE_TWO_PHASE_READ:
      if (value == null) {
        unsetUseTwoPhaseRead();
      } else {
        setUseTwoPhaseRead((java.lang.Boolean)value);
      }
      break;

    }
  }

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

    case IS_ASC_ORDER:
      return getIsAscOrder();

    case NULLS_FIRST:
      return getNullsFirst();

    case SORT_TUPLE_SLOT_EXPRS:
      return getSortTupleSlotExprs();

    case USE_TWO_PHASE_READ:
      return isUseTwoPhaseRead();

    }
    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 ORDERING_EXPRS:
      return isSetOrderingExprs();
    case IS_ASC_ORDER:
      return isSetIsAscOrder();
    case NULLS_FIRST:
      return isSetNullsFirst();
    case SORT_TUPLE_SLOT_EXPRS:
      return isSetSortTupleSlotExprs();
    case USE_TWO_PHASE_READ:
      return isSetUseTwoPhaseRead();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_ordering_exprs = true && this.isSetOrderingExprs();
    boolean that_present_ordering_exprs = true && that.isSetOrderingExprs();
    if (this_present_ordering_exprs || that_present_ordering_exprs) {
      if (!(this_present_ordering_exprs && that_present_ordering_exprs))
        return false;
      if (!this.ordering_exprs.equals(that.ordering_exprs))
        return false;
    }

    boolean this_present_is_asc_order = true && this.isSetIsAscOrder();
    boolean that_present_is_asc_order = true && that.isSetIsAscOrder();
    if (this_present_is_asc_order || that_present_is_asc_order) {
      if (!(this_present_is_asc_order && that_present_is_asc_order))
        return false;
      if (!this.is_asc_order.equals(that.is_asc_order))
        return false;
    }

    boolean this_present_nulls_first = true && this.isSetNullsFirst();
    boolean that_present_nulls_first = true && that.isSetNullsFirst();
    if (this_present_nulls_first || that_present_nulls_first) {
      if (!(this_present_nulls_first && that_present_nulls_first))
        return false;
      if (!this.nulls_first.equals(that.nulls_first))
        return false;
    }

    boolean this_present_sort_tuple_slot_exprs = true && this.isSetSortTupleSlotExprs();
    boolean that_present_sort_tuple_slot_exprs = true && that.isSetSortTupleSlotExprs();
    if (this_present_sort_tuple_slot_exprs || that_present_sort_tuple_slot_exprs) {
      if (!(this_present_sort_tuple_slot_exprs && that_present_sort_tuple_slot_exprs))
        return false;
      if (!this.sort_tuple_slot_exprs.equals(that.sort_tuple_slot_exprs))
        return false;
    }

    boolean this_present_use_two_phase_read = true && this.isSetUseTwoPhaseRead();
    boolean that_present_use_two_phase_read = true && that.isSetUseTwoPhaseRead();
    if (this_present_use_two_phase_read || that_present_use_two_phase_read) {
      if (!(this_present_use_two_phase_read && that_present_use_two_phase_read))
        return false;
      if (this.use_two_phase_read != that.use_two_phase_read)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetOrderingExprs()) ? 131071 : 524287);
    if (isSetOrderingExprs())
      hashCode = hashCode * 8191 + ordering_exprs.hashCode();

    hashCode = hashCode * 8191 + ((isSetIsAscOrder()) ? 131071 : 524287);
    if (isSetIsAscOrder())
      hashCode = hashCode * 8191 + is_asc_order.hashCode();

    hashCode = hashCode * 8191 + ((isSetNullsFirst()) ? 131071 : 524287);
    if (isSetNullsFirst())
      hashCode = hashCode * 8191 + nulls_first.hashCode();

    hashCode = hashCode * 8191 + ((isSetSortTupleSlotExprs()) ? 131071 : 524287);
    if (isSetSortTupleSlotExprs())
      hashCode = hashCode * 8191 + sort_tuple_slot_exprs.hashCode();

    hashCode = hashCode * 8191 + ((isSetUseTwoPhaseRead()) ? 131071 : 524287);
    if (isSetUseTwoPhaseRead())
      hashCode = hashCode * 8191 + ((use_two_phase_read) ? 131071 : 524287);

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetOrderingExprs(), other.isSetOrderingExprs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrderingExprs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ordering_exprs, other.ordering_exprs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsAscOrder(), other.isSetIsAscOrder());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsAscOrder()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_asc_order, other.is_asc_order);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNullsFirst(), other.isSetNullsFirst());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNullsFirst()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls_first, other.nulls_first);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSortTupleSlotExprs(), other.isSetSortTupleSlotExprs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSortTupleSlotExprs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sort_tuple_slot_exprs, other.sort_tuple_slot_exprs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUseTwoPhaseRead(), other.isSetUseTwoPhaseRead());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUseTwoPhaseRead()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.use_two_phase_read, other.use_two_phase_read);
      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("TSortInfo(");
    boolean first = true;

    sb.append("ordering_exprs:");
    if (this.ordering_exprs == null) {
      sb.append("null");
    } else {
      sb.append(this.ordering_exprs);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("is_asc_order:");
    if (this.is_asc_order == null) {
      sb.append("null");
    } else {
      sb.append(this.is_asc_order);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("nulls_first:");
    if (this.nulls_first == null) {
      sb.append("null");
    } else {
      sb.append(this.nulls_first);
    }
    first = false;
    if (isSetSortTupleSlotExprs()) {
      if (!first) sb.append(", ");
      sb.append("sort_tuple_slot_exprs:");
      if (this.sort_tuple_slot_exprs == null) {
        sb.append("null");
      } else {
        sb.append(this.sort_tuple_slot_exprs);
      }
      first = false;
    }
    if (isSetUseTwoPhaseRead()) {
      if (!first) sb.append(", ");
      sb.append("use_two_phase_read:");
      sb.append(this.use_two_phase_read);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (ordering_exprs == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'ordering_exprs' was not present! Struct: " + toString());
    }
    if (is_asc_order == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'is_asc_order' was not present! Struct: " + toString());
    }
    if (nulls_first == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls_first' 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 TSortInfoStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSortInfoStandardScheme getScheme() {
      return new TSortInfoStandardScheme();
    }
  }

  private static class TSortInfoStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSortInfo> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSortInfo 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: // ORDERING_EXPRS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list594 = iprot.readListBegin();
                struct.ordering_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list594.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem595;
                for (int _i596 = 0; _i596 < _list594.size; ++_i596)
                {
                  _elem595 = new org.apache.doris.thrift.TExpr();
                  _elem595.read(iprot);
                  struct.ordering_exprs.add(_elem595);
                }
                iprot.readListEnd();
              }
              struct.setOrderingExprsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // IS_ASC_ORDER
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list597 = iprot.readListBegin();
                struct.is_asc_order = new java.util.ArrayList<java.lang.Boolean>(_list597.size);
                boolean _elem598;
                for (int _i599 = 0; _i599 < _list597.size; ++_i599)
                {
                  _elem598 = iprot.readBool();
                  struct.is_asc_order.add(_elem598);
                }
                iprot.readListEnd();
              }
              struct.setIsAscOrderIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NULLS_FIRST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list600 = iprot.readListBegin();
                struct.nulls_first = new java.util.ArrayList<java.lang.Boolean>(_list600.size);
                boolean _elem601;
                for (int _i602 = 0; _i602 < _list600.size; ++_i602)
                {
                  _elem601 = iprot.readBool();
                  struct.nulls_first.add(_elem601);
                }
                iprot.readListEnd();
              }
              struct.setNullsFirstIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SORT_TUPLE_SLOT_EXPRS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list603 = iprot.readListBegin();
                struct.sort_tuple_slot_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list603.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem604;
                for (int _i605 = 0; _i605 < _list603.size; ++_i605)
                {
                  _elem604 = new org.apache.doris.thrift.TExpr();
                  _elem604.read(iprot);
                  struct.sort_tuple_slot_exprs.add(_elem604);
                }
                iprot.readListEnd();
              }
              struct.setSortTupleSlotExprsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // USE_TWO_PHASE_READ
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.use_two_phase_read = iprot.readBool();
              struct.setUseTwoPhaseReadIsSet(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, TSortInfo struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.ordering_exprs != null) {
        oprot.writeFieldBegin(ORDERING_EXPRS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.ordering_exprs.size()));
          for (org.apache.doris.thrift.TExpr _iter606 : struct.ordering_exprs)
          {
            _iter606.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.is_asc_order != null) {
        oprot.writeFieldBegin(IS_ASC_ORDER_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.is_asc_order.size()));
          for (boolean _iter607 : struct.is_asc_order)
          {
            oprot.writeBool(_iter607);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.nulls_first != null) {
        oprot.writeFieldBegin(NULLS_FIRST_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.nulls_first.size()));
          for (boolean _iter608 : struct.nulls_first)
          {
            oprot.writeBool(_iter608);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.sort_tuple_slot_exprs != null) {
        if (struct.isSetSortTupleSlotExprs()) {
          oprot.writeFieldBegin(SORT_TUPLE_SLOT_EXPRS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.sort_tuple_slot_exprs.size()));
            for (org.apache.doris.thrift.TExpr _iter609 : struct.sort_tuple_slot_exprs)
            {
              _iter609.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetUseTwoPhaseRead()) {
        oprot.writeFieldBegin(USE_TWO_PHASE_READ_FIELD_DESC);
        oprot.writeBool(struct.use_two_phase_read);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSortInfoTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSortInfo> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSortInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.ordering_exprs.size());
        for (org.apache.doris.thrift.TExpr _iter610 : struct.ordering_exprs)
        {
          _iter610.write(oprot);
        }
      }
      {
        oprot.writeI32(struct.is_asc_order.size());
        for (boolean _iter611 : struct.is_asc_order)
        {
          oprot.writeBool(_iter611);
        }
      }
      {
        oprot.writeI32(struct.nulls_first.size());
        for (boolean _iter612 : struct.nulls_first)
        {
          oprot.writeBool(_iter612);
        }
      }
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetSortTupleSlotExprs()) {
        optionals.set(0);
      }
      if (struct.isSetUseTwoPhaseRead()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetSortTupleSlotExprs()) {
        {
          oprot.writeI32(struct.sort_tuple_slot_exprs.size());
          for (org.apache.doris.thrift.TExpr _iter613 : struct.sort_tuple_slot_exprs)
          {
            _iter613.write(oprot);
          }
        }
      }
      if (struct.isSetUseTwoPhaseRead()) {
        oprot.writeBool(struct.use_two_phase_read);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSortInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list614 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.ordering_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list614.size);
        @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem615;
        for (int _i616 = 0; _i616 < _list614.size; ++_i616)
        {
          _elem615 = new org.apache.doris.thrift.TExpr();
          _elem615.read(iprot);
          struct.ordering_exprs.add(_elem615);
        }
      }
      struct.setOrderingExprsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list617 = iprot.readListBegin(org.apache.thrift.protocol.TType.BOOL);
        struct.is_asc_order = new java.util.ArrayList<java.lang.Boolean>(_list617.size);
        boolean _elem618;
        for (int _i619 = 0; _i619 < _list617.size; ++_i619)
        {
          _elem618 = iprot.readBool();
          struct.is_asc_order.add(_elem618);
        }
      }
      struct.setIsAscOrderIsSet(true);
      {
        org.apache.thrift.protocol.TList _list620 = iprot.readListBegin(org.apache.thrift.protocol.TType.BOOL);
        struct.nulls_first = new java.util.ArrayList<java.lang.Boolean>(_list620.size);
        boolean _elem621;
        for (int _i622 = 0; _i622 < _list620.size; ++_i622)
        {
          _elem621 = iprot.readBool();
          struct.nulls_first.add(_elem621);
        }
      }
      struct.setNullsFirstIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list623 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.sort_tuple_slot_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list623.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem624;
          for (int _i625 = 0; _i625 < _list623.size; ++_i625)
          {
            _elem624 = new org.apache.doris.thrift.TExpr();
            _elem624.read(iprot);
            struct.sort_tuple_slot_exprs.add(_elem624);
          }
        }
        struct.setSortTupleSlotExprsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.use_two_phase_read = iprot.readBool();
        struct.setUseTwoPhaseReadIsSet(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();
  }
}