nastra commented on code in PR #11813:
URL: https://github.com/apache/iceberg/pull/11813#discussion_r1891275999
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCatalog.java:
##########
@@ -125,6 +125,34 @@ public void testHiveViewAndIcebergViewWithSameName()
throws TException, IOExcept
.hasMessageStartingWith("Not an iceberg view:
hive.hivedb.test_hive_view");
}
+ @Test
+ public void testHiveViewExists() {
+ String dbName = "hivedb";
+ Namespace ns = Namespace.of(dbName);
+ String viewName = "test_hive_view_exists";
+ TableIdentifier identifier = TableIdentifier.of(ns, viewName);
+ TableIdentifier invalidIdentifier = TableIdentifier.of(dbName, "invalid",
viewName);
+ if (requiresNamespaceCreate()) {
+ catalog.createNamespace(identifier.namespace());
+ }
+
+ assertThat(catalog.viewExists(invalidIdentifier))
+ .as("Should return false on invalid view identifier")
+ .isFalse();
+ assertThat(catalog.viewExists(identifier)).as("View should not exist
before create").isFalse();
Review Comment:
I feel like this duplicates the tests that are being done in
https://github.com/apache/iceberg/blob/main/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java#L77
(I don't think it's too bad duplicating it here, but we should rather enrich
the testing here).
I believe what would be good to test here is if you check view existence
when the identifier
* is an invalid identifier (which you already do)
* is actually an iceberg table
* is a non-iceberg view
* is an iceberg view (which you already have here)
--
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]