TBucketedAggregationNode.java

/**
 * Autogenerated by Thrift Compiler (0.24.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"})
public class TBucketedAggregationNode implements org.apache.thrift.TBase<TBucketedAggregationNode, TBucketedAggregationNode._Fields>, java.io.Serializable, Cloneable, Comparable<TBucketedAggregationNode> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBucketedAggregationNode");

  private static final org.apache.thrift.protocol.TField GROUPING_EXPRS_FIELD_DESC = new org.apache.thrift.protocol.TField("grouping_exprs", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField AGGREGATE_FUNCTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("aggregate_functions", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField TUPLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tuple_id", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField NEED_FINALIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("need_finalize", org.apache.thrift.protocol.TType.BOOL, (short)5);

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

  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> grouping_exprs; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> aggregate_functions; // optional
  public int tuple_id; // optional
  public boolean need_finalize; // 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 {
    GROUPING_EXPRS((short)1, "grouping_exprs"),
    AGGREGATE_FUNCTIONS((short)2, "aggregate_functions"),
    TUPLE_ID((short)3, "tuple_id"),
    NEED_FINALIZE((short)5, "need_finalize");

    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: // GROUPING_EXPRS
          return GROUPING_EXPRS;
        case 2: // AGGREGATE_FUNCTIONS
          return AGGREGATE_FUNCTIONS;
        case 3: // TUPLE_ID
          return TUPLE_ID;
        case 5: // NEED_FINALIZE
          return NEED_FINALIZE;
        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;
    }

    @Override
    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  private static final int __TUPLE_ID_ISSET_ID = 0;
  private static final int __NEED_FINALIZE_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields[] optionals = {_Fields.GROUPING_EXPRS,_Fields.AGGREGATE_FUNCTIONS,_Fields.TUPLE_ID,_Fields.NEED_FINALIZE};
  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.GROUPING_EXPRS, new org.apache.thrift.meta_data.FieldMetaData("grouping_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.AGGREGATE_FUNCTIONS, new org.apache.thrift.meta_data.FieldMetaData("aggregate_functions", 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.TUPLE_ID, new org.apache.thrift.meta_data.FieldMetaData("tuple_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTupleId")));
    tmpMap.put(_Fields.NEED_FINALIZE, new org.apache.thrift.meta_data.FieldMetaData("need_finalize", 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(TBucketedAggregationNode.class, metaDataMap);
  }

  public TBucketedAggregationNode() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TBucketedAggregationNode(TBucketedAggregationNode other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetGroupingExprs()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__grouping_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.grouping_exprs.size());
      for (org.apache.doris.thrift.TExpr other_element : other.grouping_exprs) {
        __this__grouping_exprs.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.grouping_exprs = __this__grouping_exprs;
    }
    if (other.isSetAggregateFunctions()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__aggregate_functions = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.aggregate_functions.size());
      for (org.apache.doris.thrift.TExpr other_element : other.aggregate_functions) {
        __this__aggregate_functions.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.aggregate_functions = __this__aggregate_functions;
    }
    this.tuple_id = other.tuple_id;
    this.need_finalize = other.need_finalize;
  }

  @Override
  public TBucketedAggregationNode deepCopy() {
    return new TBucketedAggregationNode(this);
  }

  @Override
  public void clear() {
    this.grouping_exprs = null;
    this.aggregate_functions = null;
    setTupleIdIsSet(false);
    this.tuple_id = 0;
    setNeedFinalizeIsSet(false);
    this.need_finalize = false;
  }

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

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

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

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

  public TBucketedAggregationNode setGroupingExprs(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> grouping_exprs) {
    this.grouping_exprs = grouping_exprs;
    return this;
  }

  public void unsetGroupingExprs() {
    this.grouping_exprs = null;
  }

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

  public void setGroupingExprsIsSet(boolean value) {
    if (!value) {
      this.grouping_exprs = null;
    }
  }

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

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

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

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

  public TBucketedAggregationNode setAggregateFunctions(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> aggregate_functions) {
    this.aggregate_functions = aggregate_functions;
    return this;
  }

  public void unsetAggregateFunctions() {
    this.aggregate_functions = null;
  }

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

  public void setAggregateFunctionsIsSet(boolean value) {
    if (!value) {
      this.aggregate_functions = null;
    }
  }

  public int getTupleId() {
    return this.tuple_id;
  }

  public TBucketedAggregationNode setTupleId(int tuple_id) {
    this.tuple_id = tuple_id;
    setTupleIdIsSet(true);
    return this;
  }

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

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

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

  public boolean isNeedFinalize() {
    return this.need_finalize;
  }

  public TBucketedAggregationNode setNeedFinalize(boolean need_finalize) {
    this.need_finalize = need_finalize;
    setNeedFinalizeIsSet(true);
    return this;
  }

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

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

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

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

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

    case TUPLE_ID:
      if (value == null) {
        unsetTupleId();
      } else {
        setTupleId((java.lang.Integer)value);
      }
      break;

    case NEED_FINALIZE:
      if (value == null) {
        unsetNeedFinalize();
      } else {
        setNeedFinalize((java.lang.Boolean)value);
      }
      break;

    }
  }

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

    case AGGREGATE_FUNCTIONS:
      return getAggregateFunctions();

    case TUPLE_ID:
      return getTupleId();

    case NEED_FINALIZE:
      return isNeedFinalize();

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

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

    switch (field) {
    case GROUPING_EXPRS:
      return isSetGroupingExprs();
    case AGGREGATE_FUNCTIONS:
      return isSetAggregateFunctions();
    case TUPLE_ID:
      return isSetTupleId();
    case NEED_FINALIZE:
      return isSetNeedFinalize();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_grouping_exprs = true && this.isSetGroupingExprs();
    boolean that_present_grouping_exprs = true && that.isSetGroupingExprs();
    if (this_present_grouping_exprs || that_present_grouping_exprs) {
      if (!(this_present_grouping_exprs && that_present_grouping_exprs))
        return false;
      if (!this.grouping_exprs.equals(that.grouping_exprs))
        return false;
    }

    boolean this_present_aggregate_functions = true && this.isSetAggregateFunctions();
    boolean that_present_aggregate_functions = true && that.isSetAggregateFunctions();
    if (this_present_aggregate_functions || that_present_aggregate_functions) {
      if (!(this_present_aggregate_functions && that_present_aggregate_functions))
        return false;
      if (!this.aggregate_functions.equals(that.aggregate_functions))
        return false;
    }

    boolean this_present_tuple_id = true && this.isSetTupleId();
    boolean that_present_tuple_id = true && that.isSetTupleId();
    if (this_present_tuple_id || that_present_tuple_id) {
      if (!(this_present_tuple_id && that_present_tuple_id))
        return false;
      if (this.tuple_id != that.tuple_id)
        return false;
    }

    boolean this_present_need_finalize = true && this.isSetNeedFinalize();
    boolean that_present_need_finalize = true && that.isSetNeedFinalize();
    if (this_present_need_finalize || that_present_need_finalize) {
      if (!(this_present_need_finalize && that_present_need_finalize))
        return false;
      if (this.need_finalize != that.need_finalize)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetGroupingExprs()) ? 131071 : 524287);
    if (isSetGroupingExprs())
      hashCode = hashCode * 8191 + grouping_exprs.hashCode();

    hashCode = hashCode * 8191 + ((isSetAggregateFunctions()) ? 131071 : 524287);
    if (isSetAggregateFunctions())
      hashCode = hashCode * 8191 + aggregate_functions.hashCode();

    hashCode = hashCode * 8191 + ((isSetTupleId()) ? 131071 : 524287);
    if (isSetTupleId())
      hashCode = hashCode * 8191 + tuple_id;

    hashCode = hashCode * 8191 + ((isSetNeedFinalize()) ? 131071 : 524287);
    if (isSetNeedFinalize())
      hashCode = hashCode * 8191 + ((need_finalize) ? 131071 : 524287);

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetGroupingExprs(), other.isSetGroupingExprs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGroupingExprs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grouping_exprs, other.grouping_exprs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetAggregateFunctions(), other.isSetAggregateFunctions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAggregateFunctions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregate_functions, other.aggregate_functions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTupleId(), other.isSetTupleId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTupleId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tuple_id, other.tuple_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNeedFinalize(), other.isSetNeedFinalize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNeedFinalize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.need_finalize, other.need_finalize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

  @Override
  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("TBucketedAggregationNode(");
    boolean first = true;

    if (isSetGroupingExprs()) {
      sb.append("grouping_exprs:");
      if (this.grouping_exprs == null) {
        sb.append("null");
      } else {
        sb.append(this.grouping_exprs);
      }
      first = false;
    }
    if (isSetAggregateFunctions()) {
      if (!first) sb.append(", ");
      sb.append("aggregate_functions:");
      if (this.aggregate_functions == null) {
        sb.append("null");
      } else {
        sb.append(this.aggregate_functions);
      }
      first = false;
    }
    if (isSetTupleId()) {
      if (!first) sb.append(", ");
      sb.append("tuple_id:");
      sb.append(this.tuple_id);
      first = false;
    }
    if (isSetNeedFinalize()) {
      if (!first) sb.append(", ");
      sb.append("need_finalize:");
      sb.append(this.need_finalize);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // 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 TBucketedAggregationNodeStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public TBucketedAggregationNodeStandardScheme getScheme() {
      return new TBucketedAggregationNodeStandardScheme();
    }
  }

  private static class TBucketedAggregationNodeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TBucketedAggregationNode> {

    @Override
    public void read(org.apache.thrift.protocol.TProtocol iprot, TBucketedAggregationNode struct) throws org.apache.thrift.TException {
      iprot.incrementRecursionDepth();
      try {
        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: // GROUPING_EXPRS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list848 = iprot.readListBegin();
                  struct.grouping_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list848.size);
                  @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem849;
                  for (int _i850 = 0; _i850 < _list848.size; ++_i850)
                  {
                    _elem849 = new org.apache.doris.thrift.TExpr();
                    _elem849.read(iprot);
                    struct.grouping_exprs.add(_elem849);
                  }
                  iprot.readListEnd();
                }
                struct.setGroupingExprsIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // AGGREGATE_FUNCTIONS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list851 = iprot.readListBegin();
                  struct.aggregate_functions = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list851.size);
                  @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem852;
                  for (int _i853 = 0; _i853 < _list851.size; ++_i853)
                  {
                    _elem852 = new org.apache.doris.thrift.TExpr();
                    _elem852.read(iprot);
                    struct.aggregate_functions.add(_elem852);
                  }
                  iprot.readListEnd();
                }
                struct.setAggregateFunctionsIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // TUPLE_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.tuple_id = iprot.readI32();
                struct.setTupleIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 5: // NEED_FINALIZE
              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
                struct.need_finalize = iprot.readBool();
                struct.setNeedFinalizeIsSet(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();
      } finally {
        iprot.decrementRecursionDepth();
      }
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.grouping_exprs != null) {
        if (struct.isSetGroupingExprs()) {
          oprot.writeFieldBegin(GROUPING_EXPRS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.grouping_exprs.size()));
            for (org.apache.doris.thrift.TExpr _iter854 : struct.grouping_exprs)
            {
              _iter854.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.aggregate_functions != null) {
        if (struct.isSetAggregateFunctions()) {
          oprot.writeFieldBegin(AGGREGATE_FUNCTIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.aggregate_functions.size()));
            for (org.apache.doris.thrift.TExpr _iter855 : struct.aggregate_functions)
            {
              _iter855.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetTupleId()) {
        oprot.writeFieldBegin(TUPLE_ID_FIELD_DESC);
        oprot.writeI32(struct.tuple_id);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNeedFinalize()) {
        oprot.writeFieldBegin(NEED_FINALIZE_FIELD_DESC);
        oprot.writeBool(struct.need_finalize);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TBucketedAggregationNodeTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public TBucketedAggregationNodeTupleScheme getScheme() {
      return new TBucketedAggregationNodeTupleScheme();
    }
  }

  private static class TBucketedAggregationNodeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TBucketedAggregationNode> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TBucketedAggregationNode 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.isSetGroupingExprs()) {
        optionals.set(0);
      }
      if (struct.isSetAggregateFunctions()) {
        optionals.set(1);
      }
      if (struct.isSetTupleId()) {
        optionals.set(2);
      }
      if (struct.isSetNeedFinalize()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetGroupingExprs()) {
        {
          oprot.writeI32(struct.grouping_exprs.size());
          for (org.apache.doris.thrift.TExpr _iter856 : struct.grouping_exprs)
          {
            _iter856.write(oprot);
          }
        }
      }
      if (struct.isSetAggregateFunctions()) {
        {
          oprot.writeI32(struct.aggregate_functions.size());
          for (org.apache.doris.thrift.TExpr _iter857 : struct.aggregate_functions)
          {
            _iter857.write(oprot);
          }
        }
      }
      if (struct.isSetTupleId()) {
        oprot.writeI32(struct.tuple_id);
      }
      if (struct.isSetNeedFinalize()) {
        oprot.writeBool(struct.need_finalize);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TBucketedAggregationNode struct) throws org.apache.thrift.TException {
      prot.incrementRecursionDepth();
      try {
        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(4);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list858 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
            struct.grouping_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list858.size);
            @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem859;
            for (int _i860 = 0; _i860 < _list858.size; ++_i860)
            {
              _elem859 = new org.apache.doris.thrift.TExpr();
              _elem859.read(iprot);
              struct.grouping_exprs.add(_elem859);
            }
          }
          struct.setGroupingExprsIsSet(true);
        }
        if (incoming.get(1)) {
          {
            org.apache.thrift.protocol.TList _list861 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
            struct.aggregate_functions = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list861.size);
            @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem862;
            for (int _i863 = 0; _i863 < _list861.size; ++_i863)
            {
              _elem862 = new org.apache.doris.thrift.TExpr();
              _elem862.read(iprot);
              struct.aggregate_functions.add(_elem862);
            }
          }
          struct.setAggregateFunctionsIsSet(true);
        }
        if (incoming.get(2)) {
          struct.tuple_id = iprot.readI32();
          struct.setTupleIdIsSet(true);
        }
        if (incoming.get(3)) {
          struct.need_finalize = iprot.readBool();
          struct.setNeedFinalizeIsSet(true);
        }
      } finally {
        prot.decrementRecursionDepth();
      }
    }
  }

  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();
  }
}