nastra commented on code in PR #9980: URL: https://github.com/apache/iceberg/pull/9980#discussion_r1539385906
########## 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: actually nvm, things look like they work as expected -- 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