Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/16674#discussion_r100594045
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
@@ -334,6 +389,25 @@ class SQLViewSuite extends QueryTest with SQLTestUtils
with TestHiveSingleton {
}
}
+ test("correctly handle ALTER VIEW on a referenced view") {
+ withTable("jt2") {
+ val df = (1 until 10).map(i => (i, i + 1)).toDF("i", "j")
+ df.write.format("json").saveAsTable("jt2")
+
+ withView("view1", "view2") {
+ sql("CREATE VIEW view1(x, y) AS SELECT * FROM jt")
+
+ // Create a nested view.
+ sql("CREATE VIEW view2(id, id1) AS SELECT * FROM view1")
+ checkAnswer(sql("SELECT * FROM view2 ORDER BY id"), (1 to 9).map(i
=> Row(i, i)))
+
+ // Alter the referenced view.
+ sql("ALTER VIEW view1 AS SELECT i AS x, j AS y FROM jt2")
--- End diff --
nit: `ALTER VIEW view1 AS SELECT id AS x, id1 + 1 As y FROM jt`, then we
don't need to create `jt2`
---
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]