code: private StringBuffer singleFieldToPigScript(FieldDescriptor fieldDescriptor, int numTabs, boolean isLast) throws FrontendException {
      assert fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE : "singleFieldToPigScript called with field of type " + fieldDescriptor.getType();
  
      if (fieldDescriptor.isRepeated()) {
        return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append("_bag: bag {").append("\n")
            .append(tabs(numTabs + 1)).append(fieldDescriptor.getName()).append("_tuple: tuple (").append("\n")
            .append(tabs(numTabs + 2)).append(fieldDescriptor.getName()).append(": ").append(getPigScriptDataType(fieldDescriptor)).append("\n")
            .append(tabs(numTabs + 1)).append(")").append("\n")
            .append(tabs(numTabs)).append("}").append(isLast ? "" : ",").append("\n");
      } else {
        return new StringBuffer().append(tabs(numTabs)).append(fieldDescriptor.getName()).append(": ")
            .append(getPigScriptDataType(fieldDescriptor)).append(isLast ? "" : ",").append("\n");
      }
    }
docs: Turn a single field into a pig script load string.  For repeated single fields, it generates a string for a bag of single-item tuples.
  For non-repeated fields, it just generates a standard single-element string.
  @param fieldDescriptor the descriptor object for the given field.
  @param numTabs the tab depth at the current point in the recursion, for pretty printing.
  @return the pig script load string for the nested message.
  @throws FrontendException if Pig decides to.