public void read(org.apache.thrift.protocol.TProtocol iprot, RebalanceOptions 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: // WAIT_SECS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.wait_secs = iprot.readI32();
              struct.setWait_secsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NUM_WORKERS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.num_workers = iprot.readI32();
              struct.setNum_workersIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NUM_EXECUTORS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map316 = iprot.readMapBegin();
                struct.num_executors = new HashMap<String, Integer>(2 * _map316.size);
                for (int _i317 = 0; _i317 < _map316.size; ++_i317) {
                  String _key318; // required
                  int _val319; // required
                  _key318 = iprot.readString();
                  _val319 = iprot.readI32();
                  struct.num_executors.put(_key318, _val319);
                }
                iprot.readMapEnd();
              }
              struct.setNum_executorsIsSet(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, RebalanceOptions struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetWait_secs()) {
        oprot.writeFieldBegin(WAIT_SECS_FIELD_DESC);
        oprot.writeI32(struct.wait_secs);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNum_workers()) {
        oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC);
        oprot.writeI32(struct.num_workers);
        oprot.writeFieldEnd();
      }
      if (struct.num_executors != null) {
        if (struct.isSetNum_executors()) {
          oprot.writeFieldBegin(NUM_EXECUTORS_FIELD_DESC);
          {
            oprot.writeMapBegin(
                new org.apache.thrift.protocol.TMap(
                    org.apache.thrift.protocol.TType.STRING,
                    org.apache.thrift.protocol.TType.I32,
                    struct.num_executors.size()));
            for (Map.Entry<String, Integer> _iter320 : struct.num_executors.entrySet()) {
              oprot.writeString(_iter320.getKey());
              oprot.writeI32(_iter320.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }