nastra commented on code in PR #12089:
URL: https://github.com/apache/iceberg/pull/12089#discussion_r1949405779


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1183,6 +1183,21 @@ Builder removeSpecs(Iterable<Integer> specIds) {
               .filter(s -> !specIdsToRemove.contains(s.specId()))
               .collect(Collectors.toList());
       changes.add(new MetadataUpdate.RemovePartitionSpecs(specIdsToRemove));
+
+      return this;
+    }
+
+    Builder removeSchemas(Iterable<Integer> schemaIds) {
+      Set<Integer> schemaIdsToRemove = Sets.newHashSet(schemaIds);
+      Preconditions.checkArgument(
+          !schemaIdsToRemove.contains(currentSchemaId), "Cannot remove the 
current schema");
+
+      this.schemas =
+          schemas.stream()
+              .filter(s -> !schemaIdsToRemove.contains(s.schemaId()))
+              .collect(Collectors.toList());
+      changes.add(new MetadataUpdate.RemoveSchemas(schemaIdsToRemove));

Review Comment:
   I think we should only create a change when `schemaIdsToRemove` was 
non-empty. This would most likely also apply for removePartitionSpecs 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to