ulysses-you commented on a change in pull request #26411: 
[SPARK-29772][TESTS][SQL] Add withNamespace in SQLTestUtils
URL: https://github.com/apache/spark/pull/26411#discussion_r343570795
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala
 ##########
 @@ -363,6 +363,18 @@ private[sql] trait SQLTestUtilsBase
     }
   }
 
+  /**
+   * Drops namespace `namespace` after calling `f`.
+   */
+  protected def withNamespace(namespaces: String*)(f: => Unit): Unit = {
+    Utils.tryWithSafeFinally(f) {
+      namespaces.foreach { name =>
+        spark.sql(s"DROP NAMESPACE IF EXISTS $name CASCADE")
+      }
+      spark.sql(s"USE default")
 
 Review comment:
   Shall we add some doc to remind like this ?
   ```
   If you will change current catalog, you should use this method carefully. 
This may be remove the wrong namespace.
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to