pig/src/main/java/com/twitter/elephantbird/pig/util/ResourceSchemaUtil.java
public static ResourceFieldSchema createResourceFieldSchema(RequiredField field)
      throws IOException {
    ResourceFieldSchema schema =
        new ResourceFieldSchema().setName(field.getAlias()).setType(field.getType());
    List<RequiredField> subFields = field.getSubFields();
    if (subFields != null && !subFields.isEmpty()) {
      ResourceFieldSchema[] subSchemaFields = new ResourceFieldSchema[subFields.size()];
      int i = 0;
      for (RequiredField subField : subFields) {
        subSchemaFields[i++] = createResourceFieldSchema(subField);
      }
      ResourceSchema subSchema = new ResourceSchema();
      subSchema.setFields(subSchemaFields);
      schema.setSchema(subSchema);
    }
    return schema;
  }
public static ResourceFieldSchema createResourceFieldSchema(RequiredField field)
      throws IOException {
    ResourceFieldSchema schema =
        new ResourceFieldSchema().setName(field.getAlias()).setType(field.getType());
    List<RequiredField> subFields = field.getSubFields();
    if (subFields != null && !subFields.isEmpty()) {
      ResourceFieldSchema[] subSchemaFields = new ResourceFieldSchema[subFields.size()];
      int i = 0;
      for (RequiredField subField : subFields) {
        subSchemaFields[i++] = createResourceFieldSchema(subField);
      }
      ResourceSchema subSchema = new ResourceSchema();
      subSchema.setFields(subSchemaFields);
      schema.setSchema(subSchema);
    }
    return schema;
  }
Creates a new ResourceFieldSchema which reflects data from an input RequiredField.

@param field
@return new ResourceFieldSchema which reflects {@code field}.
@throws IOException