rdblue commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r841293240


##########
core/src/main/java/org/apache/iceberg/MetadataUpdate.java:
##########
@@ -223,31 +225,106 @@ public String name() {
 
     @Override
     public void applyTo(TableMetadata.Builder metadataBuilder) {
-      // TODO: this should be generalized when tagging is supported
-      metadataBuilder.removeBranch(name);
+      SnapshotRef ref = metadataBuilder.ref(name);
+      ValidationException.check(ref != null, "Ref %s not found", name);
+      if (ref.isBranch()) {
+        metadataBuilder.removeBranch(name);
+      } else {
+        metadataBuilder.removeTag(name);
+      }
     }
   }
 
   class SetSnapshotRef implements MetadataUpdate {
-    private final String name;
-    private final long snapshotId;
+    private final String ref;
+    private final Long snapshotId;
+    private final SnapshotRefType type;
+    private Integer minSnapshotsToKeep;
+    private Long maxSnapshotAgeMs;
+    private Long maxRefAgeMs;
+
+    public SetSnapshotRef(String ref, Long snapshotId, SnapshotRefType type, 
Integer minSnapshotsToKeep,
+                          Long maxSnapshotAgeMs, Long maxRefAgeMs) {
+      this.ref = ref;
+      this.snapshotId = snapshotId;
+      this.type = type;
+      this.minSnapshotsToKeep = minSnapshotsToKeep;
+      this.maxSnapshotAgeMs = maxSnapshotAgeMs;
+      this.maxRefAgeMs = maxRefAgeMs;
+    }
 
-    public SetSnapshotRef(String name, long snapshotId) {
-      this.name = name;
+    public SetSnapshotRef(String ref, Long snapshotId, SnapshotRefType type) {

Review Comment:
   I don't think this needs 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: dev-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to