nk1506 commented on code in PR #9980:
URL: https://github.com/apache/iceberg/pull/9980#discussion_r1539203705
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableTest.java:
##########
@@ -349,8 +353,43 @@ public void testListTables() throws TException,
IOException {
HIVE_METASTORE_EXTENSION.metastoreClient().dropTable(DB_NAME,
hiveTableName);
}
- private org.apache.hadoop.hive.metastore.api.Table createHiveTable(String
hiveTableName)
- throws IOException {
+ @ParameterizedTest
+ @EnumSource(
+ value = TableType.class,
+ names = {"EXTERNAL_TABLE", "VIRTUAL_VIEW", "MANAGED_TABLE"})
+ public void testHiveTableAndIcebergTableWithSameName(TableType tableType)
+ throws TException, IOException {
+
+ assertThat(catalog.listTables(TABLE_IDENTIFIER.namespace()))
+ .hasSize(1)
+ .containsExactly(TABLE_IDENTIFIER);
+
+ // create a hive table with a defined table type.
+ String hiveTableName = "test_hive_table";
+ TableIdentifier identifier = TableIdentifier.of(DB_NAME, hiveTableName);
+ HIVE_METASTORE_EXTENSION
+ .metastoreClient()
+ .createTable(createHiveTable(hiveTableName, tableType));
+
+ catalog.setListAllTables(true);
+ assertThat(catalog.listTables(TABLE_IDENTIFIER.namespace()))
+ .hasSize(2)
+ .containsExactly(TABLE_IDENTIFIER, identifier);
+ catalog.setListAllTables(false); // reset to default.
+
+ // create an iceberg table with the same name
+ assertThatThrownBy(() -> catalog.createTable(identifier, schema,
PartitionSpec.unpartitioned()))
+ .isInstanceOf(NoSuchIcebergTableException.class)
+ .hasMessageStartingWith(String.format("Not an iceberg table: hive.%s",
identifier));
Review Comment:
Sorry , I didn't understand the part as `actual commit succeeds` . in this
case the error is being thrown before doing actual commit and the commit for
corresponding operation is never happening.
--
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]