jackye1995 commented on a change in pull request #2465:
URL: https://github.com/apache/iceberg/pull/2465#discussion_r612602734
##########
File path: core/src/main/java/org/apache/iceberg/SchemaUpdate.java
##########
@@ -408,11 +450,15 @@ private TableMetadata applyChangesToMapping(TableMetadata
metadata) {
private static Schema applyChanges(Schema schema, List<Integer> deletes,
Map<Integer, Types.NestedField> updates,
Multimap<Integer, Types.NestedField> adds,
- Multimap<Integer, Move> moves) {
+ Multimap<Integer, Move> moves,
+ Set<String> rowIdentifierNames) {
Types.StructType struct = TypeUtil
.visit(schema, new ApplyChanges(deletes, updates, adds, moves))
.asNestedType().asStructType();
- return new Schema(struct.fields());
+ Set<Integer> refreshedRowIdentifiers = rowIdentifierNames.stream()
+ .map(name -> struct.field(name).fieldId())
Review comment:
Yes, that is why I decide to throw exception when `deleteColumn` is
called and the column is a row identifier. There are 2 possible situations:
1. the user actually wants to delete the column, then he/she should call:
```
update.deleteRowIdentifier(columnName).deleteColumn(columnName);
```
2. the user does not know the column is used as a row identifier, and in
that case just calling `deleteColumn` would result in exception.
--
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]