aboutsummaryrefslogtreecommitdiff
path: root/sql/hive/src
diff options
context:
space:
mode:
authorSean Zhong <seanzhong@databricks.com>2016-06-02 14:11:01 -0700
committerAndrew Or <andrew@databricks.com>2016-06-02 14:11:01 -0700
commitd109a1beeef5bca1e683247e0a5db4ec841bf3ba (patch)
tree0453e640b07028edb5d3b1adc49962529e0bca17 /sql/hive/src
parent9aff6f3b1915523432b1921fdd30fa015ed5d670 (diff)
downloadspark-d109a1beeef5bca1e683247e0a5db4ec841bf3ba.tar.gz
spark-d109a1beeef5bca1e683247e0a5db4ec841bf3ba.tar.bz2
spark-d109a1beeef5bca1e683247e0a5db4ec841bf3ba.zip
[SPARK-15711][SQL] Ban CREATE TEMPORARY TABLE USING AS SELECT
## What changes were proposed in this pull request? This PR bans syntax like `CREATE TEMPORARY TABLE USING AS SELECT` `CREATE TEMPORARY TABLE ... USING ... AS ...` is not properly implemented, the temporary data is not cleaned up when the session exits. Before a full fix, we probably should ban this syntax. This PR only impact syntax like `CREATE TEMPORARY TABLE ... USING ... AS ...`. Other syntax like `CREATE TEMPORARY TABLE .. USING ...` and `CREATE TABLE ... USING ...` are not impacted. ## How was this patch tested? Unit test. Author: Sean Zhong <seanzhong@databricks.com> Closes #13451 from clockfly/ban_create_temp_table_using_as.
Diffstat (limited to 'sql/hive/src')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala46
1 files changed, 0 insertions, 46 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
index 24de223cf8..499819f32b 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
@@ -1506,52 +1506,6 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
}
- test(
- "SPARK-14488 \"CREATE TEMPORARY TABLE ... USING ... AS SELECT ...\" " +
- "shouldn't create persisted table"
- ) {
- withTempPath { dir =>
- withTempTable("t1", "t2") {
- val path = dir.getCanonicalPath
- val ds = spark.range(10)
- ds.createOrReplaceTempView("t1")
-
- sql(
- s"""CREATE TEMPORARY TABLE t2
- |USING PARQUET
- |OPTIONS (PATH '$path')
- |AS SELECT * FROM t1
- """.stripMargin)
-
- checkAnswer(
- spark.sql("SHOW TABLES").select('isTemporary).filter('tableName === "t2"),
- Row(true)
- )
-
- checkAnswer(table("t2"), table("t1"))
- }
- }
- }
-
- test(
- "SPARK-14493 \"CREATE TEMPORARY TABLE ... USING ... AS SELECT ...\" " +
- "shouldn always be used together with PATH data source option"
- ) {
- withTempTable("t") {
- spark.range(10).createOrReplaceTempView("t")
-
- val message = intercept[IllegalArgumentException] {
- sql(
- s"""CREATE TEMPORARY TABLE t1
- |USING PARQUET
- |AS SELECT * FROM t
- """.stripMargin)
- }.getMessage
-
- assert(message == "'path' is not specified")
- }
- }
-
test("derived from Hive query file: drop_database_removes_partition_dirs.q") {
// This test verifies that if a partition exists outside a table's current location when the
// database is dropped the partition's location is dropped as well.