pvary commented on code in PR #11662: URL: https://github.com/apache/iceberg/pull/11662#discussion_r1876033356
########## flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/SortKeySerializer.java: ########## @@ -52,8 +52,32 @@ class SortKeySerializer extends TypeSerializer<SortKey> { private final int size; private final Types.NestedField[] transformedFields; + private int version = SortKeySerializerSnapshot.CURRENT_VERSION; + private transient SortKey sortKey; + SortKeySerializer(Schema schema, SortOrder sortOrder, int version) { + this.version = version; + this.schema = schema; + this.sortOrder = sortOrder; + this.size = sortOrder.fields().size(); + + this.transformedFields = new Types.NestedField[size]; + for (int i = 0; i < size; ++i) { + SortField sortField = sortOrder.fields().get(i); + Types.NestedField sourceField = schema.findField(sortField.sourceId()); + Type resultType = sortField.transform().getResultType(sourceField.type()); + Types.NestedField transformedField = + Types.NestedField.of( + sourceField.fieldId(), + sourceField.isOptional(), + sourceField.name(), + resultType, + sourceField.doc()); + transformedFields[i] = transformedField; + } Review Comment: This code part seems to be a duplicate for me? What is the reason for not using the same underlying method for the 2 constructors? -- 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...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org