cloud-fan commented on a change in pull request #35246:
URL: https://github.com/apache/spark/pull/35246#discussion_r792639178



##########
File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsNamespaces.java
##########
@@ -136,15 +137,20 @@ void alterNamespace(
       NamespaceChange... changes) throws NoSuchNamespaceException;
 
   /**
-   * Drop a namespace from the catalog, recursively dropping all objects 
within the namespace.
+   * Drop a namespace from the catalog with cascade mode, recursively dropping 
all objects
+   * within the namespace if cascade is true.
    * <p>
    * If the catalog implementation does not support this operation, it may 
throw
    * {@link UnsupportedOperationException}.
    *
    * @param namespace a multi-part namespace
+   * @param cascade When true, deletes all objects under the namespace
    * @return true if the namespace was dropped
    * @throws NoSuchNamespaceException If the namespace does not exist 
(optional)
+   * @throws NonEmptyNamespaceException If the namespace is non-empty and 
cascade is false
    * @throws UnsupportedOperationException If drop is not a supported operation
    */
-  boolean dropNamespace(String[] namespace) throws NoSuchNamespaceException;
+  boolean dropNamespace(
+      String[] namespace,
+      boolean cascade) throws NoSuchNamespaceException, 
NonEmptyNamespaceException;

Review comment:
       > Can we implement default method of dropNamespace(String[] namespace)
   
   This doesn't help,  because the new `dropNamespace(String[] namespace, 
boolean cascade)` is not implemented and will break all the existing 
implementations.
   
   A common way to keep backward compatibility is to add default implementation 
for the new API. e.g.
   ```
   boolean dropNamespace(String[] namespace, boolean cascade) {
     if (cascade) dropNamespace(namespace) else throw ...
   }
   ```
   However, `DROP DATABASE` is much more commonly used than `DROP DATABASE ... 
CASCADE`. So this doesn't help either.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to