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

  private static final org.apache.thrift.protocol.TField CLAUSE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("clause_type", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField FIELD_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("field_name", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("children", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField OCCUR_FIELD_DESC = new org.apache.thrift.protocol.TField("occur", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField MINIMUM_SHOULD_MATCH_FIELD_DESC = new org.apache.thrift.protocol.TField("minimum_should_match", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField NESTED_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("nested_path", org.apache.thrift.protocol.TType.STRING, (short)7);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String clause_type; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String field_name; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String value; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<TSearchClause> children; // optional
  /**
   * 
   * @see TSearchOccur
   */
  public @org.apache.thrift.annotation.Nullable TSearchOccur occur; // optional
  public int minimum_should_match; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String nested_path; // 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 {
    CLAUSE_TYPE((short)1, "clause_type"),
    FIELD_NAME((short)2, "field_name"),
    VALUE((short)3, "value"),
    CHILDREN((short)4, "children"),
    /**
     * 
     * @see TSearchOccur
     */
    OCCUR((short)5, "occur"),
    MINIMUM_SHOULD_MATCH((short)6, "minimum_should_match"),
    NESTED_PATH((short)7, "nested_path");

    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: // CLAUSE_TYPE
          return CLAUSE_TYPE;
        case 2: // FIELD_NAME
          return FIELD_NAME;
        case 3: // VALUE
          return VALUE;
        case 4: // CHILDREN
          return CHILDREN;
        case 5: // OCCUR
          return OCCUR;
        case 6: // MINIMUM_SHOULD_MATCH
          return MINIMUM_SHOULD_MATCH;
        case 7: // NESTED_PATH
          return NESTED_PATH;
        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 __MINIMUM_SHOULD_MATCH_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.FIELD_NAME,_Fields.VALUE,_Fields.CHILDREN,_Fields.OCCUR,_Fields.MINIMUM_SHOULD_MATCH,_Fields.NESTED_PATH};
  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.CLAUSE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("clause_type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FIELD_NAME, new org.apache.thrift.meta_data.FieldMetaData("field_name", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("children", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "TSearchClause"))));
    tmpMap.put(_Fields.OCCUR, new org.apache.thrift.meta_data.FieldMetaData("occur", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSearchOccur.class)));
    tmpMap.put(_Fields.MINIMUM_SHOULD_MATCH, new org.apache.thrift.meta_data.FieldMetaData("minimum_should_match", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NESTED_PATH, new org.apache.thrift.meta_data.FieldMetaData("nested_path", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSearchClause.class, metaDataMap);
  }

  public TSearchClause() {
  }

  public TSearchClause(
    java.lang.String clause_type)
  {
    this();
    this.clause_type = clause_type;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSearchClause(TSearchClause other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetClauseType()) {
      this.clause_type = other.clause_type;
    }
    if (other.isSetFieldName()) {
      this.field_name = other.field_name;
    }
    if (other.isSetValue()) {
      this.value = other.value;
    }
    if (other.isSetChildren()) {
      java.util.List<TSearchClause> __this__children = new java.util.ArrayList<TSearchClause>(other.children.size());
      for (TSearchClause other_element : other.children) {
        __this__children.add(new TSearchClause(other_element));
      }
      this.children = __this__children;
    }
    if (other.isSetOccur()) {
      this.occur = other.occur;
    }
    this.minimum_should_match = other.minimum_should_match;
    if (other.isSetNestedPath()) {
      this.nested_path = other.nested_path;
    }
  }

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

  @Override
  public void clear() {
    this.clause_type = null;
    this.field_name = null;
    this.value = null;
    this.children = null;
    this.occur = null;
    setMinimumShouldMatchIsSet(false);
    this.minimum_should_match = 0;
    this.nested_path = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getClauseType() {
    return this.clause_type;
  }

  public TSearchClause setClauseType(@org.apache.thrift.annotation.Nullable java.lang.String clause_type) {
    this.clause_type = clause_type;
    return this;
  }

  public void unsetClauseType() {
    this.clause_type = null;
  }

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

  public void setClauseTypeIsSet(boolean value) {
    if (!value) {
      this.clause_type = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFieldName() {
    return this.field_name;
  }

  public TSearchClause setFieldName(@org.apache.thrift.annotation.Nullable java.lang.String field_name) {
    this.field_name = field_name;
    return this;
  }

  public void unsetFieldName() {
    this.field_name = null;
  }

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

  public void setFieldNameIsSet(boolean value) {
    if (!value) {
      this.field_name = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getValue() {
    return this.value;
  }

  public TSearchClause setValue(@org.apache.thrift.annotation.Nullable java.lang.String value) {
    this.value = value;
    return this;
  }

  public void unsetValue() {
    this.value = null;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<TSearchClause> getChildrenIterator() {
    return (this.children == null) ? null : this.children.iterator();
  }

  public void addToChildren(TSearchClause elem) {
    if (this.children == null) {
      this.children = new java.util.ArrayList<TSearchClause>();
    }
    this.children.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<TSearchClause> getChildren() {
    return this.children;
  }

  public TSearchClause setChildren(@org.apache.thrift.annotation.Nullable java.util.List<TSearchClause> children) {
    this.children = children;
    return this;
  }

  public void unsetChildren() {
    this.children = null;
  }

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

  public void setChildrenIsSet(boolean value) {
    if (!value) {
      this.children = null;
    }
  }

  /**
   * 
   * @see TSearchOccur
   */
  @org.apache.thrift.annotation.Nullable
  public TSearchOccur getOccur() {
    return this.occur;
  }

  /**
   * 
   * @see TSearchOccur
   */
  public TSearchClause setOccur(@org.apache.thrift.annotation.Nullable TSearchOccur occur) {
    this.occur = occur;
    return this;
  }

  public void unsetOccur() {
    this.occur = null;
  }

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

  public void setOccurIsSet(boolean value) {
    if (!value) {
      this.occur = null;
    }
  }

  public int getMinimumShouldMatch() {
    return this.minimum_should_match;
  }

  public TSearchClause setMinimumShouldMatch(int minimum_should_match) {
    this.minimum_should_match = minimum_should_match;
    setMinimumShouldMatchIsSet(true);
    return this;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getNestedPath() {
    return this.nested_path;
  }

  public TSearchClause setNestedPath(@org.apache.thrift.annotation.Nullable java.lang.String nested_path) {
    this.nested_path = nested_path;
    return this;
  }

  public void unsetNestedPath() {
    this.nested_path = null;
  }

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

  public void setNestedPathIsSet(boolean value) {
    if (!value) {
      this.nested_path = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CLAUSE_TYPE:
      if (value == null) {
        unsetClauseType();
      } else {
        setClauseType((java.lang.String)value);
      }
      break;

    case FIELD_NAME:
      if (value == null) {
        unsetFieldName();
      } else {
        setFieldName((java.lang.String)value);
      }
      break;

    case VALUE:
      if (value == null) {
        unsetValue();
      } else {
        setValue((java.lang.String)value);
      }
      break;

    case CHILDREN:
      if (value == null) {
        unsetChildren();
      } else {
        setChildren((java.util.List<TSearchClause>)value);
      }
      break;

    case OCCUR:
      if (value == null) {
        unsetOccur();
      } else {
        setOccur((TSearchOccur)value);
      }
      break;

    case MINIMUM_SHOULD_MATCH:
      if (value == null) {
        unsetMinimumShouldMatch();
      } else {
        setMinimumShouldMatch((java.lang.Integer)value);
      }
      break;

    case NESTED_PATH:
      if (value == null) {
        unsetNestedPath();
      } else {
        setNestedPath((java.lang.String)value);
      }
      break;

    }
  }

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

    case FIELD_NAME:
      return getFieldName();

    case VALUE:
      return getValue();

    case CHILDREN:
      return getChildren();

    case OCCUR:
      return getOccur();

    case MINIMUM_SHOULD_MATCH:
      return getMinimumShouldMatch();

    case NESTED_PATH:
      return getNestedPath();

    }
    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 CLAUSE_TYPE:
      return isSetClauseType();
    case FIELD_NAME:
      return isSetFieldName();
    case VALUE:
      return isSetValue();
    case CHILDREN:
      return isSetChildren();
    case OCCUR:
      return isSetOccur();
    case MINIMUM_SHOULD_MATCH:
      return isSetMinimumShouldMatch();
    case NESTED_PATH:
      return isSetNestedPath();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_clause_type = true && this.isSetClauseType();
    boolean that_present_clause_type = true && that.isSetClauseType();
    if (this_present_clause_type || that_present_clause_type) {
      if (!(this_present_clause_type && that_present_clause_type))
        return false;
      if (!this.clause_type.equals(that.clause_type))
        return false;
    }

    boolean this_present_field_name = true && this.isSetFieldName();
    boolean that_present_field_name = true && that.isSetFieldName();
    if (this_present_field_name || that_present_field_name) {
      if (!(this_present_field_name && that_present_field_name))
        return false;
      if (!this.field_name.equals(that.field_name))
        return false;
    }

    boolean this_present_value = true && this.isSetValue();
    boolean that_present_value = true && that.isSetValue();
    if (this_present_value || that_present_value) {
      if (!(this_present_value && that_present_value))
        return false;
      if (!this.value.equals(that.value))
        return false;
    }

    boolean this_present_children = true && this.isSetChildren();
    boolean that_present_children = true && that.isSetChildren();
    if (this_present_children || that_present_children) {
      if (!(this_present_children && that_present_children))
        return false;
      if (!this.children.equals(that.children))
        return false;
    }

    boolean this_present_occur = true && this.isSetOccur();
    boolean that_present_occur = true && that.isSetOccur();
    if (this_present_occur || that_present_occur) {
      if (!(this_present_occur && that_present_occur))
        return false;
      if (!this.occur.equals(that.occur))
        return false;
    }

    boolean this_present_minimum_should_match = true && this.isSetMinimumShouldMatch();
    boolean that_present_minimum_should_match = true && that.isSetMinimumShouldMatch();
    if (this_present_minimum_should_match || that_present_minimum_should_match) {
      if (!(this_present_minimum_should_match && that_present_minimum_should_match))
        return false;
      if (this.minimum_should_match != that.minimum_should_match)
        return false;
    }

    boolean this_present_nested_path = true && this.isSetNestedPath();
    boolean that_present_nested_path = true && that.isSetNestedPath();
    if (this_present_nested_path || that_present_nested_path) {
      if (!(this_present_nested_path && that_present_nested_path))
        return false;
      if (!this.nested_path.equals(that.nested_path))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetClauseType()) ? 131071 : 524287);
    if (isSetClauseType())
      hashCode = hashCode * 8191 + clause_type.hashCode();

    hashCode = hashCode * 8191 + ((isSetFieldName()) ? 131071 : 524287);
    if (isSetFieldName())
      hashCode = hashCode * 8191 + field_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetValue()) ? 131071 : 524287);
    if (isSetValue())
      hashCode = hashCode * 8191 + value.hashCode();

    hashCode = hashCode * 8191 + ((isSetChildren()) ? 131071 : 524287);
    if (isSetChildren())
      hashCode = hashCode * 8191 + children.hashCode();

    hashCode = hashCode * 8191 + ((isSetOccur()) ? 131071 : 524287);
    if (isSetOccur())
      hashCode = hashCode * 8191 + occur.getValue();

    hashCode = hashCode * 8191 + ((isSetMinimumShouldMatch()) ? 131071 : 524287);
    if (isSetMinimumShouldMatch())
      hashCode = hashCode * 8191 + minimum_should_match;

    hashCode = hashCode * 8191 + ((isSetNestedPath()) ? 131071 : 524287);
    if (isSetNestedPath())
      hashCode = hashCode * 8191 + nested_path.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetClauseType(), other.isSetClauseType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetClauseType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clause_type, other.clause_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFieldName(), other.isSetFieldName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFieldName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.field_name, other.field_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetValue(), other.isSetValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetChildren(), other.isSetChildren());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChildren()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.children, other.children);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetOccur(), other.isSetOccur());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOccur()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.occur, other.occur);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMinimumShouldMatch(), other.isSetMinimumShouldMatch());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinimumShouldMatch()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.minimum_should_match, other.minimum_should_match);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNestedPath(), other.isSetNestedPath());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNestedPath()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nested_path, other.nested_path);
      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("TSearchClause(");
    boolean first = true;

    sb.append("clause_type:");
    if (this.clause_type == null) {
      sb.append("null");
    } else {
      sb.append(this.clause_type);
    }
    first = false;
    if (isSetFieldName()) {
      if (!first) sb.append(", ");
      sb.append("field_name:");
      if (this.field_name == null) {
        sb.append("null");
      } else {
        sb.append(this.field_name);
      }
      first = false;
    }
    if (isSetValue()) {
      if (!first) sb.append(", ");
      sb.append("value:");
      if (this.value == null) {
        sb.append("null");
      } else {
        sb.append(this.value);
      }
      first = false;
    }
    if (isSetChildren()) {
      if (!first) sb.append(", ");
      sb.append("children:");
      if (this.children == null) {
        sb.append("null");
      } else {
        sb.append(this.children);
      }
      first = false;
    }
    if (isSetOccur()) {
      if (!first) sb.append(", ");
      sb.append("occur:");
      if (this.occur == null) {
        sb.append("null");
      } else {
        sb.append(this.occur);
      }
      first = false;
    }
    if (isSetMinimumShouldMatch()) {
      if (!first) sb.append(", ");
      sb.append("minimum_should_match:");
      sb.append(this.minimum_should_match);
      first = false;
    }
    if (isSetNestedPath()) {
      if (!first) sb.append(", ");
      sb.append("nested_path:");
      if (this.nested_path == null) {
        sb.append("null");
      } else {
        sb.append(this.nested_path);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (clause_type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'clause_type' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

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

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

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

  private static class TSearchClauseStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSearchClause> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSearchClause 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: // CLAUSE_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.clause_type = iprot.readString();
              struct.setClauseTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FIELD_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.field_name = iprot.readString();
              struct.setFieldNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.value = iprot.readString();
              struct.setValueIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // CHILDREN
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list26 = iprot.readListBegin();
                struct.children = new java.util.ArrayList<TSearchClause>(_list26.size);
                @org.apache.thrift.annotation.Nullable TSearchClause _elem27;
                for (int _i28 = 0; _i28 < _list26.size; ++_i28)
                {
                  _elem27 = new TSearchClause();
                  _elem27.read(iprot);
                  struct.children.add(_elem27);
                }
                iprot.readListEnd();
              }
              struct.setChildrenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // OCCUR
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.occur = org.apache.doris.thrift.TSearchOccur.findByValue(iprot.readI32());
              struct.setOccurIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // MINIMUM_SHOULD_MATCH
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.minimum_should_match = iprot.readI32();
              struct.setMinimumShouldMatchIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // NESTED_PATH
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.nested_path = iprot.readString();
              struct.setNestedPathIsSet(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, TSearchClause struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.clause_type != null) {
        oprot.writeFieldBegin(CLAUSE_TYPE_FIELD_DESC);
        oprot.writeString(struct.clause_type);
        oprot.writeFieldEnd();
      }
      if (struct.field_name != null) {
        if (struct.isSetFieldName()) {
          oprot.writeFieldBegin(FIELD_NAME_FIELD_DESC);
          oprot.writeString(struct.field_name);
          oprot.writeFieldEnd();
        }
      }
      if (struct.value != null) {
        if (struct.isSetValue()) {
          oprot.writeFieldBegin(VALUE_FIELD_DESC);
          oprot.writeString(struct.value);
          oprot.writeFieldEnd();
        }
      }
      if (struct.children != null) {
        if (struct.isSetChildren()) {
          oprot.writeFieldBegin(CHILDREN_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.children.size()));
            for (TSearchClause _iter29 : struct.children)
            {
              _iter29.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.occur != null) {
        if (struct.isSetOccur()) {
          oprot.writeFieldBegin(OCCUR_FIELD_DESC);
          oprot.writeI32(struct.occur.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetMinimumShouldMatch()) {
        oprot.writeFieldBegin(MINIMUM_SHOULD_MATCH_FIELD_DESC);
        oprot.writeI32(struct.minimum_should_match);
        oprot.writeFieldEnd();
      }
      if (struct.nested_path != null) {
        if (struct.isSetNestedPath()) {
          oprot.writeFieldBegin(NESTED_PATH_FIELD_DESC);
          oprot.writeString(struct.nested_path);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSearchClauseTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSearchClause> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSearchClause struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.clause_type);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetFieldName()) {
        optionals.set(0);
      }
      if (struct.isSetValue()) {
        optionals.set(1);
      }
      if (struct.isSetChildren()) {
        optionals.set(2);
      }
      if (struct.isSetOccur()) {
        optionals.set(3);
      }
      if (struct.isSetMinimumShouldMatch()) {
        optionals.set(4);
      }
      if (struct.isSetNestedPath()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetFieldName()) {
        oprot.writeString(struct.field_name);
      }
      if (struct.isSetValue()) {
        oprot.writeString(struct.value);
      }
      if (struct.isSetChildren()) {
        {
          oprot.writeI32(struct.children.size());
          for (TSearchClause _iter30 : struct.children)
          {
            _iter30.write(oprot);
          }
        }
      }
      if (struct.isSetOccur()) {
        oprot.writeI32(struct.occur.getValue());
      }
      if (struct.isSetMinimumShouldMatch()) {
        oprot.writeI32(struct.minimum_should_match);
      }
      if (struct.isSetNestedPath()) {
        oprot.writeString(struct.nested_path);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSearchClause struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.clause_type = iprot.readString();
      struct.setClauseTypeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.field_name = iprot.readString();
        struct.setFieldNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.value = iprot.readString();
        struct.setValueIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list31 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.children = new java.util.ArrayList<TSearchClause>(_list31.size);
          @org.apache.thrift.annotation.Nullable TSearchClause _elem32;
          for (int _i33 = 0; _i33 < _list31.size; ++_i33)
          {
            _elem32 = new TSearchClause();
            _elem32.read(iprot);
            struct.children.add(_elem32);
          }
        }
        struct.setChildrenIsSet(true);
      }
      if (incoming.get(3)) {
        struct.occur = org.apache.doris.thrift.TSearchOccur.findByValue(iprot.readI32());
        struct.setOccurIsSet(true);
      }
      if (incoming.get(4)) {
        struct.minimum_should_match = iprot.readI32();
        struct.setMinimumShouldMatchIsSet(true);
      }
      if (incoming.get(5)) {
        struct.nested_path = iprot.readString();
        struct.setNestedPathIsSet(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();
  }
}