Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/5043#discussion_r152571674
--- Diff:
flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java
---
@@ -355,4 +355,21 @@ public void addComparatorField(int fieldId,
TypeComparator<?> comparator) {
comparatorOrders);
}
}
+
+ /**
+ * Creates a {@link RowTypeInfo} with projected fields.
+ *
+ * @param rowType The original RowTypeInfo whose fields are projected
+ * @param fieldMapping The field mapping of the projection
+ * @return A RowTypeInfo with projected fields.
+ */
+ public static RowTypeInfo projectFields(RowTypeInfo rowType, int[]
fieldMapping) {
--- End diff --
I think it is cleaner to have this as a static method than an instance
method.
A static method makes it explicit that this creates a new (immutable)
`RowTypeInfo`.
---