Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16674#discussion_r100594350
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
    @@ -233,6 +252,42 @@ class SQLViewSuite extends QueryTest with SQLTestUtils 
with TestHiveSingleton {
         }
       }
     
    +  test("correctly parse a nested view") {
    +    withTempDatabase { db =>
    +      withView("view1", "view2", s"$db.view3") {
    +        sql("CREATE VIEW view1(x, y) AS SELECT * FROM jt")
    +
    +        // Create a nested view in the same database.
    +        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)))
    +
    +        // Create a nested view in a different database.
    +        activateDatabase(db) {
    +          sql(s"CREATE VIEW $db.view3(id, id1) AS SELECT * FROM 
default.view1")
    +          checkAnswer(sql("SELECT * FROM view3 ORDER BY id"), (1 to 
9).map(i => Row(i, i)))
    +        }
    +      }
    +    }
    +  }
    +
    +  test("correctly parse a view with custom column names") {
    +    withTable("tab1") {
    +      spark.range(1, 10).selectExpr("id", "id + 1 
id1").write.saveAsTable("tab1")
    +      withView("testView1", "testView2") {
    +        // Correctly create a view with custom column names
    +        sql("CREATE VIEW testView1(x, y) AS SELECT * FROM tab1")
    --- End diff --
    
    can we just use `jt` and avoid creating `tab1`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to