rdblue commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846825266
##########
core/src/main/java/org/apache/iceberg/MetadataUpdate.java:
##########
@@ -227,31 +228,64 @@ public String name() {
@Override
public void applyTo(TableMetadata.Builder metadataBuilder) {
- // TODO: this should be generalized when tagging is supported
- metadataBuilder.removeBranch(name);
+ metadataBuilder.removeRef(name);
}
}
class SetSnapshotRef implements MetadataUpdate {
private final String name;
- private final long snapshotId;
-
- public SetSnapshotRef(String name, long snapshotId) {
+ private final Long snapshotId;
+ private final SnapshotRefType type;
+ private Integer minSnapshotsToKeep;
+ private Long maxSnapshotAgeMs;
+ private Long maxRefAgeMs;
+
+ public SetSnapshotRef(String name, Long snapshotId, SnapshotRefType type,
Integer minSnapshotsToKeep,
+ Long maxSnapshotAgeMs, Long maxRefAgeMs) {
this.name = name;
this.snapshotId = snapshotId;
+ this.type = type;
+ this.minSnapshotsToKeep = minSnapshotsToKeep;
+ this.maxSnapshotAgeMs = maxSnapshotAgeMs;
+ this.maxRefAgeMs = maxRefAgeMs;
}
public String name() {
return name;
}
+ public String type() {
+ return type.name().toLowerCase(Locale.ROOT);
+ }
+
public long snapshotId() {
return snapshotId;
}
+ public Integer minSnapshotsToKeep() {
+ return minSnapshotsToKeep;
+ }
+
+ public Long maxSnapshotAgeMs() {
+ return maxSnapshotAgeMs;
+ }
+
+ public Long maxRefAgeMs() {
+ return maxRefAgeMs;
+ }
+
@Override
public void applyTo(TableMetadata.Builder metadataBuilder) {
- metadataBuilder.setBranchSnapshot(snapshotId, name);
+ if (type == SnapshotRefType.BRANCH) {
+ metadataBuilder.setBranchSnapshot(snapshotId, name);
Review Comment:
I don't see how this is possible.
--
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]