sandeep-katta commented on a change in pull request #25427: 
[SPARK-28705][SQL][TEST] Drop tables after being used in 
AnalysisExternalCatalogSuite
URL: https://github.com/apache/spark/pull/25427#discussion_r317383787
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisExternalCatalogSuite.scala
 ##########
 @@ -28,13 +29,28 @@ import org.apache.spark.sql.catalyst.expressions.{Alias, 
AttributeReference}
 import org.apache.spark.sql.catalyst.plans.logical.{LocalRelation, Project}
 import org.apache.spark.sql.internal.SQLConf
 import org.apache.spark.sql.types._
+import org.apache.spark.util.Utils
 
 class AnalysisExternalCatalogSuite extends AnalysisTest with Matchers {
+  var tempDir: File = _
+
+  override def beforeAll(): Unit = {
+    super.beforeAll()
+    tempDir = Utils.createTempDir()
+  }
+
+  override def afterEach: Unit = {
+    try {
+      Utils.deleteRecursively(tempDir)
+    } finally {
+      super.afterEach()
+    }
+  }
   private def getAnalyzer(externCatalog: ExternalCatalog): Analyzer = {
     val conf = new SQLConf()
     val catalog = new SessionCatalog(externCatalog, FunctionRegistry.builtin, 
conf)
     catalog.createDatabase(
-      CatalogDatabase("default", "", new URI("loc"), Map.empty),
+      CatalogDatabase("default", "", new URI(tempDir.toString), Map.empty),
 
 Review comment:
   > Actually, how about just using `withTempDir`?
   
   Updated the code

----------------------------------------------------------------
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