nastra commented on code in PR #12401: URL: https://github.com/apache/iceberg/pull/12401#discussion_r1973801663
########## core/src/test/java/org/apache/iceberg/view/TestViewMetadata.java: ########## @@ -396,6 +397,28 @@ public void viewVersionHistoryIsCorrectlyRetained() { .hasMessage("Cannot set current version to unknown version: 1"); } + @Test + public void versionsAddedInCurrentBuildAreRetained() { + ViewVersion v1 = newViewVersion(1, "select 1 as count"); + ViewVersion v2 = newViewVersion(2, "select count from t1"); + ViewVersion v3 = newViewVersion(3, "select count(1) as count from t2"); + + ViewMetadata metadata = + ViewMetadata.builder() + .setLocation("location") + .addSchema(new Schema(Types.NestedField.required(1, "x", Types.LongType.get()))) + .addVersion(v1) + .setCurrentVersionId(v1.versionId()) + .setProperties(ImmutableMap.of(ViewProperties.VERSION_HISTORY_SIZE, "2")) + .build(); + assertThat(metadata.versions()).containsOnly(v1); + + ViewMetadata updated = ViewMetadata.buildFrom(metadata).addVersion(v2).addVersion(v3).build(); Review Comment: please add `// make sure all currently added versions are retained` right above this line -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org