aboutsummaryrefslogtreecommitdiff
path: root/sql/core
diff options
context:
space:
mode:
Diffstat (limited to 'sql/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/InsertIntoSuite.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/InsertIntoSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/InsertIntoSuite.scala
index 73d87963b3..4f0b85f262 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/InsertIntoSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/InsertIntoSuite.scala
@@ -29,6 +29,7 @@ class InsertIntoSuite extends QueryTest {
test("insertInto() created parquet file") {
val testFilePath = File.createTempFile("sparkSql", "pqt")
testFilePath.delete()
+ testFilePath.deleteOnExit()
val testFile = createParquetFile[TestData](testFilePath.getCanonicalPath)
testFile.registerAsTable("createAndInsertTest")
@@ -76,11 +77,14 @@ class InsertIntoSuite extends QueryTest {
sql("SELECT * FROM createAndInsertTest"),
testData.collect().toSeq
)
+
+ testFilePath.delete()
}
test("INSERT INTO parquet table") {
val testFilePath = File.createTempFile("sparkSql", "pqt")
testFilePath.delete()
+ testFilePath.deleteOnExit()
val testFile = createParquetFile[TestData](testFilePath.getCanonicalPath)
testFile.registerAsTable("createAndInsertSQLTest")
@@ -126,23 +130,31 @@ class InsertIntoSuite extends QueryTest {
sql("SELECT * FROM createAndInsertSQLTest"),
testData.collect().toSeq
)
+
+ testFilePath.delete()
}
test("Double create fails when allowExisting = false") {
val testFilePath = File.createTempFile("sparkSql", "pqt")
testFilePath.delete()
+ testFilePath.deleteOnExit()
val testFile = createParquetFile[TestData](testFilePath.getCanonicalPath)
intercept[RuntimeException] {
createParquetFile[TestData](testFilePath.getCanonicalPath, allowExisting = false)
}
+
+ testFilePath.delete()
}
test("Double create does not fail when allowExisting = true") {
val testFilePath = File.createTempFile("sparkSql", "pqt")
testFilePath.delete()
+ testFilePath.deleteOnExit()
val testFile = createParquetFile[TestData](testFilePath.getCanonicalPath)
createParquetFile[TestData](testFilePath.getCanonicalPath, allowExisting = true)
+
+ testFilePath.delete()
}
}