rdblue commented on code in PR #4926:
URL: https://github.com/apache/iceberg/pull/4926#discussion_r889296626
##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -298,11 +306,11 @@ public void commit() {
TableMetadata.Builder update = TableMetadata.buildFrom(base);
if (base.snapshot(newSnapshot.snapshotId()) != null) {
// this is a rollback operation
- update.setBranchSnapshot(newSnapshot.snapshotId(),
SnapshotRef.MAIN_BRANCH);
+ update.setBranchSnapshot(newSnapshot.snapshotId(), branch);
} else if (stageOnly) {
update.addSnapshot(newSnapshot);
} else {
- update.setBranchSnapshot(newSnapshot, SnapshotRef.MAIN_BRANCH);
+ update.setBranchSnapshot(newSnapshot.snapshotId(), branch);
Review Comment:
I think this correctly writes to the branch, but I think we also need to
check validations. That probably means copying _all_ the tests for every table
operation and running them to make sure they work when writing to a branch.
That's a huge amount of work, so I'd break it up by implementing `toBranch`
in this PR by throwing an `UnsupportedOperationException`. Then call another
method on `SnapshotProducer` to actually set the branch from each child class
individually. That way we can validate and test each child operation
individually without creating a massive PR.
--
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]