public static RowFormatInfo projectRowFormatInfo(
            RowFormatInfo rowFormatInfo,
            int[] fields) {
        String[] fieldNames = rowFormatInfo.getFieldNames();
        FormatInfo[] fieldFormatInfos = rowFormatInfo.getFieldFormatInfos();

        String[] projectedFieldNames = new String[fields.length];
        FormatInfo[] projectedFieldFormatInfos = new FormatInfo[fields.length];

        for (int i = 0; i < fields.length; ++i) {
            projectedFieldNames[i] = fieldNames[fields[i]];
            projectedFieldFormatInfos[i] = fieldFormatInfos[fields[i]];
        }

        return new RowFormatInfo(projectedFieldNames, projectedFieldFormatInfos);
    }
Projects the given schema.

@param rowFormatInfo The schema to be projected.
@return The projected schema in the properties.
inlong-sort/sort-formats/format-common/src/main/java/org/apache/inlong/sort/formats/base/TableFormatUtils.java