dongjoon-hyun commented on a change in pull request #23905: [SPARK-24669][SQL]
Refresh table before drop database cascade
URL: https://github.com/apache/spark/pull/23905#discussion_r262712831
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
##########
@@ -2715,4 +2715,37 @@ abstract class DDLSuite extends QueryTest with
SQLTestUtils {
}
assert(ex.getMessage.contains("Spark config"))
}
+
+ test("Refresh table before drop database cascade") {
+ withTempDir { tempDir =>
+ val file1 = new File(tempDir + "/first.csv")
+ val writer1 = new PrintWriter(file1)
+ writer1.write("first")
+ writer1.close()
+
+ val file2 = new File(tempDir + "/second.csv")
+ val writer2 = new PrintWriter(file2)
+ writer2.write("second")
+ writer2.close()
+
+ withDatabase("foo") {
+ sql("CREATE DATABASE foo")
+ sql(
+ s"""CREATE TABLE foo.first (id string)
+ |USING csv options (path='${file1.toURI}')
+ """.stripMargin)
+ sql("SELECT * FROM foo.first")
+ checkAnswer(spark.table("foo.first"), Row("first"))
+ // Dropping the database and again creating same table with different
path
+ sql("DROP DATABASE foo cascade")
Review comment:
nit. `cascade` -> `CASCADE`.
----------------------------------------------------------------
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]