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

  private static final org.apache.thrift.protocol.TField GROUP_EXPRS_FIELD_DESC = new org.apache.thrift.protocol.TField("group_exprs", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField AGGREGATE_EXPRS_FIELD_DESC = new org.apache.thrift.protocol.TField("aggregate_exprs", org.apache.thrift.protocol.TType.LIST, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> group_exprs; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> aggregate_exprs; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    GROUP_EXPRS((short)1, "group_exprs"),
    AGGREGATE_EXPRS((short)2, "aggregate_exprs");

    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: // GROUP_EXPRS
          return GROUP_EXPRS;
        case 2: // AGGREGATE_EXPRS
          return AGGREGATE_EXPRS;
        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
  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.GROUP_EXPRS, new org.apache.thrift.meta_data.FieldMetaData("group_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.AGGREGATE_EXPRS, new org.apache.thrift.meta_data.FieldMetaData("aggregate_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))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPreAggregationNode.class, metaDataMap);
  }

  public TPreAggregationNode() {
  }

  public TPreAggregationNode(
    java.util.List<org.apache.doris.thrift.TExpr> group_exprs,
    java.util.List<org.apache.doris.thrift.TExpr> aggregate_exprs)
  {
    this();
    this.group_exprs = group_exprs;
    this.aggregate_exprs = aggregate_exprs;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TPreAggregationNode(TPreAggregationNode other) {
    if (other.isSetGroupExprs()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__group_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.group_exprs.size());
      for (org.apache.doris.thrift.TExpr other_element : other.group_exprs) {
        __this__group_exprs.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.group_exprs = __this__group_exprs;
    }
    if (other.isSetAggregateExprs()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__aggregate_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.aggregate_exprs.size());
      for (org.apache.doris.thrift.TExpr other_element : other.aggregate_exprs) {
        __this__aggregate_exprs.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.aggregate_exprs = __this__aggregate_exprs;
    }
  }

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

  @Override
  public void clear() {
    this.group_exprs = null;
    this.aggregate_exprs = null;
  }

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

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

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

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

  public TPreAggregationNode setGroupExprs(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> group_exprs) {
    this.group_exprs = group_exprs;
    return this;
  }

  public void unsetGroupExprs() {
    this.group_exprs = null;
  }

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

  public void setGroupExprsIsSet(boolean value) {
    if (!value) {
      this.group_exprs = null;
    }
  }

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

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

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

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

  public TPreAggregationNode setAggregateExprs(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> aggregate_exprs) {
    this.aggregate_exprs = aggregate_exprs;
    return this;
  }

  public void unsetAggregateExprs() {
    this.aggregate_exprs = null;
  }

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

  public void setAggregateExprsIsSet(boolean value) {
    if (!value) {
      this.aggregate_exprs = null;
    }
  }

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

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

    }
  }

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

    case AGGREGATE_EXPRS:
      return getAggregateExprs();

    }
    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 GROUP_EXPRS:
      return isSetGroupExprs();
    case AGGREGATE_EXPRS:
      return isSetAggregateExprs();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_group_exprs = true && this.isSetGroupExprs();
    boolean that_present_group_exprs = true && that.isSetGroupExprs();
    if (this_present_group_exprs || that_present_group_exprs) {
      if (!(this_present_group_exprs && that_present_group_exprs))
        return false;
      if (!this.group_exprs.equals(that.group_exprs))
        return false;
    }

    boolean this_present_aggregate_exprs = true && this.isSetAggregateExprs();
    boolean that_present_aggregate_exprs = true && that.isSetAggregateExprs();
    if (this_present_aggregate_exprs || that_present_aggregate_exprs) {
      if (!(this_present_aggregate_exprs && that_present_aggregate_exprs))
        return false;
      if (!this.aggregate_exprs.equals(that.aggregate_exprs))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetGroupExprs()) ? 131071 : 524287);
    if (isSetGroupExprs())
      hashCode = hashCode * 8191 + group_exprs.hashCode();

    hashCode = hashCode * 8191 + ((isSetAggregateExprs()) ? 131071 : 524287);
    if (isSetAggregateExprs())
      hashCode = hashCode * 8191 + aggregate_exprs.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetGroupExprs(), other.isSetGroupExprs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGroupExprs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.group_exprs, other.group_exprs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetAggregateExprs(), other.isSetAggregateExprs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAggregateExprs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregate_exprs, other.aggregate_exprs);
      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("TPreAggregationNode(");
    boolean first = true;

    sb.append("group_exprs:");
    if (this.group_exprs == null) {
      sb.append("null");
    } else {
      sb.append(this.group_exprs);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("aggregate_exprs:");
    if (this.aggregate_exprs == null) {
      sb.append("null");
    } else {
      sb.append(this.aggregate_exprs);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

  private static class TPreAggregationNodeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TPreAggregationNode> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TPreAggregationNode 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: // GROUP_EXPRS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list922 = iprot.readListBegin();
                struct.group_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list922.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem923;
                for (int _i924 = 0; _i924 < _list922.size; ++_i924)
                {
                  _elem923 = new org.apache.doris.thrift.TExpr();
                  _elem923.read(iprot);
                  struct.group_exprs.add(_elem923);
                }
                iprot.readListEnd();
              }
              struct.setGroupExprsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // AGGREGATE_EXPRS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list925 = iprot.readListBegin();
                struct.aggregate_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list925.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem926;
                for (int _i927 = 0; _i927 < _list925.size; ++_i927)
                {
                  _elem926 = new org.apache.doris.thrift.TExpr();
                  _elem926.read(iprot);
                  struct.aggregate_exprs.add(_elem926);
                }
                iprot.readListEnd();
              }
              struct.setAggregateExprsIsSet(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, TPreAggregationNode struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.group_exprs != null) {
        oprot.writeFieldBegin(GROUP_EXPRS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.group_exprs.size()));
          for (org.apache.doris.thrift.TExpr _iter928 : struct.group_exprs)
          {
            _iter928.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.aggregate_exprs != null) {
        oprot.writeFieldBegin(AGGREGATE_EXPRS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.aggregate_exprs.size()));
          for (org.apache.doris.thrift.TExpr _iter929 : struct.aggregate_exprs)
          {
            _iter929.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TPreAggregationNodeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TPreAggregationNode> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TPreAggregationNode struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.group_exprs.size());
        for (org.apache.doris.thrift.TExpr _iter930 : struct.group_exprs)
        {
          _iter930.write(oprot);
        }
      }
      {
        oprot.writeI32(struct.aggregate_exprs.size());
        for (org.apache.doris.thrift.TExpr _iter931 : struct.aggregate_exprs)
        {
          _iter931.write(oprot);
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TPreAggregationNode struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list932 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.group_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list932.size);
        @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem933;
        for (int _i934 = 0; _i934 < _list932.size; ++_i934)
        {
          _elem933 = new org.apache.doris.thrift.TExpr();
          _elem933.read(iprot);
          struct.group_exprs.add(_elem933);
        }
      }
      struct.setGroupExprsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list935 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
        struct.aggregate_exprs = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list935.size);
        @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem936;
        for (int _i937 = 0; _i937 < _list935.size; ++_i937)
        {
          _elem936 = new org.apache.doris.thrift.TExpr();
          _elem936.read(iprot);
          struct.aggregate_exprs.add(_elem936);
        }
      }
      struct.setAggregateExprsIsSet(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();
  }
}