rdblue commented on code in PR #6512:
URL: https://github.com/apache/iceberg/pull/6512#discussion_r1251275726
##########
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java:
##########
@@ -2615,6 +2616,95 @@ public void tableCreationWithoutNamespace() {
.hasMessageContaining("Namespace does not exist: non-existing");
}
+ @Test
+ public void testRegisterTable() {
+ C catalog = catalog();
+
+ if (requiresNamespaceCreate()) {
+ catalog.createNamespace(TABLE.namespace());
+ }
+
+ Map<String, String> properties =
+ ImmutableMap.of("user", "someone", "created-at",
"2023-01-15T00:00:01");
+ Table originalTable =
+ catalog
+ .buildTable(TABLE, SCHEMA)
+ .withPartitionSpec(SPEC)
+ .withSortOrder(WRITE_ORDER)
+ .withProperties(properties)
+ .create();
+
+ originalTable.newFastAppend().appendFile(FILE_A).commit();
+ originalTable.newFastAppend().appendFile(FILE_B).commit();
+ originalTable.newDelete().deleteFile(FILE_A).commit();
+ originalTable.newFastAppend().appendFile(FILE_C).commit();
+
+ TableOperations ops = ((HasTableOperations) originalTable).operations();
+ String metadataLocation = ops.current().metadataFileLocation();
+
+ catalog.dropTable(TABLE, false);
+
+ Table registeredTable = catalog.registerTable(TABLE, metadataLocation);
+ Assertions.assertThat(registeredTable).isNotNull();
+ Assertions.assertThat(catalog.tableExists(TABLE)).as("Table must
exist").isTrue();
+
+ TableOperations registeredTableOps = ((HasTableOperations)
originalTable).operations();
+ Assertions.assertThat(registeredTableOps.current().metadataFileLocation())
+ .isEqualTo(metadataLocation);
+
+ Assertions.assertThat(registeredTable.properties())
Review Comment:
This needs an assertion for the table UUID.
--
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]