read method

void read(
  1. TProtocol iprot
)
override

Reads the TObject from the given input protocol.

Implementation

read(TProtocol iprot) {
  TField field;
  iprot.readStructBegin();
  while (true) {
    field = iprot.readFieldBegin();
    if (field.type == TType.STOP) {
      break;
    }
    switch (field.id) {
      case PLAN_NODE_DESCS:
        if (field.type == TType.LIST) {
          {
            TList _list18 = iprot.readListBegin();
            this.plan_node_descs = <PlanNodeDescription>[];
            for (int _i19 = 0; _i19 < _list18.length; ++_i19) {
              PlanNodeDescription _elem20;
              _elem20 = new PlanNodeDescription();
              _elem20.read(iprot);
              this.plan_node_descs?.add(_elem20);
            }
            iprot.readListEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case NODE_INDEX_MAP:
        if (field.type == TType.MAP) {
          {
            TMap _map21 = iprot.readMapBegin();
            this.node_index_map = new Map<int, int>();
            for (int _i22 = 0; _i22 < _map21.length; ++_i22) {
              int _key23;
              int _val24;
              _key23 = iprot.readI64();
              _val24 = iprot.readI64();
              this.node_index_map?[_key23] = _val24;
            }
            iprot.readMapEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case FORMAT:
        if (field.type == TType.STRING) {
          this.format = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case OPTIMIZE_TIME_IN_US:
        if (field.type == TType.I32) {
          this.optimize_time_in_us = iprot.readI32();
          this.__isset_optimize_time_in_us = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      default:
        TProtocolUtil.skip(iprot, field.type);
        break;
    }
    iprot.readFieldEnd();
  }
  iprot.readStructEnd();

  // check for required fields of primitive type, which can't be checked in the validate method
  if (!__isset_optimize_time_in_us) {
    throw new TProtocolError(
        TProtocolErrorType.UNKNOWN,
        "Required field 'optimize_time_in_us' was not found in serialized data! Struct: " +
            toString());
  }

  validate();
}