nastra commented on code in PR #5984:
URL: https://github.com/apache/iceberg/pull/5984#discussion_r1269463506
##########
core/src/test/java/org/apache/iceberg/TestBaseIncrementalAppendScan.java:
##########
@@ -101,6 +226,39 @@ public void testToSnapshot() {
Assert.assertEquals(2, Iterables.size(scan.planFiles()));
}
+ @Test
+ public void testToSnapshotWithRef() {
+ table.newFastAppend().appendFile(FILE_A).commit();
+ long snapshotAId = table.currentSnapshot().snapshotId();
+ table.newFastAppend().appendFile(FILE_B).commit();
+ long snapshotBId = table.currentSnapshot().snapshotId();
+
+ String branchName = "b1";
+ table.manageSnapshots().createBranch(branchName, snapshotBId).commit();
+
+ String tagSnapshotMainBName = "t1";
+ table.manageSnapshots().createTag(tagSnapshotMainBName,
snapshotBId).commit();
+
+ String tagSnapshotBranchBName = "t2";
+ table.newFastAppend().appendFile(FILE_C).toBranch(branchName).commit();
+ long snapshotBranchBId = table.snapshot(branchName).snapshotId();
+ table.manageSnapshots().createTag(tagSnapshotBranchBName,
snapshotBranchBId).commit();
+
+ IncrementalAppendScan scan = newScan().toSnapshot(tagSnapshotMainBName);
+ Assertions.assertThat(scan.planFiles()).hasSize(2);
+
+ IncrementalAppendScan scan2 = newScan().toSnapshot(tagSnapshotBranchBName);
+ Assertions.assertThat(scan2.planFiles()).hasSize(3);
+
+ Assertions.assertThatThrownBy(() -> newScan().toSnapshot(branchName))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage(String.format("Ref %s is not a tag", branchName));
+
+ Assertions.assertThatThrownBy(() -> newScan().toSnapshot("notExistTag"))
Review Comment:
same as above w.r.t splitting out success/failure testing and separating
tests against branches/tags
--
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]