コード例 #1
0
ファイル: TDataSink.java プロジェクト: dayutianfei/impala-Q
    public void read(org.apache.thrift.protocol.TProtocol iprot, TDataSink 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = TDataSinkType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STREAM_SINK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.stream_sink = new TDataStreamSink();
              struct.stream_sink.read(iprot);
              struct.setStream_sinkIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLE_SINK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.table_sink = new TTableSink();
              struct.table_sink.read(iprot);
              struct.setTable_sinkIsSet(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();
    }
コード例 #2
0
ファイル: TDataSink.java プロジェクト: dayutianfei/impala-Q
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TDataSink struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.type = TDataSinkType.findByValue(iprot.readI32());
   struct.setTypeIsSet(true);
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.stream_sink = new TDataStreamSink();
     struct.stream_sink.read(iprot);
     struct.setStream_sinkIsSet(true);
   }
   if (incoming.get(1)) {
     struct.table_sink = new TTableSink();
     struct.table_sink.read(iprot);
     struct.setTable_sinkIsSet(true);
   }
 }