public static String formatType(TypeInfo typeInfo) {
    switch (typeInfo.getCategory()) {
      case PRIMITIVE:
        return typeInfo.getTypeName();
      case STRUCT:
        StringBuilder structFormattedType = new StringBuilder();

        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        for (int i = 0; i < structTypeInfo.getAllStructFieldNames().size(); i++) {
          if (structFormattedType.length() != 0) {
            structFormattedType.append(", ");
          }

          String structElementName = structTypeInfo.getAllStructFieldNames().get(i);
          String structElementType = formatType(structTypeInfo.getAllStructFieldTypeInfos().get(i));

          structFormattedType.append(unparseIdentifier(structElementName) + ":" + structElementType);
        }
        return "struct<" + structFormattedType.toString() + ">";
      case LIST:
        ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
        String elementType = formatType(listTypeInfo.getListElementTypeInfo());
        return "array<" + elementType + ">";
      case MAP:
        MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
        String keyTypeInfo = mapTypeInfo.getMapKeyTypeInfo().getTypeName();
        String valueTypeInfo = formatType(mapTypeInfo.getMapValueTypeInfo());
        return "map<" + keyTypeInfo + "," + valueTypeInfo + ">";
      case UNION:
        StringBuilder unionFormattedType = new StringBuilder();

        UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
        for (TypeInfo unionElementTypeInfo : unionTypeInfo.getAllUnionObjectTypeInfos()) {
          if (unionFormattedType.length() != 0) {
            unionFormattedType.append(", ");
          }

          String unionElementType = formatType(unionElementTypeInfo);
          unionFormattedType.append(unionElementType);
        }
        return UNION_TYPE_NAME + "<" + unionFormattedType.toString() + ">";
      default:
        throw new RuntimeException("Unknown type: " + typeInfo.getCategory());
    }
  }
Struct fields are identifiers, need to be unparsed.
ql/src/java/org/apache/hadoop/hive/ql/exec/DDLPlanUtils.java