HyukjinKwon commented on a change in pull request #26476: [SPARK-29851][SQL] V2 
catalog: Change default behavior of dropping namespace to cascade
URL: https://github.com/apache/spark/pull/26476#discussion_r354769954
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryTableCatalog.scala
 ##########
 @@ -181,9 +180,8 @@ class InMemoryTableCatalog extends 
BasicInMemoryTableCatalog with SupportsNamesp
   }
 
   override def dropNamespace(namespace: Array[String]): Boolean = {
-    if (listTables(namespace).nonEmpty) {
-      throw new IllegalStateException(s"Cannot delete non-empty namespace: 
${namespace.quoted}")
-    }
+    listNamespaces(namespace).map(dropNamespace)
+    listTables(namespace).map(dropTable)
 
 Review comment:
   Ah, yeah. Thanks. Like `iteroatr.map()` -> iterator :-).
   
   ```scala
   scala> Iterator(1,2,3).map(println)
   res0: Iterator[Unit] = <iterator>
   
   scala> Iterator(1,2,3).foreach(println)
   1
   2
   3
   ```
   
   worse:
   
   ```scala
   scala> Iterator(1,2,3).map(println).toSeq
   1
   res1: Seq[Unit] = Stream((), ?)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to