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

  private static final org.apache.thrift.protocol.TField META_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("metaData", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField RESULT_ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("resultRows", org.apache.thrift.protocol.TType.LIST, (short)2);

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

  public @org.apache.thrift.annotation.Nullable TShowResultSetMetaData metaData; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.util.List<java.lang.String>> resultRows; // required

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

    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: // META_DATA
          return META_DATA;
        case 2: // RESULT_ROWS
          return RESULT_ROWS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.META_DATA, new org.apache.thrift.meta_data.FieldMetaData("metaData", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TShowResultSetMetaData.class)));
    tmpMap.put(_Fields.RESULT_ROWS, new org.apache.thrift.meta_data.FieldMetaData("resultRows", 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TShowResultSet.class, metaDataMap);
  }

  public TShowResultSet() {
  }

  public TShowResultSet(
    TShowResultSetMetaData metaData,
    java.util.List<java.util.List<java.lang.String>> resultRows)
  {
    this();
    this.metaData = metaData;
    this.resultRows = resultRows;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TShowResultSet(TShowResultSet other) {
    if (other.isSetMetaData()) {
      this.metaData = new TShowResultSetMetaData(other.metaData);
    }
    if (other.isSetResultRows()) {
      java.util.List<java.util.List<java.lang.String>> __this__resultRows = new java.util.ArrayList<java.util.List<java.lang.String>>(other.resultRows.size());
      for (java.util.List<java.lang.String> other_element : other.resultRows) {
        java.util.List<java.lang.String> __this__resultRows_copy = new java.util.ArrayList<java.lang.String>(other_element);
        __this__resultRows.add(__this__resultRows_copy);
      }
      this.resultRows = __this__resultRows;
    }
  }

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

  @Override
  public void clear() {
    this.metaData = null;
    this.resultRows = null;
  }

  @org.apache.thrift.annotation.Nullable
  public TShowResultSetMetaData getMetaData() {
    return this.metaData;
  }

  public TShowResultSet setMetaData(@org.apache.thrift.annotation.Nullable TShowResultSetMetaData metaData) {
    this.metaData = metaData;
    return this;
  }

  public void unsetMetaData() {
    this.metaData = null;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.util.List<java.lang.String>> getResultRowsIterator() {
    return (this.resultRows == null) ? null : this.resultRows.iterator();
  }

  public void addToResultRows(java.util.List<java.lang.String> elem) {
    if (this.resultRows == null) {
      this.resultRows = new java.util.ArrayList<java.util.List<java.lang.String>>();
    }
    this.resultRows.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.util.List<java.lang.String>> getResultRows() {
    return this.resultRows;
  }

  public TShowResultSet setResultRows(@org.apache.thrift.annotation.Nullable java.util.List<java.util.List<java.lang.String>> resultRows) {
    this.resultRows = resultRows;
    return this;
  }

  public void unsetResultRows() {
    this.resultRows = null;
  }

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case META_DATA:
      if (value == null) {
        unsetMetaData();
      } else {
        setMetaData((TShowResultSetMetaData)value);
      }
      break;

    case RESULT_ROWS:
      if (value == null) {
        unsetResultRows();
      } else {
        setResultRows((java.util.List<java.util.List<java.lang.String>>)value);
      }
      break;

    }
  }

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

    case RESULT_ROWS:
      return getResultRows();

    }
    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 META_DATA:
      return isSetMetaData();
    case RESULT_ROWS:
      return isSetResultRows();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_metaData = true && this.isSetMetaData();
    boolean that_present_metaData = true && that.isSetMetaData();
    if (this_present_metaData || that_present_metaData) {
      if (!(this_present_metaData && that_present_metaData))
        return false;
      if (!this.metaData.equals(that.metaData))
        return false;
    }

    boolean this_present_resultRows = true && this.isSetResultRows();
    boolean that_present_resultRows = true && that.isSetResultRows();
    if (this_present_resultRows || that_present_resultRows) {
      if (!(this_present_resultRows && that_present_resultRows))
        return false;
      if (!this.resultRows.equals(that.resultRows))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetMetaData()) ? 131071 : 524287);
    if (isSetMetaData())
      hashCode = hashCode * 8191 + metaData.hashCode();

    hashCode = hashCode * 8191 + ((isSetResultRows()) ? 131071 : 524287);
    if (isSetResultRows())
      hashCode = hashCode * 8191 + resultRows.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetMetaData(), other.isSetMetaData());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMetaData()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metaData, other.metaData);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetResultRows(), other.isSetResultRows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResultRows()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resultRows, other.resultRows);
      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("TShowResultSet(");
    boolean first = true;

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

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

  private static class TShowResultSetStandardScheme extends org.apache.thrift.scheme.StandardScheme<TShowResultSet> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TShowResultSet 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: // META_DATA
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.metaData = new TShowResultSetMetaData();
              struct.metaData.read(iprot);
              struct.setMetaDataIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // RESULT_ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list328 = iprot.readListBegin();
                struct.resultRows = new java.util.ArrayList<java.util.List<java.lang.String>>(_list328.size);
                @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> _elem329;
                for (int _i330 = 0; _i330 < _list328.size; ++_i330)
                {
                  {
                    org.apache.thrift.protocol.TList _list331 = iprot.readListBegin();
                    _elem329 = new java.util.ArrayList<java.lang.String>(_list331.size);
                    @org.apache.thrift.annotation.Nullable java.lang.String _elem332;
                    for (int _i333 = 0; _i333 < _list331.size; ++_i333)
                    {
                      _elem332 = iprot.readString();
                      _elem329.add(_elem332);
                    }
                    iprot.readListEnd();
                  }
                  struct.resultRows.add(_elem329);
                }
                iprot.readListEnd();
              }
              struct.setResultRowsIsSet(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, TShowResultSet struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.metaData != null) {
        oprot.writeFieldBegin(META_DATA_FIELD_DESC);
        struct.metaData.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.resultRows != null) {
        oprot.writeFieldBegin(RESULT_ROWS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.resultRows.size()));
          for (java.util.List<java.lang.String> _iter334 : struct.resultRows)
          {
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter334.size()));
              for (java.lang.String _iter335 : _iter334)
              {
                oprot.writeString(_iter335);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TShowResultSetTupleScheme extends org.apache.thrift.scheme.TupleScheme<TShowResultSet> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TShowResultSet struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.metaData.write(oprot);
      {
        oprot.writeI32(struct.resultRows.size());
        for (java.util.List<java.lang.String> _iter336 : struct.resultRows)
        {
          {
            oprot.writeI32(_iter336.size());
            for (java.lang.String _iter337 : _iter336)
            {
              oprot.writeString(_iter337);
            }
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TShowResultSet struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.metaData = new TShowResultSetMetaData();
      struct.metaData.read(iprot);
      struct.setMetaDataIsSet(true);
      {
        org.apache.thrift.protocol.TList _list338 = iprot.readListBegin(org.apache.thrift.protocol.TType.LIST);
        struct.resultRows = new java.util.ArrayList<java.util.List<java.lang.String>>(_list338.size);
        @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> _elem339;
        for (int _i340 = 0; _i340 < _list338.size; ++_i340)
        {
          {
            org.apache.thrift.protocol.TList _list341 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
            _elem339 = new java.util.ArrayList<java.lang.String>(_list341.size);
            @org.apache.thrift.annotation.Nullable java.lang.String _elem342;
            for (int _i343 = 0; _i343 < _list341.size; ++_i343)
            {
              _elem342 = iprot.readString();
              _elem339.add(_elem342);
            }
          }
          struct.resultRows.add(_elem339);
        }
      }
      struct.setResultRowsIsSet(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();
  }
}