jbonofre commented on code in PR #9487:
URL: https://github.com/apache/iceberg/pull/9487#discussion_r1475826840


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java:
##########
@@ -182,18 +169,13 @@ private void createTable(String newMetadataLocation) 
throws SQLException, Interr
           tableIdentifier, catalogName, namespace);
     }
 
+    if (JdbcUtil.viewExists(catalogName, connections, tableIdentifier)) {

Review Comment:
   Same comment as for table/view exists check. I will test that again, but I'm 
pretty sure the tests won't be happy 😄 



##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:
##########
@@ -503,6 +550,84 @@ public boolean namespaceExists(Namespace namespace) {
     return JdbcUtil.namespaceExists(catalogName, connections, namespace);
   }
 
+  @Override
+  public boolean dropView(TableIdentifier identifier) {
+    int deletedRecords =
+        execute(
+            JdbcUtil.DROP_SQL,
+            catalogName,
+            JdbcUtil.namespaceToString(identifier.namespace()),
+            identifier.name(),
+            "VIEW");
+
+    if (deletedRecords == 0) {
+      LOG.info("Skipping drop, view does not exist: {}", identifier);
+      return false;
+    }
+
+    LOG.info("Dropped view: {}", identifier);
+    return true;
+  }
+
+  @Override
+  public List<TableIdentifier> listViews(Namespace namespace) {
+    if (!namespaceExists(namespace)) {
+      throw new NoSuchNamespaceException("Namespace does not exist: %s", 
namespace);
+    }
+
+    return fetch(
+        row ->
+            JdbcUtil.stringToTableIdentifier(
+                row.getString(JdbcUtil.TABLE_NAMESPACE), 
row.getString(JdbcUtil.TABLE_NAME)),
+        JdbcUtil.LIST_SQL,
+        catalogName,
+        JdbcUtil.namespaceToString(namespace),
+        "VIEW");
+  }
+
+  @Override
+  public void renameView(TableIdentifier from, TableIdentifier to) {
+    if (!viewExists(from)) {
+      throw new NoSuchViewException("View does not exist");
+    }
+
+    if (!namespaceExists(to.namespace())) {
+      throw new NoSuchNamespaceException("Namespace does not exist: %s", 
to.namespace());
+    }
+
+    if (tableExists(to)) {

Review Comment:
   I will double check but I'm pretty sure the TestCatalog failed. I will 
check, thanks. 



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