@Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TExchangeNode struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   {
     oprot.writeI32(struct.input_row_tuples.size());
     for (int _iter148 : struct.input_row_tuples) {
       oprot.writeI32(_iter148);
     }
   }
   BitSet optionals = new BitSet();
   if (struct.isSetSort_info()) {
     optionals.set(0);
   }
   if (struct.isSetOffset()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetSort_info()) {
     struct.sort_info.write(oprot);
   }
   if (struct.isSetOffset()) {
     oprot.writeI64(struct.offset);
   }
 }
    public void write(org.apache.thrift.protocol.TProtocol oprot, TExchangeNode struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.input_row_tuples != null) {
        oprot.writeFieldBegin(INPUT_ROW_TUPLES_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.I32, struct.input_row_tuples.size()));
          for (int _iter147 : struct.input_row_tuples) {
            oprot.writeI32(_iter147);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.sort_info != null) {
        if (struct.isSetSort_info()) {
          oprot.writeFieldBegin(SORT_INFO_FIELD_DESC);
          struct.sort_info.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetOffset()) {
        oprot.writeFieldBegin(OFFSET_FIELD_DESC);
        oprot.writeI64(struct.offset);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
  public boolean equals(TExchangeNode that) {
    if (that == null) return false;

    boolean this_present_input_row_tuples = true && this.isSetInput_row_tuples();
    boolean that_present_input_row_tuples = true && that.isSetInput_row_tuples();
    if (this_present_input_row_tuples || that_present_input_row_tuples) {
      if (!(this_present_input_row_tuples && that_present_input_row_tuples)) return false;
      if (!this.input_row_tuples.equals(that.input_row_tuples)) return false;
    }

    boolean this_present_sort_info = true && this.isSetSort_info();
    boolean that_present_sort_info = true && that.isSetSort_info();
    if (this_present_sort_info || that_present_sort_info) {
      if (!(this_present_sort_info && that_present_sort_info)) return false;
      if (!this.sort_info.equals(that.sort_info)) return false;
    }

    boolean this_present_offset = true && this.isSetOffset();
    boolean that_present_offset = true && that.isSetOffset();
    if (this_present_offset || that_present_offset) {
      if (!(this_present_offset && that_present_offset)) return false;
      if (this.offset != that.offset) return false;
    }

    return true;
  }
 /** Performs a deep copy on <i>other</i>. */
 public TExchangeNode(TExchangeNode other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetInput_row_tuples()) {
     List<Integer> __this__input_row_tuples = new ArrayList<Integer>();
     for (Integer other_element : other.input_row_tuples) {
       __this__input_row_tuples.add(other_element);
     }
     this.input_row_tuples = __this__input_row_tuples;
   }
   if (other.isSetSort_info()) {
     this.sort_info = new TSortInfo(other.sort_info);
   }
   this.offset = other.offset;
 }
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TExchangeNode struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   {
     org.apache.thrift.protocol.TList _list149 =
         new org.apache.thrift.protocol.TList(
             org.apache.thrift.protocol.TType.I32, iprot.readI32());
     struct.input_row_tuples = new ArrayList<Integer>(_list149.size);
     for (int _i150 = 0; _i150 < _list149.size; ++_i150) {
       int _elem151; // required
       _elem151 = iprot.readI32();
       struct.input_row_tuples.add(_elem151);
     }
   }
   struct.setInput_row_tuplesIsSet(true);
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.sort_info = new TSortInfo();
     struct.sort_info.read(iprot);
     struct.setSort_infoIsSet(true);
   }
   if (incoming.get(1)) {
     struct.offset = iprot.readI64();
     struct.setOffsetIsSet(true);
   }
 }
    public void read(org.apache.thrift.protocol.TProtocol iprot, TExchangeNode 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: // INPUT_ROW_TUPLES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list144 = iprot.readListBegin();
                struct.input_row_tuples = new ArrayList<Integer>(_list144.size);
                for (int _i145 = 0; _i145 < _list144.size; ++_i145) {
                  int _elem146; // required
                  _elem146 = iprot.readI32();
                  struct.input_row_tuples.add(_elem146);
                }
                iprot.readListEnd();
              }
              struct.setInput_row_tuplesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SORT_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.sort_info = new TSortInfo();
              struct.sort_info.read(iprot);
              struct.setSort_infoIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // OFFSET
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.offset = iprot.readI64();
              struct.setOffsetIsSet(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 int compareTo(TExchangeNode other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TExchangeNode typedOther = (TExchangeNode) other;

    lastComparison =
        Boolean.valueOf(isSetInput_row_tuples()).compareTo(typedOther.isSetInput_row_tuples());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInput_row_tuples()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(
              this.input_row_tuples, typedOther.input_row_tuples);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSort_info()).compareTo(typedOther.isSetSort_info());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSort_info()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.sort_info, typedOther.sort_info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOffset()).compareTo(typedOther.isSetOffset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOffset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset, typedOther.offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }