spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatorsmile <...@git.apache.org>
Subject [GitHub] spark pull request #14874: [SPARK-17180][SPARK-17309][SPARK-17323][SQL] crea...
Date Wed, 31 Aug 2016 06:45:33 GMT
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14874#discussion_r76932113
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLViewSuite.scala
---
    @@ -274,6 +276,75 @@ class SQLViewSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
{
         }
       }
     
    +  test("should not allow ALTER VIEW AS when the view does not exist") {
    +    intercept[NoSuchTableException](
    +      sql("ALTER VIEW testView AS SELECT 1, 2")
    +    )
    +
    +    intercept[NoSuchTableException](
    +      sql("ALTER VIEW default.testView AS SELECT 1, 2")
    +    )
    +  }
    +
    +  test("ALTER VIEW AS should try to alter temp view first if view name has no database
part") {
    +    withTempView("test_view") {
    +      withView("test_view") {
    +        sql("CREATE VIEW test_view AS SELECT 1 AS a, 2 AS b")
    +        sql("CREATE TEMP VIEW test_view AS SELECT 1 AS a, 2 AS b")
    +
    +        sql("ALTER VIEW test_view AS SELECT 3 AS i, 4 AS j")
    +
    +        // The temporary view should be updated.
    +        checkAnswer(spark.table("test_view"), Row(3, 4))
    +
    +        // The permanent view should stay same.
    +        checkAnswer(spark.table("default.test_view"), Row(1, 2))
    +      }
    +    }
    +  }
    +
    +  test("ALTER VIEW AS should alter permanent view if view name has database part") {
    +    withTempView("test_view") {
    +      withView("test_view") {
    --- End diff --
    
    Based on my understanding, this will drop the temporary view because the resolution preference
of `drop view` and then `withTempView` is unable to find any temporary view. 


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

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


Mime
View raw message