Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/12324#discussion_r59679386
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
---
@@ -131,6 +131,124 @@ class HiveDDLSuite extends QueryTest with
SQLTestUtils with TestHiveSingleton {
}
}
+ test("alter views - rename") {
+ val tabName = "tab1"
+ withTable(tabName) {
+ sqlContext.range(10).write.saveAsTable(tabName)
+ val oldViewName = "view1"
+ val newViewName = "view2"
+ withView(oldViewName, newViewName) {
+ val catalog = hiveContext.sessionState.catalog
+ sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName")
+
+ assert(catalog.tableExists(TableIdentifier(oldViewName)))
+ assert(!catalog.tableExists(TableIdentifier(newViewName)))
+ sql(s"ALTER VIEW $oldViewName RENAME TO $newViewName")
+ assert(!catalog.tableExists(TableIdentifier(oldViewName)))
+ assert(catalog.tableExists(TableIdentifier(newViewName)))
+
+ sql(s"DROP VIEW $newViewName")
--- End diff --
`withView` will help us drop the view at last.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]