kbendick commented on code in PR #4448:
URL: https://github.com/apache/iceberg/pull/4448#discussion_r863503892
##########
core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java:
##########
@@ -516,6 +517,29 @@ public void testLoadMissingTable() {
() -> catalog.loadTable(ident));
}
+ @Test
+ public void testRenameTable() {
+ C catalog = catalog();
+
+ if (requiresNamespaceCreate()) {
+ catalog.createNamespace(NS);
+ }
+
+ Assert.assertFalse("Source table should not exist before create",
catalog.tableExists(TABLE));
+
+ catalog.buildTable(TABLE, SCHEMA).create();
+ Assert.assertTrue("Table should exist after create",
catalog.tableExists(TABLE));
+
+ Assert.assertFalse("Destination table should not exist before rename",
catalog.tableExists(RENAMED_TABLE));
+
+ catalog.renameTable(TABLE, RENAMED_TABLE);
+ Assert.assertTrue("Table should exist with new name",
catalog.tableExists(RENAMED_TABLE));
+ Assert.assertFalse("Original table should no longer exist",
catalog.tableExists(TABLE));
+
+ catalog.dropTable(RENAMED_TABLE);
+ assertEmpty("Should not contain table after drop", catalog, NS);
+ }
Review Comment:
I added test for missing source and existing destination.
However, the JdbcCatalog does not throw the correct error for existing
destination table, which can be verified by looking at the current JdbcCatalog
tests:
https://github.com/apache/iceberg/blob/62f3ca334c4bf377b1aaf9b7386bec1bfaddb5cd/core/src/test/java/org/apache/iceberg/jdbc/TestJdbcCatalog.java#L385-L390
I have put togeher a hacky fix to it in this PR, but I think we should just
throw an `@Ignore` on this particular test and then fix the jdbc catalog in a
separate PR. All of the inforrmation from the error was very SQLIte specific
and I'm not sure of a general way to handle this. Open to suggestions.
--
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]