From 4e7a29efdba6972a4713a62dfccb495504a25ab9 Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun <dongjoon@apache.org> Date: Tue, 5 Sep 2017 00:20:16 -0700 Subject: [PATCH] [SPARK-21913][SQL][TEST] withDatabase` should drop database with CASCADE ## What changes were proposed in this pull request? Currently, `withDatabase` fails if the database is not empty. It would be great if we drop cleanly with CASCADE. ## How was this patch tested? This is a change on test util. Pass the existing Jenkins. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #19125 from dongjoon-hyun/SPARK-21913. --- .../src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala b/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala index e68db3b636..a14a1441a4 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala @@ -247,7 +247,7 @@ private[sql] trait SQLTestUtils protected def withDatabase(dbNames: String*)(f: => Unit): Unit = { try f finally { dbNames.foreach { name => - spark.sql(s"DROP DATABASE IF EXISTS $name") + spark.sql(s"DROP DATABASE IF EXISTS $name CASCADE") } spark.sql(s"USE $DEFAULT_DATABASE") } -- GitLab