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

  private static final org.apache.thrift.protocol.TField NODE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("node_id", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField NODE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("node_type", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField NUM_CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("num_children", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField TUPLE_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("tuple_ids", org.apache.thrift.protocol.TType.SET, (short)5);
  private static final org.apache.thrift.protocol.TField NULLABLE_TUPLES_FIELD_DESC = new org.apache.thrift.protocol.TField("nullable_tuples", org.apache.thrift.protocol.TType.SET, (short)6);
  private static final org.apache.thrift.protocol.TField CONJUNCTS_FIELD_DESC = new org.apache.thrift.protocol.TField("conjuncts", org.apache.thrift.protocol.TType.LIST, (short)7);
  private static final org.apache.thrift.protocol.TField PROJECTS_FIELD_DESC = new org.apache.thrift.protocol.TField("projects", org.apache.thrift.protocol.TType.LIST, (short)8);
  private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField OLAP_SCAN_NODE_FIELD_DESC = new org.apache.thrift.protocol.TField("olap_scan_node", org.apache.thrift.protocol.TType.STRUCT, (short)10);
  private static final org.apache.thrift.protocol.TField AGGREGATION_NODE_FIELD_DESC = new org.apache.thrift.protocol.TField("aggregation_node", org.apache.thrift.protocol.TType.STRUCT, (short)11);

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

  public int node_id; // optional
  /**
   * 
   * @see org.apache.doris.thrift.TPlanNodeType
   */
  public @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TPlanNodeType node_type; // optional
  public int num_children; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> tuple_ids; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> nullable_tuples; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> conjuncts; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> projects; // optional
  public long limit; // optional
  public @org.apache.thrift.annotation.Nullable TNormalizedOlapScanNode olap_scan_node; // optional
  public @org.apache.thrift.annotation.Nullable TNormalizedAggregateNode aggregation_node; // 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 {
    NODE_ID((short)1, "node_id"),
    /**
     * 
     * @see org.apache.doris.thrift.TPlanNodeType
     */
    NODE_TYPE((short)2, "node_type"),
    NUM_CHILDREN((short)3, "num_children"),
    TUPLE_IDS((short)5, "tuple_ids"),
    NULLABLE_TUPLES((short)6, "nullable_tuples"),
    CONJUNCTS((short)7, "conjuncts"),
    PROJECTS((short)8, "projects"),
    LIMIT((short)9, "limit"),
    OLAP_SCAN_NODE((short)10, "olap_scan_node"),
    AGGREGATION_NODE((short)11, "aggregation_node");

    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: // NODE_ID
          return NODE_ID;
        case 2: // NODE_TYPE
          return NODE_TYPE;
        case 3: // NUM_CHILDREN
          return NUM_CHILDREN;
        case 5: // TUPLE_IDS
          return TUPLE_IDS;
        case 6: // NULLABLE_TUPLES
          return NULLABLE_TUPLES;
        case 7: // CONJUNCTS
          return CONJUNCTS;
        case 8: // PROJECTS
          return PROJECTS;
        case 9: // LIMIT
          return LIMIT;
        case 10: // OLAP_SCAN_NODE
          return OLAP_SCAN_NODE;
        case 11: // AGGREGATION_NODE
          return AGGREGATION_NODE;
        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 __NODE_ID_ISSET_ID = 0;
  private static final int __NUM_CHILDREN_ISSET_ID = 1;
  private static final int __LIMIT_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.NODE_ID,_Fields.NODE_TYPE,_Fields.NUM_CHILDREN,_Fields.TUPLE_IDS,_Fields.NULLABLE_TUPLES,_Fields.CONJUNCTS,_Fields.PROJECTS,_Fields.LIMIT,_Fields.OLAP_SCAN_NODE,_Fields.AGGREGATION_NODE};
  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.NODE_ID, new org.apache.thrift.meta_data.FieldMetaData("node_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TPlanNodeId")));
    tmpMap.put(_Fields.NODE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("node_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.doris.thrift.TPlanNodeType.class)));
    tmpMap.put(_Fields.NUM_CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("num_children", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TUPLE_IDS, new org.apache.thrift.meta_data.FieldMetaData("tuple_ids", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32            , "TTupleId"))));
    tmpMap.put(_Fields.NULLABLE_TUPLES, new org.apache.thrift.meta_data.FieldMetaData("nullable_tuples", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32            , "TTupleId"))));
    tmpMap.put(_Fields.CONJUNCTS, new org.apache.thrift.meta_data.FieldMetaData("conjuncts", 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.PROJECTS, new org.apache.thrift.meta_data.FieldMetaData("projects", 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.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.OLAP_SCAN_NODE, new org.apache.thrift.meta_data.FieldMetaData("olap_scan_node", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TNormalizedOlapScanNode.class)));
    tmpMap.put(_Fields.AGGREGATION_NODE, new org.apache.thrift.meta_data.FieldMetaData("aggregation_node", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TNormalizedAggregateNode.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TNormalizedPlanNode.class, metaDataMap);
  }

  public TNormalizedPlanNode() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TNormalizedPlanNode(TNormalizedPlanNode other) {
    __isset_bitfield = other.__isset_bitfield;
    this.node_id = other.node_id;
    if (other.isSetNodeType()) {
      this.node_type = other.node_type;
    }
    this.num_children = other.num_children;
    if (other.isSetTupleIds()) {
      java.util.Set<java.lang.Integer> __this__tuple_ids = new java.util.HashSet<java.lang.Integer>(other.tuple_ids.size());
      for (java.lang.Integer other_element : other.tuple_ids) {
        __this__tuple_ids.add(other_element);
      }
      this.tuple_ids = __this__tuple_ids;
    }
    if (other.isSetNullableTuples()) {
      java.util.Set<java.lang.Integer> __this__nullable_tuples = new java.util.HashSet<java.lang.Integer>(other.nullable_tuples.size());
      for (java.lang.Integer other_element : other.nullable_tuples) {
        __this__nullable_tuples.add(other_element);
      }
      this.nullable_tuples = __this__nullable_tuples;
    }
    if (other.isSetConjuncts()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__conjuncts = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.conjuncts.size());
      for (org.apache.doris.thrift.TExpr other_element : other.conjuncts) {
        __this__conjuncts.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.conjuncts = __this__conjuncts;
    }
    if (other.isSetProjects()) {
      java.util.List<org.apache.doris.thrift.TExpr> __this__projects = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other.projects.size());
      for (org.apache.doris.thrift.TExpr other_element : other.projects) {
        __this__projects.add(new org.apache.doris.thrift.TExpr(other_element));
      }
      this.projects = __this__projects;
    }
    this.limit = other.limit;
    if (other.isSetOlapScanNode()) {
      this.olap_scan_node = new TNormalizedOlapScanNode(other.olap_scan_node);
    }
    if (other.isSetAggregationNode()) {
      this.aggregation_node = new TNormalizedAggregateNode(other.aggregation_node);
    }
  }

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

  @Override
  public void clear() {
    setNodeIdIsSet(false);
    this.node_id = 0;
    this.node_type = null;
    setNumChildrenIsSet(false);
    this.num_children = 0;
    this.tuple_ids = null;
    this.nullable_tuples = null;
    this.conjuncts = null;
    this.projects = null;
    setLimitIsSet(false);
    this.limit = 0;
    this.olap_scan_node = null;
    this.aggregation_node = null;
  }

  public int getNodeId() {
    return this.node_id;
  }

  public TNormalizedPlanNode setNodeId(int node_id) {
    this.node_id = node_id;
    setNodeIdIsSet(true);
    return this;
  }

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

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

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

  /**
   * 
   * @see org.apache.doris.thrift.TPlanNodeType
   */
  @org.apache.thrift.annotation.Nullable
  public org.apache.doris.thrift.TPlanNodeType getNodeType() {
    return this.node_type;
  }

  /**
   * 
   * @see org.apache.doris.thrift.TPlanNodeType
   */
  public TNormalizedPlanNode setNodeType(@org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TPlanNodeType node_type) {
    this.node_type = node_type;
    return this;
  }

  public void unsetNodeType() {
    this.node_type = null;
  }

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

  public void setNodeTypeIsSet(boolean value) {
    if (!value) {
      this.node_type = null;
    }
  }

  public int getNumChildren() {
    return this.num_children;
  }

  public TNormalizedPlanNode setNumChildren(int num_children) {
    this.num_children = num_children;
    setNumChildrenIsSet(true);
    return this;
  }

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

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

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

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

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

  public void addToTupleIds(int elem) {
    if (this.tuple_ids == null) {
      this.tuple_ids = new java.util.HashSet<java.lang.Integer>();
    }
    this.tuple_ids.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Set<java.lang.Integer> getTupleIds() {
    return this.tuple_ids;
  }

  public TNormalizedPlanNode setTupleIds(@org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> tuple_ids) {
    this.tuple_ids = tuple_ids;
    return this;
  }

  public void unsetTupleIds() {
    this.tuple_ids = null;
  }

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

  public void setTupleIdsIsSet(boolean value) {
    if (!value) {
      this.tuple_ids = null;
    }
  }

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

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

  public void addToNullableTuples(int elem) {
    if (this.nullable_tuples == null) {
      this.nullable_tuples = new java.util.HashSet<java.lang.Integer>();
    }
    this.nullable_tuples.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Set<java.lang.Integer> getNullableTuples() {
    return this.nullable_tuples;
  }

  public TNormalizedPlanNode setNullableTuples(@org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> nullable_tuples) {
    this.nullable_tuples = nullable_tuples;
    return this;
  }

  public void unsetNullableTuples() {
    this.nullable_tuples = null;
  }

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

  public void setNullableTuplesIsSet(boolean value) {
    if (!value) {
      this.nullable_tuples = null;
    }
  }

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

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

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

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

  public TNormalizedPlanNode setConjuncts(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> conjuncts) {
    this.conjuncts = conjuncts;
    return this;
  }

  public void unsetConjuncts() {
    this.conjuncts = null;
  }

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

  public void setConjunctsIsSet(boolean value) {
    if (!value) {
      this.conjuncts = null;
    }
  }

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

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

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

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

  public TNormalizedPlanNode setProjects(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> projects) {
    this.projects = projects;
    return this;
  }

  public void unsetProjects() {
    this.projects = null;
  }

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

  public void setProjectsIsSet(boolean value) {
    if (!value) {
      this.projects = null;
    }
  }

  public long getLimit() {
    return this.limit;
  }

  public TNormalizedPlanNode setLimit(long limit) {
    this.limit = limit;
    setLimitIsSet(true);
    return this;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public TNormalizedOlapScanNode getOlapScanNode() {
    return this.olap_scan_node;
  }

  public TNormalizedPlanNode setOlapScanNode(@org.apache.thrift.annotation.Nullable TNormalizedOlapScanNode olap_scan_node) {
    this.olap_scan_node = olap_scan_node;
    return this;
  }

  public void unsetOlapScanNode() {
    this.olap_scan_node = null;
  }

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

  public void setOlapScanNodeIsSet(boolean value) {
    if (!value) {
      this.olap_scan_node = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TNormalizedAggregateNode getAggregationNode() {
    return this.aggregation_node;
  }

  public TNormalizedPlanNode setAggregationNode(@org.apache.thrift.annotation.Nullable TNormalizedAggregateNode aggregation_node) {
    this.aggregation_node = aggregation_node;
    return this;
  }

  public void unsetAggregationNode() {
    this.aggregation_node = null;
  }

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

  public void setAggregationNodeIsSet(boolean value) {
    if (!value) {
      this.aggregation_node = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case NODE_ID:
      if (value == null) {
        unsetNodeId();
      } else {
        setNodeId((java.lang.Integer)value);
      }
      break;

    case NODE_TYPE:
      if (value == null) {
        unsetNodeType();
      } else {
        setNodeType((org.apache.doris.thrift.TPlanNodeType)value);
      }
      break;

    case NUM_CHILDREN:
      if (value == null) {
        unsetNumChildren();
      } else {
        setNumChildren((java.lang.Integer)value);
      }
      break;

    case TUPLE_IDS:
      if (value == null) {
        unsetTupleIds();
      } else {
        setTupleIds((java.util.Set<java.lang.Integer>)value);
      }
      break;

    case NULLABLE_TUPLES:
      if (value == null) {
        unsetNullableTuples();
      } else {
        setNullableTuples((java.util.Set<java.lang.Integer>)value);
      }
      break;

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

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

    case LIMIT:
      if (value == null) {
        unsetLimit();
      } else {
        setLimit((java.lang.Long)value);
      }
      break;

    case OLAP_SCAN_NODE:
      if (value == null) {
        unsetOlapScanNode();
      } else {
        setOlapScanNode((TNormalizedOlapScanNode)value);
      }
      break;

    case AGGREGATION_NODE:
      if (value == null) {
        unsetAggregationNode();
      } else {
        setAggregationNode((TNormalizedAggregateNode)value);
      }
      break;

    }
  }

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

    case NODE_TYPE:
      return getNodeType();

    case NUM_CHILDREN:
      return getNumChildren();

    case TUPLE_IDS:
      return getTupleIds();

    case NULLABLE_TUPLES:
      return getNullableTuples();

    case CONJUNCTS:
      return getConjuncts();

    case PROJECTS:
      return getProjects();

    case LIMIT:
      return getLimit();

    case OLAP_SCAN_NODE:
      return getOlapScanNode();

    case AGGREGATION_NODE:
      return getAggregationNode();

    }
    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 NODE_ID:
      return isSetNodeId();
    case NODE_TYPE:
      return isSetNodeType();
    case NUM_CHILDREN:
      return isSetNumChildren();
    case TUPLE_IDS:
      return isSetTupleIds();
    case NULLABLE_TUPLES:
      return isSetNullableTuples();
    case CONJUNCTS:
      return isSetConjuncts();
    case PROJECTS:
      return isSetProjects();
    case LIMIT:
      return isSetLimit();
    case OLAP_SCAN_NODE:
      return isSetOlapScanNode();
    case AGGREGATION_NODE:
      return isSetAggregationNode();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_node_id = true && this.isSetNodeId();
    boolean that_present_node_id = true && that.isSetNodeId();
    if (this_present_node_id || that_present_node_id) {
      if (!(this_present_node_id && that_present_node_id))
        return false;
      if (this.node_id != that.node_id)
        return false;
    }

    boolean this_present_node_type = true && this.isSetNodeType();
    boolean that_present_node_type = true && that.isSetNodeType();
    if (this_present_node_type || that_present_node_type) {
      if (!(this_present_node_type && that_present_node_type))
        return false;
      if (!this.node_type.equals(that.node_type))
        return false;
    }

    boolean this_present_num_children = true && this.isSetNumChildren();
    boolean that_present_num_children = true && that.isSetNumChildren();
    if (this_present_num_children || that_present_num_children) {
      if (!(this_present_num_children && that_present_num_children))
        return false;
      if (this.num_children != that.num_children)
        return false;
    }

    boolean this_present_tuple_ids = true && this.isSetTupleIds();
    boolean that_present_tuple_ids = true && that.isSetTupleIds();
    if (this_present_tuple_ids || that_present_tuple_ids) {
      if (!(this_present_tuple_ids && that_present_tuple_ids))
        return false;
      if (!this.tuple_ids.equals(that.tuple_ids))
        return false;
    }

    boolean this_present_nullable_tuples = true && this.isSetNullableTuples();
    boolean that_present_nullable_tuples = true && that.isSetNullableTuples();
    if (this_present_nullable_tuples || that_present_nullable_tuples) {
      if (!(this_present_nullable_tuples && that_present_nullable_tuples))
        return false;
      if (!this.nullable_tuples.equals(that.nullable_tuples))
        return false;
    }

    boolean this_present_conjuncts = true && this.isSetConjuncts();
    boolean that_present_conjuncts = true && that.isSetConjuncts();
    if (this_present_conjuncts || that_present_conjuncts) {
      if (!(this_present_conjuncts && that_present_conjuncts))
        return false;
      if (!this.conjuncts.equals(that.conjuncts))
        return false;
    }

    boolean this_present_projects = true && this.isSetProjects();
    boolean that_present_projects = true && that.isSetProjects();
    if (this_present_projects || that_present_projects) {
      if (!(this_present_projects && that_present_projects))
        return false;
      if (!this.projects.equals(that.projects))
        return false;
    }

    boolean this_present_limit = true && this.isSetLimit();
    boolean that_present_limit = true && that.isSetLimit();
    if (this_present_limit || that_present_limit) {
      if (!(this_present_limit && that_present_limit))
        return false;
      if (this.limit != that.limit)
        return false;
    }

    boolean this_present_olap_scan_node = true && this.isSetOlapScanNode();
    boolean that_present_olap_scan_node = true && that.isSetOlapScanNode();
    if (this_present_olap_scan_node || that_present_olap_scan_node) {
      if (!(this_present_olap_scan_node && that_present_olap_scan_node))
        return false;
      if (!this.olap_scan_node.equals(that.olap_scan_node))
        return false;
    }

    boolean this_present_aggregation_node = true && this.isSetAggregationNode();
    boolean that_present_aggregation_node = true && that.isSetAggregationNode();
    if (this_present_aggregation_node || that_present_aggregation_node) {
      if (!(this_present_aggregation_node && that_present_aggregation_node))
        return false;
      if (!this.aggregation_node.equals(that.aggregation_node))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetNodeId()) ? 131071 : 524287);
    if (isSetNodeId())
      hashCode = hashCode * 8191 + node_id;

    hashCode = hashCode * 8191 + ((isSetNodeType()) ? 131071 : 524287);
    if (isSetNodeType())
      hashCode = hashCode * 8191 + node_type.getValue();

    hashCode = hashCode * 8191 + ((isSetNumChildren()) ? 131071 : 524287);
    if (isSetNumChildren())
      hashCode = hashCode * 8191 + num_children;

    hashCode = hashCode * 8191 + ((isSetTupleIds()) ? 131071 : 524287);
    if (isSetTupleIds())
      hashCode = hashCode * 8191 + tuple_ids.hashCode();

    hashCode = hashCode * 8191 + ((isSetNullableTuples()) ? 131071 : 524287);
    if (isSetNullableTuples())
      hashCode = hashCode * 8191 + nullable_tuples.hashCode();

    hashCode = hashCode * 8191 + ((isSetConjuncts()) ? 131071 : 524287);
    if (isSetConjuncts())
      hashCode = hashCode * 8191 + conjuncts.hashCode();

    hashCode = hashCode * 8191 + ((isSetProjects()) ? 131071 : 524287);
    if (isSetProjects())
      hashCode = hashCode * 8191 + projects.hashCode();

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

    hashCode = hashCode * 8191 + ((isSetOlapScanNode()) ? 131071 : 524287);
    if (isSetOlapScanNode())
      hashCode = hashCode * 8191 + olap_scan_node.hashCode();

    hashCode = hashCode * 8191 + ((isSetAggregationNode()) ? 131071 : 524287);
    if (isSetAggregationNode())
      hashCode = hashCode * 8191 + aggregation_node.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetNodeId(), other.isSetNodeId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNodeId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.node_id, other.node_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNodeType(), other.isSetNodeType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNodeType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.node_type, other.node_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNumChildren(), other.isSetNumChildren());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumChildren()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_children, other.num_children);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTupleIds(), other.isSetTupleIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTupleIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tuple_ids, other.tuple_ids);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNullableTuples(), other.isSetNullableTuples());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNullableTuples()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nullable_tuples, other.nullable_tuples);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConjuncts(), other.isSetConjuncts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConjuncts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.conjuncts, other.conjuncts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetProjects(), other.isSetProjects());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProjects()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projects, other.projects);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetLimit(), other.isSetLimit());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLimit()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.limit, other.limit);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetOlapScanNode(), other.isSetOlapScanNode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOlapScanNode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.olap_scan_node, other.olap_scan_node);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetAggregationNode(), other.isSetAggregationNode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAggregationNode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregation_node, other.aggregation_node);
      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("TNormalizedPlanNode(");
    boolean first = true;

    if (isSetNodeId()) {
      sb.append("node_id:");
      sb.append(this.node_id);
      first = false;
    }
    if (isSetNodeType()) {
      if (!first) sb.append(", ");
      sb.append("node_type:");
      if (this.node_type == null) {
        sb.append("null");
      } else {
        sb.append(this.node_type);
      }
      first = false;
    }
    if (isSetNumChildren()) {
      if (!first) sb.append(", ");
      sb.append("num_children:");
      sb.append(this.num_children);
      first = false;
    }
    if (isSetTupleIds()) {
      if (!first) sb.append(", ");
      sb.append("tuple_ids:");
      if (this.tuple_ids == null) {
        sb.append("null");
      } else {
        sb.append(this.tuple_ids);
      }
      first = false;
    }
    if (isSetNullableTuples()) {
      if (!first) sb.append(", ");
      sb.append("nullable_tuples:");
      if (this.nullable_tuples == null) {
        sb.append("null");
      } else {
        sb.append(this.nullable_tuples);
      }
      first = false;
    }
    if (isSetConjuncts()) {
      if (!first) sb.append(", ");
      sb.append("conjuncts:");
      if (this.conjuncts == null) {
        sb.append("null");
      } else {
        sb.append(this.conjuncts);
      }
      first = false;
    }
    if (isSetProjects()) {
      if (!first) sb.append(", ");
      sb.append("projects:");
      if (this.projects == null) {
        sb.append("null");
      } else {
        sb.append(this.projects);
      }
      first = false;
    }
    if (isSetLimit()) {
      if (!first) sb.append(", ");
      sb.append("limit:");
      sb.append(this.limit);
      first = false;
    }
    if (isSetOlapScanNode()) {
      if (!first) sb.append(", ");
      sb.append("olap_scan_node:");
      if (this.olap_scan_node == null) {
        sb.append("null");
      } else {
        sb.append(this.olap_scan_node);
      }
      first = false;
    }
    if (isSetAggregationNode()) {
      if (!first) sb.append(", ");
      sb.append("aggregation_node:");
      if (this.aggregation_node == null) {
        sb.append("null");
      } else {
        sb.append(this.aggregation_node);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (olap_scan_node != null) {
      olap_scan_node.validate();
    }
    if (aggregation_node != null) {
      aggregation_node.validate();
    }
  }

  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 TNormalizedPlanNodeStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TNormalizedPlanNodeStandardScheme getScheme() {
      return new TNormalizedPlanNodeStandardScheme();
    }
  }

  private static class TNormalizedPlanNodeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TNormalizedPlanNode> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TNormalizedPlanNode 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: // NODE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.node_id = iprot.readI32();
              struct.setNodeIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NODE_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.node_type = org.apache.doris.thrift.TPlanNodeType.findByValue(iprot.readI32());
              struct.setNodeTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NUM_CHILDREN
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.num_children = iprot.readI32();
              struct.setNumChildrenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TUPLE_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
                struct.tuple_ids = new java.util.HashSet<java.lang.Integer>(2*_set56.size);
                int _elem57;
                for (int _i58 = 0; _i58 < _set56.size; ++_i58)
                {
                  _elem57 = iprot.readI32();
                  struct.tuple_ids.add(_elem57);
                }
                iprot.readSetEnd();
              }
              struct.setTupleIdsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // NULLABLE_TUPLES
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set59 = iprot.readSetBegin();
                struct.nullable_tuples = new java.util.HashSet<java.lang.Integer>(2*_set59.size);
                int _elem60;
                for (int _i61 = 0; _i61 < _set59.size; ++_i61)
                {
                  _elem60 = iprot.readI32();
                  struct.nullable_tuples.add(_elem60);
                }
                iprot.readSetEnd();
              }
              struct.setNullableTuplesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // CONJUNCTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
                struct.conjuncts = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list62.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem63;
                for (int _i64 = 0; _i64 < _list62.size; ++_i64)
                {
                  _elem63 = new org.apache.doris.thrift.TExpr();
                  _elem63.read(iprot);
                  struct.conjuncts.add(_elem63);
                }
                iprot.readListEnd();
              }
              struct.setConjunctsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // PROJECTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list65 = iprot.readListBegin();
                struct.projects = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list65.size);
                @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem66;
                for (int _i67 = 0; _i67 < _list65.size; ++_i67)
                {
                  _elem66 = new org.apache.doris.thrift.TExpr();
                  _elem66.read(iprot);
                  struct.projects.add(_elem66);
                }
                iprot.readListEnd();
              }
              struct.setProjectsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // LIMIT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.limit = iprot.readI64();
              struct.setLimitIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // OLAP_SCAN_NODE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.olap_scan_node = new TNormalizedOlapScanNode();
              struct.olap_scan_node.read(iprot);
              struct.setOlapScanNodeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // AGGREGATION_NODE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.aggregation_node = new TNormalizedAggregateNode();
              struct.aggregation_node.read(iprot);
              struct.setAggregationNodeIsSet(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, TNormalizedPlanNode struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetNodeId()) {
        oprot.writeFieldBegin(NODE_ID_FIELD_DESC);
        oprot.writeI32(struct.node_id);
        oprot.writeFieldEnd();
      }
      if (struct.node_type != null) {
        if (struct.isSetNodeType()) {
          oprot.writeFieldBegin(NODE_TYPE_FIELD_DESC);
          oprot.writeI32(struct.node_type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetNumChildren()) {
        oprot.writeFieldBegin(NUM_CHILDREN_FIELD_DESC);
        oprot.writeI32(struct.num_children);
        oprot.writeFieldEnd();
      }
      if (struct.tuple_ids != null) {
        if (struct.isSetTupleIds()) {
          oprot.writeFieldBegin(TUPLE_IDS_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.tuple_ids.size()));
            for (int _iter68 : struct.tuple_ids)
            {
              oprot.writeI32(_iter68);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.nullable_tuples != null) {
        if (struct.isSetNullableTuples()) {
          oprot.writeFieldBegin(NULLABLE_TUPLES_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.nullable_tuples.size()));
            for (int _iter69 : struct.nullable_tuples)
            {
              oprot.writeI32(_iter69);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.conjuncts != null) {
        if (struct.isSetConjuncts()) {
          oprot.writeFieldBegin(CONJUNCTS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.conjuncts.size()));
            for (org.apache.doris.thrift.TExpr _iter70 : struct.conjuncts)
            {
              _iter70.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.projects != null) {
        if (struct.isSetProjects()) {
          oprot.writeFieldBegin(PROJECTS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.projects.size()));
            for (org.apache.doris.thrift.TExpr _iter71 : struct.projects)
            {
              _iter71.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetLimit()) {
        oprot.writeFieldBegin(LIMIT_FIELD_DESC);
        oprot.writeI64(struct.limit);
        oprot.writeFieldEnd();
      }
      if (struct.olap_scan_node != null) {
        if (struct.isSetOlapScanNode()) {
          oprot.writeFieldBegin(OLAP_SCAN_NODE_FIELD_DESC);
          struct.olap_scan_node.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.aggregation_node != null) {
        if (struct.isSetAggregationNode()) {
          oprot.writeFieldBegin(AGGREGATION_NODE_FIELD_DESC);
          struct.aggregation_node.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TNormalizedPlanNodeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TNormalizedPlanNode> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TNormalizedPlanNode 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.isSetNodeId()) {
        optionals.set(0);
      }
      if (struct.isSetNodeType()) {
        optionals.set(1);
      }
      if (struct.isSetNumChildren()) {
        optionals.set(2);
      }
      if (struct.isSetTupleIds()) {
        optionals.set(3);
      }
      if (struct.isSetNullableTuples()) {
        optionals.set(4);
      }
      if (struct.isSetConjuncts()) {
        optionals.set(5);
      }
      if (struct.isSetProjects()) {
        optionals.set(6);
      }
      if (struct.isSetLimit()) {
        optionals.set(7);
      }
      if (struct.isSetOlapScanNode()) {
        optionals.set(8);
      }
      if (struct.isSetAggregationNode()) {
        optionals.set(9);
      }
      oprot.writeBitSet(optionals, 10);
      if (struct.isSetNodeId()) {
        oprot.writeI32(struct.node_id);
      }
      if (struct.isSetNodeType()) {
        oprot.writeI32(struct.node_type.getValue());
      }
      if (struct.isSetNumChildren()) {
        oprot.writeI32(struct.num_children);
      }
      if (struct.isSetTupleIds()) {
        {
          oprot.writeI32(struct.tuple_ids.size());
          for (int _iter72 : struct.tuple_ids)
          {
            oprot.writeI32(_iter72);
          }
        }
      }
      if (struct.isSetNullableTuples()) {
        {
          oprot.writeI32(struct.nullable_tuples.size());
          for (int _iter73 : struct.nullable_tuples)
          {
            oprot.writeI32(_iter73);
          }
        }
      }
      if (struct.isSetConjuncts()) {
        {
          oprot.writeI32(struct.conjuncts.size());
          for (org.apache.doris.thrift.TExpr _iter74 : struct.conjuncts)
          {
            _iter74.write(oprot);
          }
        }
      }
      if (struct.isSetProjects()) {
        {
          oprot.writeI32(struct.projects.size());
          for (org.apache.doris.thrift.TExpr _iter75 : struct.projects)
          {
            _iter75.write(oprot);
          }
        }
      }
      if (struct.isSetLimit()) {
        oprot.writeI64(struct.limit);
      }
      if (struct.isSetOlapScanNode()) {
        struct.olap_scan_node.write(oprot);
      }
      if (struct.isSetAggregationNode()) {
        struct.aggregation_node.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TNormalizedPlanNode struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(10);
      if (incoming.get(0)) {
        struct.node_id = iprot.readI32();
        struct.setNodeIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.node_type = org.apache.doris.thrift.TPlanNodeType.findByValue(iprot.readI32());
        struct.setNodeTypeIsSet(true);
      }
      if (incoming.get(2)) {
        struct.num_children = iprot.readI32();
        struct.setNumChildrenIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TSet _set76 = iprot.readSetBegin(org.apache.thrift.protocol.TType.I32);
          struct.tuple_ids = new java.util.HashSet<java.lang.Integer>(2*_set76.size);
          int _elem77;
          for (int _i78 = 0; _i78 < _set76.size; ++_i78)
          {
            _elem77 = iprot.readI32();
            struct.tuple_ids.add(_elem77);
          }
        }
        struct.setTupleIdsIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TSet _set79 = iprot.readSetBegin(org.apache.thrift.protocol.TType.I32);
          struct.nullable_tuples = new java.util.HashSet<java.lang.Integer>(2*_set79.size);
          int _elem80;
          for (int _i81 = 0; _i81 < _set79.size; ++_i81)
          {
            _elem80 = iprot.readI32();
            struct.nullable_tuples.add(_elem80);
          }
        }
        struct.setNullableTuplesIsSet(true);
      }
      if (incoming.get(5)) {
        {
          org.apache.thrift.protocol.TList _list82 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.conjuncts = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list82.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem83;
          for (int _i84 = 0; _i84 < _list82.size; ++_i84)
          {
            _elem83 = new org.apache.doris.thrift.TExpr();
            _elem83.read(iprot);
            struct.conjuncts.add(_elem83);
          }
        }
        struct.setConjunctsIsSet(true);
      }
      if (incoming.get(6)) {
        {
          org.apache.thrift.protocol.TList _list85 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.projects = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list85.size);
          @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem86;
          for (int _i87 = 0; _i87 < _list85.size; ++_i87)
          {
            _elem86 = new org.apache.doris.thrift.TExpr();
            _elem86.read(iprot);
            struct.projects.add(_elem86);
          }
        }
        struct.setProjectsIsSet(true);
      }
      if (incoming.get(7)) {
        struct.limit = iprot.readI64();
        struct.setLimitIsSet(true);
      }
      if (incoming.get(8)) {
        struct.olap_scan_node = new TNormalizedOlapScanNode();
        struct.olap_scan_node.read(iprot);
        struct.setOlapScanNodeIsSet(true);
      }
      if (incoming.get(9)) {
        struct.aggregation_node = new TNormalizedAggregateNode();
        struct.aggregation_node.read(iprot);
        struct.setAggregationNodeIsSet(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();
  }
}