Skip to content

Commit ce20478

Browse files
Greg Owengatorsmile
authored andcommitted
[SPARK-22120][SQL] TestHiveSparkSession.reset() should clean out Hive warehouse directory
## What changes were proposed in this pull request? During TestHiveSparkSession.reset(), which is called after each TestHiveSingleton suite, we now delete and recreate the Hive warehouse directory. ## How was this patch tested? Ran full suite of tests locally, verified that they pass. Author: Greg Owen <[email protected]> Closes apache#19341 from GregOwen/SPARK-22120.
1 parent 038b185 commit ce20478

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark.sql.hive.test
1919

2020
import java.io.File
21+
import java.net.URI
2122
import java.util.{Set => JavaSet}
2223

2324
import scala.collection.JavaConverters._
@@ -498,6 +499,11 @@ private[hive] class TestHiveSparkSession(
498499
}
499500
}
500501

502+
// Clean out the Hive warehouse between each suite
503+
val warehouseDir = new File(new URI(sparkContext.conf.get("spark.sql.warehouse.dir")).getPath)
504+
Utils.deleteRecursively(warehouseDir)
505+
warehouseDir.mkdir()
506+
501507
sharedState.cacheManager.clearCache()
502508
loadedTables.clear()
503509
sessionState.catalog.reset()

0 commit comments

Comments
 (0)