jackye1995 commented on a change in pull request #2354:
URL: https://github.com/apache/iceberg/pull/2354#discussion_r601875062
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -877,6 +986,26 @@ private static SortOrder freshSortOrder(int orderId,
Schema schema, SortOrder so
return builder.build();
}
+ private static RowKey freshRowKey(int keyId, Schema schema, RowKey rowKey) {
+ RowKey.Builder builder = RowKey.builderFor(schema).withKeyId(keyId);
+
+ for (RowKeyField field : rowKey.fields()) {
+ // look up the name of the source field in the old schema to get the new
schema's id
+ String columnName = rowKey.schema().findColumnName(field.sourceId());
+ Preconditions.checkNotNull(columnName,
+ "Cannot find column in the row key's schema. id: %s, schema: %s",
+ field.sourceId(), rowKey.schema());
+
+ // reassign all row keys with fresh column IDs.
+ Types.NestedField column = schema.findField(columnName);
+ Preconditions.checkNotNull(column,
+ "Cannot find column in the fresh schema. name: %s, schema: %s",
columnName, schema);
+ builder.addField(column.fieldId());
Review comment:
good point, updated
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]