Skip to content

Commit c64092c

Browse files
committed
added a test case for ALTER VIEW AS SELECT
1 parent c698a4a commit c64092c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLViewSuite.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SQLViewSuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
5454
}
5555
}
5656

57-
test("error handling: existing a table with the duplicate name when creating a view") {
57+
test("error handling: existing a table with the duplicate name when creating/altering a view") {
5858
withTable("tab1") {
5959
sql("CREATE TABLE tab1 (id int)")
6060
var e = intercept[AnalysisException] {
@@ -65,6 +65,10 @@ class SQLViewSuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
6565
sql("CREATE VIEW tab1 AS SELECT * FROM jt")
6666
}.getMessage
6767
assert(e.contains("The following is an existing table, not a view: `default`.`tab1`"))
68+
e = intercept[AnalysisException] {
69+
sql("ALTER VIEW tab1 AS SELECT * FROM jt")
70+
}.getMessage
71+
assert(e.contains("The following is an existing table, not a view: `default`.`tab1`"))
6872
}
6973
}
7074

0 commit comments

Comments
 (0)