pvary commented on code in PR #8907:
URL: https://github.com/apache/iceberg/pull/8907#discussion_r1384737093


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -220,6 +210,28 @@ public boolean dropTable(TableIdentifier identifier, 
boolean purge) {
     }
   }
 
+  @Override
+  public TableBuilder buildTable(TableIdentifier identifier, Schema schema) {
+    // validate first if view exists with the same name or not.
+    try {
+      String database = identifier.namespace().level(0);
+      String tableName = identifier.name();
+      Optional<Table> table = HiveCatalogUtil.loadHmsTableIfPresent(clients, 
database, tableName);
+      if (table.isPresent()
+          && 
table.get().getTableType().equalsIgnoreCase(TableType.VIRTUAL_VIEW.name())) {
+        throw new org.apache.iceberg.exceptions.AlreadyExistsException(
+            "View with same name already exists: %s.%s", database, tableName);
+      }

Review Comment:
   Is this only for View-s?
   If so, I think this is a serious miss-use ot the method 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: 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