code: private StringBuffer toPigScriptInternal(Descriptor msgDescriptor, int numTabs) {
      StringBuffer sb = new StringBuffer();
      try {
        // Walk through all the possible fields in the message.
        for (FieldDescriptor fieldDescriptor : msgDescriptor.getFields()) {
          // We have to add a comma after every line EXCEPT for the last, or Pig gets mad.
          boolean isLast = (fieldDescriptor == msgDescriptor.getFields().get(msgDescriptor.getFields().size() - 1));
          if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) {
            sb.append(messageToPigScript(fieldDescriptor, numTabs + 1, isLast));
          } else {
            sb.append(singleFieldToPigScript(fieldDescriptor, numTabs + 1, isLast));
          }
        }
      } catch (FrontendException e) {
        LOG.warn("Could not convert descriptor " + msgDescriptor + " to pig script", e);
      }
  
      return sb;
    }
docs: Turn a generic message descriptor into a loading schema for a pig script.  Individual fields that are enums
  are converted into their string equivalents.
  @param msgDescriptor the descriptor for the given message type.
  @param numTabs the tab depth at the current point in the recursion, for pretty printing.
  @return a pig schema representing the message.