nastra commented on code in PR #8918:
URL: https://github.com/apache/iceberg/pull/8918#discussion_r1425513915


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -1210,34 +1182,53 @@ public void 
testDatabaseLocationWithSlashInWarehouseDir() {
     assertThat(database.getLocationUri()).isEqualTo("s3://bucket/database.db");
   }
 
+  // TODO: This test should be removed after fix of 
https://github.com/apache/iceberg/issues/9289.
   @Test
-  public void testRegisterTable() {
-    TableIdentifier identifier = TableIdentifier.of(DB_NAME, "t1");
-    catalog.createTable(identifier, getTestSchema());
-    Table registeringTable = catalog.loadTable(identifier);
-    catalog.dropTable(identifier, false);
-    TableOperations ops = ((HasTableOperations) registeringTable).operations();
-    String metadataLocation = ((HiveTableOperations) 
ops).currentMetadataLocation();
-    Table registeredTable = catalog.registerTable(identifier, 
metadataLocation);
-    assertThat(registeredTable).isNotNull();
-    TestHelpers.assertSerializedAndLoadedMetadata(registeringTable, 
registeredTable);
-    String expectedMetadataLocation =
-        ((HasTableOperations) 
registeredTable).operations().current().metadataFileLocation();
-    assertThat(metadataLocation).isEqualTo(expectedMetadataLocation);
-    assertThat(catalog.loadTable(identifier)).isNotNull();
-    assertThat(catalog.dropTable(identifier)).isTrue();
-  }
+  @Override
+  public void testRenameTableDestinationTableAlreadyExists() {
+    Namespace ns = Namespace.of("newdb");
+    TableIdentifier renamedTable = TableIdentifier.of(ns, "table_renamed");
 
-  @Test
-  public void testRegisterExistingTable() {
-    TableIdentifier identifier = TableIdentifier.of(DB_NAME, "t1");
-    catalog.createTable(identifier, getTestSchema());
-    Table registeringTable = catalog.loadTable(identifier);
-    TableOperations ops = ((HasTableOperations) registeringTable).operations();
-    String metadataLocation = ((HiveTableOperations) 
ops).currentMetadataLocation();
-    assertThatThrownBy(() -> catalog.registerTable(identifier, 
metadataLocation))
-        .isInstanceOf(AlreadyExistsException.class)
-        .hasMessage("Table already exists: hivedb.t1");
-    assertThat(catalog.dropTable(identifier, true)).isTrue();
+    if (requiresNamespaceCreate()) {
+      catalog.createNamespace(ns);
+    }
+
+    Assertions.assertThat(catalog.tableExists(TABLE))
+        .as("Source table should not exist before create")
+        .isFalse();
+
+    catalog.buildTable(TABLE, SCHEMA).create();
+    Assertions.assertThat(catalog.tableExists(TABLE))
+        .as("Source table should exist after create")
+        .isTrue();
+
+    Assertions.assertThat(catalog.tableExists(renamedTable))
+        .as("Destination table should not exist before create")
+        .isFalse();
+
+    catalog.buildTable(renamedTable, SCHEMA).create();
+    Assertions.assertThat(catalog.tableExists(renamedTable))
+        .as("Destination table should exist after create")
+        .isTrue();
+    // With fix of issues#9289,it should match with CatalogTests and expect

Review Comment:
   nit: would be good to add a newline before this line for better readability



-- 
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

Reply via email to