pig/src/main/java/com/twitter/elephantbird/pig/util/ProtobufToPig.java
public Schema toSchema(Descriptor msgDescriptor) {
    Schema schema = new Schema();

    try {
      // Walk through all the possible fields in the message.
      for (FieldDescriptor fieldDescriptor : msgDescriptor.getFields()) {
        if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) {
          schema.add(messageToFieldSchema(fieldDescriptor));
        } else {
          schema.add(singleFieldToFieldSchema(fieldDescriptor));
        }
      }
    } catch (FrontendException e) {
      LOG.warn("Could not convert descriptor " + msgDescriptor + " to schema", e);
    }

    return schema;
  }
public Schema toSchema(Descriptor msgDescriptor) {
    Schema schema = new Schema();

    try {
      // Walk through all the possible fields in the message.
      for (FieldDescriptor fieldDescriptor : msgDescriptor.getFields()) {
        if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) {
          schema.add(messageToFieldSchema(fieldDescriptor));
        } else {
          schema.add(singleFieldToFieldSchema(fieldDescriptor));
        }
      }
    } catch (FrontendException e) {
      LOG.warn("Could not convert descriptor " + msgDescriptor + " to schema", e);
    }

    return schema;
  }
public Schema toSchema ( Descriptor msgDescriptor ) { Schema schema = new Schema ( ) ; try { // Walk through all the possible fields in the message. for ( FieldDescriptor fieldDescriptor : msgDescriptor . getFields ( ) ) { if ( fieldDescriptor . getType ( ) == FieldDescriptor . Type . MESSAGE ) { schema . add ( messageToFieldSchema ( fieldDescriptor ) ) ; } else { schema . add ( singleFieldToFieldSchema ( fieldDescriptor ) ) ; } } } catch ( FrontendException e ) { LOG . warn ( "Could not convert descriptor " + msgDescriptor + " to schema" , e ) ; } return schema ; }
Turn a generic message descriptor into a Schema.  Individual fields that are enums
are converted into their string equivalents.
@param msgDescriptor the descriptor for the given message type.
@return a pig schema representing the message.
Turn a generic message descriptor into a Schema . Individual fields that are enums are converted into their string equivalents .