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 NAME:
        if (field.type == TType.STRING) {
          this.name = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case ID:
        if (field.type == TType.I64) {
          this.id = iprot.readI64();
          this.__isset_id = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case OUTPUT_VAR:
        if (field.type == TType.STRING) {
          this.output_var = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case DESCRIPTION:
        if (field.type == TType.LIST) {
          {
            TList _list6 = iprot.readListBegin();
            this.description = <Pair>[];
            for (int _i7 = 0; _i7 < _list6.length; ++_i7) {
              Pair _elem8;
              _elem8 = new Pair();
              _elem8.read(iprot);
              this.description?.add(_elem8);
            }
            iprot.readListEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case PROFILES:
        if (field.type == TType.LIST) {
          {
            TList _list9 = iprot.readListBegin();
            this.profiles = <ProfilingStats>[];
            for (int _i10 = 0; _i10 < _list9.length; ++_i10) {
              ProfilingStats _elem11;
              _elem11 = new ProfilingStats();
              _elem11.read(iprot);
              this.profiles?.add(_elem11);
            }
            iprot.readListEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case BRANCH_INFO:
        if (field.type == TType.STRUCT) {
          this.branch_info = new PlanNodeBranchInfo();
          this.branch_info?.read(iprot);
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case DEPENDENCIES:
        if (field.type == TType.LIST) {
          {
            TList _list12 = iprot.readListBegin();
            this.dependencies = <int>[];
            for (int _i13 = 0; _i13 < _list12.length; ++_i13) {
              int _elem14;
              _elem14 = iprot.readI64();
              this.dependencies?.add(_elem14);
            }
            iprot.readListEnd();
          }
        } 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_id) {
    throw new TProtocolError(
        TProtocolErrorType.UNKNOWN,
        "Required field 'id' was not found in serialized data! Struct: " +
            toString());
  }

  validate();
}