JingsongLi commented on code in PR #4214: URL: https://github.com/apache/paimon/pull/4214#discussion_r1772474879
########## paimon-common/src/main/java/org/apache/paimon/types/RowType.java: ########## @@ -238,6 +275,53 @@ public RowType project(List<String> names) { .collect(Collectors.toList())); } + public RowType project(String... names) { + return project(Arrays.asList(names)); + } + + // These methods are just for compatibility with old code to get the projection, once + // toProjection and buildWithNewProjection are not used anymore, remove them. + public RowType copyAndSetOriginalRowType(RowType originalRowType) { + if (this.originalRowType != null && !originalRowType.equals(this.originalRowType)) { + throw new RuntimeException(); + } + return ((RowType) this.copy()).setOriginalRowType(originalRowType); + } + + public int[] toProjection() { + if (fields.isEmpty()) { + return new int[0]; + } + if (originalRowType == null) { + throw new RuntimeException(); + } + return fields.stream() + .mapToInt(field -> originalRowType.getFieldIndexByFieldId(field.id())) + .toArray(); + } + + // create new RowType based on the new projection and originalRowType + public RowType buildWithNewProjection(int[] projection) { Review Comment: remove this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@paimon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org