code: private FieldSchema singleFieldToFieldSchema(FieldDescriptor fieldDescriptor) throws FrontendException {
      assert fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE : "singleFieldToFieldSchema called with field of type " + fieldDescriptor.getType();
  
      if (fieldDescriptor.isRepeated()) {
        Schema itemSchema = new Schema();
        itemSchema.add(new FieldSchema(fieldDescriptor.getName(), null, getPigDataType(fieldDescriptor)));
        Schema itemTupleSchema = new Schema();
        itemTupleSchema.add(new FieldSchema(fieldDescriptor.getName() + "_tuple", itemSchema, DataType.TUPLE));
  
        return new FieldSchema(fieldDescriptor.getName() + "_bag", itemTupleSchema, DataType.BAG);
      } else {
        return new FieldSchema(fieldDescriptor.getName(), null, getPigDataType(fieldDescriptor));
      }
    }
docs: Turn a single field into a Schema object.  For repeated single fields, it generates a schema for a bag of single-item tuples.
  For non-repeated fields, it just generates a standard field schema.
  @param fieldDescriptor the descriptor object for the given field.
  @return the Schema for the nested message.
  @throws FrontendException if Pig decides to.