cloud-fan 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_r343532578
########## 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: Let's remove it first, and assume the test code won't switch the current namespace. Things can get complicated if the test code switches the current catalog. ---------------------------------------------------------------- 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