public static MessageType getSchemaByName(MessageType schema, List<String> colNames, List<TypeInfo> colTypes) {
    List<Type> projectedFields = getProjectedGroupFields(schema, colNames, colTypes);
    Type[] typesArray = projectedFields.toArray(new Type[0]);

    return Types.buildMessage()
        .addFields(typesArray)
        .named(schema.getName());
  }
Searches column names by name on a given Parquet message schema, and returns its projected
Parquet schema types.

@param schema Message type schema where to search for column names.
@param colNames List of column names.
@param colTypes List of column types.
@return A MessageType object of projected columns.
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/read/DataWritableReadSupport.java