jbonofre commented on code in PR #9487: URL: https://github.com/apache/iceberg/pull/9487#discussion_r1476197844
########## 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