use of org.apache.iceberg.view.CommentUpdate in project nessie by projectnessie.
the class TestNessieIcebergViews method testViewColumnComments.
@Test
public void testViewColumnComments() throws NessieNotFoundException {
// update comment
CommentUpdate commentUpdate = new CommentUpdate(catalog.getViewCatalog().newViewOps(VIEW_IDENTIFIER));
String comment = "The column name is id";
commentUpdate.updateColumnDoc("id", comment);
Schema schema = commentUpdate.apply();
assertThat(schema.findField("id").doc()).isEqualTo(comment);
comment = comment + " and type is integer";
commentUpdate.updateColumnDoc("id", comment);
schema = commentUpdate.apply();
assertThat(schema.findField("id").doc()).isEqualTo(comment);
commentUpdate.commit();
View icebergView = catalog.load(VIEW_IDENTIFIER.toString());
assertThat(icebergView).isNotNull();
assertThat(icebergView.currentVersion().versionId()).isEqualTo(2);
assertThat(icebergView.currentVersion().parentId()).isEqualTo(1);
assertThat(icebergView.properties()).isEmpty();
assertThat(Paths.get(metadataLocationViews(VIEW_IDENTIFIER.name()))).exists();
assertThat(metadataFilesForViews(VIEW_IDENTIFIER.name())).isNotNull().hasSize(2);
verifyCommitMetadata();
assertThat(api.getCommitLog().refName(BRANCH).get().getLogEntries()).hasSize(3);
verifyViewInNessie(VIEW_IDENTIFIER, icebergView);
}
Aggregations