rdblue commented on a change in pull request #3701:
URL: https://github.com/apache/iceberg/pull/3701#discussion_r771753764



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -370,14 +371,56 @@ public void alterNamespace(String[] namespace, 
NamespaceChange... changes) throw
 
   @Override
   public boolean dropNamespace(String[] namespace) throws 
NoSuchNamespaceException {
+    // Spark assumes that catalogs CASCADE by default. So if we have a 
namespace catalog
+    /// we need to attempt to recursively delete.
     if (asNamespaceCatalog != null) {
+      Namespace asNamespace = Namespace.of(namespace);
+      boolean exists = namespaceExists(namespace);

Review comment:
       I think this is redundant. If the namespace doesn't exist then the call 
to `listNamespaces` will throw Spark's `NoSuchNamespaceException` and this can 
exit early. Otherwise, the namespace exists in some form. The only reason to 
call `namespaceExists` is if there is a custom implementation of that method 
(rather than loading metadata and catching `NoSuchNamespace`) but there isn't, 
so we may as well not make too many calls.




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

Reply via email to