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

  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)1);
  private static final org.apache.thrift.protocol.TField RESULT_EXPR_LISTS_FIELD_DESC = new org.apache.thrift.protocol.TField("result_expr_lists", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField CONST_EXPR_LISTS_FIELD_DESC = new org.apache.thrift.protocol.TField("const_expr_lists", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField FIRST_MATERIALIZED_CHILD_IDX_FIELD_DESC = new org.apache.thrift.protocol.TField("first_materialized_child_idx", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField IS_COLOCATE_FIELD_DESC = new org.apache.thrift.protocol.TField("is_colocate", org.apache.thrift.protocol.TType.BOOL, (short)5);

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

  public int tuple_id; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> result_expr_lists; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> const_expr_lists; // required
  public long first_materialized_child_idx; // required
  public boolean is_colocate; // 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 {
    TUPLE_ID((short)1, "tuple_id"),
    RESULT_EXPR_LISTS((short)2, "result_expr_lists"),
    CONST_EXPR_LISTS((short)3, "const_expr_lists"),
    FIRST_MATERIALIZED_CHILD_IDX((short)4, "first_materialized_child_idx"),
    IS_COLOCATE((short)5, "is_colocate");

    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: // TUPLE_ID
          return TUPLE_ID;
        case 2: // RESULT_EXPR_LISTS
          return RESULT_EXPR_LISTS;
        case 3: // CONST_EXPR_LISTS
          return CONST_EXPR_LISTS;
        case 4: // FIRST_MATERIALIZED_CHILD_IDX
          return FIRST_MATERIALIZED_CHILD_IDX;
        case 5: // IS_COLOCATE
          return IS_COLOCATE;
        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 __TUPLE_ID_ISSET_ID = 0;
  private static final int __FIRST_MATERIALIZED_CHILD_IDX_ISSET_ID = 1;
  private static final int __IS_COLOCATE_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.IS_COLOCATE};
  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.TUPLE_ID, new org.apache.thrift.meta_data.FieldMetaData("tuple_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTupleId")));
    tmpMap.put(_Fields.RESULT_EXPR_LISTS, new org.apache.thrift.meta_data.FieldMetaData("result_expr_lists", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            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.CONST_EXPR_LISTS, new org.apache.thrift.meta_data.FieldMetaData("const_expr_lists", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            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.FIRST_MATERIALIZED_CHILD_IDX, new org.apache.thrift.meta_data.FieldMetaData("first_materialized_child_idx", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IS_COLOCATE, new org.apache.thrift.meta_data.FieldMetaData("is_colocate", 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(TIntersectNode.class, metaDataMap);
  }

  public TIntersectNode() {
  }

  public TIntersectNode(
    int tuple_id,
    java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> result_expr_lists,
    java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> const_expr_lists,
    long first_materialized_child_idx)
  {
    this();
    this.tuple_id = tuple_id;
    setTupleIdIsSet(true);
    this.result_expr_lists = result_expr_lists;
    this.const_expr_lists = const_expr_lists;
    this.first_materialized_child_idx = first_materialized_child_idx;
    setFirstMaterializedChildIdxIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TIntersectNode(TIntersectNode other) {
    __isset_bitfield = other.__isset_bitfield;
    this.tuple_id = other.tuple_id;
    if (other.isSetResultExprLists()) {
      java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> __this__result_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(other.result_expr_lists.size());
      for (java.util.List<org.apache.doris.thrift.TExpr> other_element : other.result_expr_lists) {
        java.util.List<org.apache.doris.thrift.TExpr> __this__result_expr_lists_copy = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other_element.size());
        for (org.apache.doris.thrift.TExpr other_element_element : other_element) {
          __this__result_expr_lists_copy.add(new org.apache.doris.thrift.TExpr(other_element_element));
        }
        __this__result_expr_lists.add(__this__result_expr_lists_copy);
      }
      this.result_expr_lists = __this__result_expr_lists;
    }
    if (other.isSetConstExprLists()) {
      java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> __this__const_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(other.const_expr_lists.size());
      for (java.util.List<org.apache.doris.thrift.TExpr> other_element : other.const_expr_lists) {
        java.util.List<org.apache.doris.thrift.TExpr> __this__const_expr_lists_copy = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(other_element.size());
        for (org.apache.doris.thrift.TExpr other_element_element : other_element) {
          __this__const_expr_lists_copy.add(new org.apache.doris.thrift.TExpr(other_element_element));
        }
        __this__const_expr_lists.add(__this__const_expr_lists_copy);
      }
      this.const_expr_lists = __this__const_expr_lists;
    }
    this.first_materialized_child_idx = other.first_materialized_child_idx;
    this.is_colocate = other.is_colocate;
  }

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

  @Override
  public void clear() {
    setTupleIdIsSet(false);
    this.tuple_id = 0;
    this.result_expr_lists = null;
    this.const_expr_lists = null;
    setFirstMaterializedChildIdxIsSet(false);
    this.first_materialized_child_idx = 0;
    setIsColocateIsSet(false);
    this.is_colocate = false;
  }

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

  public TIntersectNode 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 int getResultExprListsSize() {
    return (this.result_expr_lists == null) ? 0 : this.result_expr_lists.size();
  }

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

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

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

  public TIntersectNode setResultExprLists(@org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> result_expr_lists) {
    this.result_expr_lists = result_expr_lists;
    return this;
  }

  public void unsetResultExprLists() {
    this.result_expr_lists = null;
  }

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

  public void setResultExprListsIsSet(boolean value) {
    if (!value) {
      this.result_expr_lists = null;
    }
  }

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

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

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

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

  public TIntersectNode setConstExprLists(@org.apache.thrift.annotation.Nullable java.util.List<java.util.List<org.apache.doris.thrift.TExpr>> const_expr_lists) {
    this.const_expr_lists = const_expr_lists;
    return this;
  }

  public void unsetConstExprLists() {
    this.const_expr_lists = null;
  }

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

  public void setConstExprListsIsSet(boolean value) {
    if (!value) {
      this.const_expr_lists = null;
    }
  }

  public long getFirstMaterializedChildIdx() {
    return this.first_materialized_child_idx;
  }

  public TIntersectNode setFirstMaterializedChildIdx(long first_materialized_child_idx) {
    this.first_materialized_child_idx = first_materialized_child_idx;
    setFirstMaterializedChildIdxIsSet(true);
    return this;
  }

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

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

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

  public boolean isIsColocate() {
    return this.is_colocate;
  }

  public TIntersectNode setIsColocate(boolean is_colocate) {
    this.is_colocate = is_colocate;
    setIsColocateIsSet(true);
    return this;
  }

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

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

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

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

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

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

    case FIRST_MATERIALIZED_CHILD_IDX:
      if (value == null) {
        unsetFirstMaterializedChildIdx();
      } else {
        setFirstMaterializedChildIdx((java.lang.Long)value);
      }
      break;

    case IS_COLOCATE:
      if (value == null) {
        unsetIsColocate();
      } else {
        setIsColocate((java.lang.Boolean)value);
      }
      break;

    }
  }

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

    case RESULT_EXPR_LISTS:
      return getResultExprLists();

    case CONST_EXPR_LISTS:
      return getConstExprLists();

    case FIRST_MATERIALIZED_CHILD_IDX:
      return getFirstMaterializedChildIdx();

    case IS_COLOCATE:
      return isIsColocate();

    }
    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 TUPLE_ID:
      return isSetTupleId();
    case RESULT_EXPR_LISTS:
      return isSetResultExprLists();
    case CONST_EXPR_LISTS:
      return isSetConstExprLists();
    case FIRST_MATERIALIZED_CHILD_IDX:
      return isSetFirstMaterializedChildIdx();
    case IS_COLOCATE:
      return isSetIsColocate();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_tuple_id = true;
    boolean that_present_tuple_id = true;
    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_result_expr_lists = true && this.isSetResultExprLists();
    boolean that_present_result_expr_lists = true && that.isSetResultExprLists();
    if (this_present_result_expr_lists || that_present_result_expr_lists) {
      if (!(this_present_result_expr_lists && that_present_result_expr_lists))
        return false;
      if (!this.result_expr_lists.equals(that.result_expr_lists))
        return false;
    }

    boolean this_present_const_expr_lists = true && this.isSetConstExprLists();
    boolean that_present_const_expr_lists = true && that.isSetConstExprLists();
    if (this_present_const_expr_lists || that_present_const_expr_lists) {
      if (!(this_present_const_expr_lists && that_present_const_expr_lists))
        return false;
      if (!this.const_expr_lists.equals(that.const_expr_lists))
        return false;
    }

    boolean this_present_first_materialized_child_idx = true;
    boolean that_present_first_materialized_child_idx = true;
    if (this_present_first_materialized_child_idx || that_present_first_materialized_child_idx) {
      if (!(this_present_first_materialized_child_idx && that_present_first_materialized_child_idx))
        return false;
      if (this.first_materialized_child_idx != that.first_materialized_child_idx)
        return false;
    }

    boolean this_present_is_colocate = true && this.isSetIsColocate();
    boolean that_present_is_colocate = true && that.isSetIsColocate();
    if (this_present_is_colocate || that_present_is_colocate) {
      if (!(this_present_is_colocate && that_present_is_colocate))
        return false;
      if (this.is_colocate != that.is_colocate)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + tuple_id;

    hashCode = hashCode * 8191 + ((isSetResultExprLists()) ? 131071 : 524287);
    if (isSetResultExprLists())
      hashCode = hashCode * 8191 + result_expr_lists.hashCode();

    hashCode = hashCode * 8191 + ((isSetConstExprLists()) ? 131071 : 524287);
    if (isSetConstExprLists())
      hashCode = hashCode * 8191 + const_expr_lists.hashCode();

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

    hashCode = hashCode * 8191 + ((isSetIsColocate()) ? 131071 : 524287);
    if (isSetIsColocate())
      hashCode = hashCode * 8191 + ((is_colocate) ? 131071 : 524287);

    return hashCode;
  }

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

    int lastComparison = 0;

    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(isSetResultExprLists(), other.isSetResultExprLists());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResultExprLists()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result_expr_lists, other.result_expr_lists);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConstExprLists(), other.isSetConstExprLists());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConstExprLists()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.const_expr_lists, other.const_expr_lists);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFirstMaterializedChildIdx(), other.isSetFirstMaterializedChildIdx());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFirstMaterializedChildIdx()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.first_materialized_child_idx, other.first_materialized_child_idx);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsColocate(), other.isSetIsColocate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsColocate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_colocate, other.is_colocate);
      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("TIntersectNode(");
    boolean first = true;

    sb.append("tuple_id:");
    sb.append(this.tuple_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("result_expr_lists:");
    if (this.result_expr_lists == null) {
      sb.append("null");
    } else {
      sb.append(this.result_expr_lists);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("const_expr_lists:");
    if (this.const_expr_lists == null) {
      sb.append("null");
    } else {
      sb.append(this.const_expr_lists);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("first_materialized_child_idx:");
    sb.append(this.first_materialized_child_idx);
    first = false;
    if (isSetIsColocate()) {
      if (!first) sb.append(", ");
      sb.append("is_colocate:");
      sb.append(this.is_colocate);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'tuple_id' because it's a primitive and you chose the non-beans generator.
    if (result_expr_lists == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'result_expr_lists' was not present! Struct: " + toString());
    }
    if (const_expr_lists == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'const_expr_lists' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'first_materialized_child_idx' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

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

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

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

  private static class TIntersectNodeStandardScheme extends org.apache.thrift.scheme.StandardScheme<TIntersectNode> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TIntersectNode 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: // 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 2: // RESULT_EXPR_LISTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list1042 = iprot.readListBegin();
                struct.result_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(_list1042.size);
                @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> _elem1043;
                for (int _i1044 = 0; _i1044 < _list1042.size; ++_i1044)
                {
                  {
                    org.apache.thrift.protocol.TList _list1045 = iprot.readListBegin();
                    _elem1043 = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list1045.size);
                    @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem1046;
                    for (int _i1047 = 0; _i1047 < _list1045.size; ++_i1047)
                    {
                      _elem1046 = new org.apache.doris.thrift.TExpr();
                      _elem1046.read(iprot);
                      _elem1043.add(_elem1046);
                    }
                    iprot.readListEnd();
                  }
                  struct.result_expr_lists.add(_elem1043);
                }
                iprot.readListEnd();
              }
              struct.setResultExprListsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CONST_EXPR_LISTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list1048 = iprot.readListBegin();
                struct.const_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(_list1048.size);
                @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> _elem1049;
                for (int _i1050 = 0; _i1050 < _list1048.size; ++_i1050)
                {
                  {
                    org.apache.thrift.protocol.TList _list1051 = iprot.readListBegin();
                    _elem1049 = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list1051.size);
                    @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem1052;
                    for (int _i1053 = 0; _i1053 < _list1051.size; ++_i1053)
                    {
                      _elem1052 = new org.apache.doris.thrift.TExpr();
                      _elem1052.read(iprot);
                      _elem1049.add(_elem1052);
                    }
                    iprot.readListEnd();
                  }
                  struct.const_expr_lists.add(_elem1049);
                }
                iprot.readListEnd();
              }
              struct.setConstExprListsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // FIRST_MATERIALIZED_CHILD_IDX
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.first_materialized_child_idx = iprot.readI64();
              struct.setFirstMaterializedChildIdxIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // IS_COLOCATE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_colocate = iprot.readBool();
              struct.setIsColocateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetTupleId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'tuple_id' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetFirstMaterializedChildIdx()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'first_materialized_child_idx' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(TUPLE_ID_FIELD_DESC);
      oprot.writeI32(struct.tuple_id);
      oprot.writeFieldEnd();
      if (struct.result_expr_lists != null) {
        oprot.writeFieldBegin(RESULT_EXPR_LISTS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.result_expr_lists.size()));
          for (java.util.List<org.apache.doris.thrift.TExpr> _iter1054 : struct.result_expr_lists)
          {
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter1054.size()));
              for (org.apache.doris.thrift.TExpr _iter1055 : _iter1054)
              {
                _iter1055.write(oprot);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.const_expr_lists != null) {
        oprot.writeFieldBegin(CONST_EXPR_LISTS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.const_expr_lists.size()));
          for (java.util.List<org.apache.doris.thrift.TExpr> _iter1056 : struct.const_expr_lists)
          {
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter1056.size()));
              for (org.apache.doris.thrift.TExpr _iter1057 : _iter1056)
              {
                _iter1057.write(oprot);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(FIRST_MATERIALIZED_CHILD_IDX_FIELD_DESC);
      oprot.writeI64(struct.first_materialized_child_idx);
      oprot.writeFieldEnd();
      if (struct.isSetIsColocate()) {
        oprot.writeFieldBegin(IS_COLOCATE_FIELD_DESC);
        oprot.writeBool(struct.is_colocate);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TIntersectNodeTupleScheme extends org.apache.thrift.scheme.TupleScheme<TIntersectNode> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TIntersectNode struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.tuple_id);
      {
        oprot.writeI32(struct.result_expr_lists.size());
        for (java.util.List<org.apache.doris.thrift.TExpr> _iter1058 : struct.result_expr_lists)
        {
          {
            oprot.writeI32(_iter1058.size());
            for (org.apache.doris.thrift.TExpr _iter1059 : _iter1058)
            {
              _iter1059.write(oprot);
            }
          }
        }
      }
      {
        oprot.writeI32(struct.const_expr_lists.size());
        for (java.util.List<org.apache.doris.thrift.TExpr> _iter1060 : struct.const_expr_lists)
        {
          {
            oprot.writeI32(_iter1060.size());
            for (org.apache.doris.thrift.TExpr _iter1061 : _iter1060)
            {
              _iter1061.write(oprot);
            }
          }
        }
      }
      oprot.writeI64(struct.first_materialized_child_idx);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetIsColocate()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetIsColocate()) {
        oprot.writeBool(struct.is_colocate);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TIntersectNode struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.tuple_id = iprot.readI32();
      struct.setTupleIdIsSet(true);
      {
        org.apache.thrift.protocol.TList _list1062 = iprot.readListBegin(org.apache.thrift.protocol.TType.LIST);
        struct.result_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(_list1062.size);
        @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> _elem1063;
        for (int _i1064 = 0; _i1064 < _list1062.size; ++_i1064)
        {
          {
            org.apache.thrift.protocol.TList _list1065 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
            _elem1063 = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list1065.size);
            @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem1066;
            for (int _i1067 = 0; _i1067 < _list1065.size; ++_i1067)
            {
              _elem1066 = new org.apache.doris.thrift.TExpr();
              _elem1066.read(iprot);
              _elem1063.add(_elem1066);
            }
          }
          struct.result_expr_lists.add(_elem1063);
        }
      }
      struct.setResultExprListsIsSet(true);
      {
        org.apache.thrift.protocol.TList _list1068 = iprot.readListBegin(org.apache.thrift.protocol.TType.LIST);
        struct.const_expr_lists = new java.util.ArrayList<java.util.List<org.apache.doris.thrift.TExpr>>(_list1068.size);
        @org.apache.thrift.annotation.Nullable java.util.List<org.apache.doris.thrift.TExpr> _elem1069;
        for (int _i1070 = 0; _i1070 < _list1068.size; ++_i1070)
        {
          {
            org.apache.thrift.protocol.TList _list1071 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
            _elem1069 = new java.util.ArrayList<org.apache.doris.thrift.TExpr>(_list1071.size);
            @org.apache.thrift.annotation.Nullable org.apache.doris.thrift.TExpr _elem1072;
            for (int _i1073 = 0; _i1073 < _list1071.size; ++_i1073)
            {
              _elem1072 = new org.apache.doris.thrift.TExpr();
              _elem1072.read(iprot);
              _elem1069.add(_elem1072);
            }
          }
          struct.const_expr_lists.add(_elem1069);
        }
      }
      struct.setConstExprListsIsSet(true);
      struct.first_materialized_child_idx = iprot.readI64();
      struct.setFirstMaterializedChildIdxIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        struct.is_colocate = iprot.readBool();
        struct.setIsColocateIsSet(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();
  }
}