amogh-jahagirdar commented on a change in pull request #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r837032642
##########
File path: core/src/main/java/org/apache/iceberg/MetadataUpdate.java
##########
@@ -230,24 +230,28 @@ public void applyTo(TableMetadata.Builder
metadataBuilder) {
class SetSnapshotRef implements MetadataUpdate {
private final String name;
- private final long snapshotId;
+ private final SnapshotRef ref;
- public SetSnapshotRef(String name, long snapshotId) {
+ public SetSnapshotRef(String name, SnapshotRef ref) {
this.name = name;
- this.snapshotId = snapshotId;
+ this.ref = ref;
}
public String name() {
return name;
}
public long snapshotId() {
- return snapshotId;
+ return ref.snapshotId();
}
@Override
public void applyTo(TableMetadata.Builder metadataBuilder) {
- metadataBuilder.setBranchSnapshot(snapshotId, name);
+ if (ref.isTag()) {
+ metadataBuilder.setTag(name, ref);
+ } else {
+ metadataBuilder.setBranchSnapshot(ref.snapshotId(), name);
Review comment:
Thanks, missed that when updating the branch we weren't updating any of
the properties. After going through
https://docs.google.com/document/d/1D0R3G0slssEhggH5XnIzMwsUIP-c385Qp2sjv5E7e6E/edit#heading=h.eo4x0coo8esy
and discussing with @rdblue got some more clarity on what the goal of applyTo
is.
I have now made the SetSnapshotRef update encapsulate only the changes. Ref
name, snapshot id and type will always be maintained on the update, but
retention properties can be null. At the time of applying we keep track of the
difference between the update and the current state of the builder and update
the builder accordingly.
--
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]