예제 #1
0
    @Override
    protected boolean doProcess(Record inputRecord) {
      //
      // Preconditions.checkState(ReadAvroBuilder.AVRO_MEMORY_MIME_TYPE.equals(inputRecord.getFirstValue(Fields.ATTACHMENT_MIME_TYPE)));
      GenericContainer datum = (GenericContainer) inputRecord.getFirstValue(Fields.ATTACHMENT_BODY);
      Preconditions.checkNotNull(datum);
      Preconditions.checkNotNull(datum.getSchema());
      Record outputRecord = inputRecord.copy();

      extractTree(datum, datum.getSchema(), outputRecord, outputFieldPrefix);

      // pass record to next command in chain:
      return getChild().process(outputRecord);
    }
 private Schema getSchema(GenericContainer datum, Schema lastSchema) {
   Schema schema = datum.getSchema();
   if (lastSchema != null && lastSchema != schema) {
     throw new MorphlineRuntimeException(
         "Schemas must be identical: " + schema + ", lastSchema: " + lastSchema);
   }
   return schema;
 }