You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by jiangxb1987 <gi...@git.apache.org> on 2017/03/03 15:37:54 UTC

[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

GitHub user jiangxb1987 opened a pull request:

    https://github.com/apache/spark/pull/17152

    [SPARK-18389][SQL] Disallow cyclic view reference

    ## What changes were proposed in this pull request?
    
    Disallow cyclic view references, a cyclic view reference may be created by the following queries:
    ```
    CREATE VIEW testView AS SELECT id FROM tbl
    CREATE VIEW testView2 AS SELECT id FROM testView
    ALTER VIEW testView AS SELECT * FROM testView2
    ```
    In the above example, a reference cycle (testView -> testView2 -> testView) exsits.
    
    We disallow cyclic view references by checking that in ALTER VIEW command, when the `analyzedPlan` contains the same `View` node with the altered view, we should prevent the behavior and throw an AnalysisException.
    
    ## How was this patch tested?
    
    Test by `SQLViewSuite.test("correctly handle a cyclic view reference")`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jiangxb1987/spark cyclic-view

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17152.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17152
    
----
commit 1bd02603fa24e6790994105cd47c8b55a4c1de40
Author: jiangxingbo <ji...@gmail.com>
Date:   2017-03-03T15:30:59Z

    detect cyclic view references.

----


---
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


[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by nsyca <gi...@git.apache.org>.
Github user nsyca commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17152#discussion_r104462108
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
    @@ -609,12 +609,25 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
         }
       }
     
    -  // TODO: Check for cyclic view references on ALTER VIEW.
    -  ignore("correctly handle a cyclic view reference") {
    -    withView("view1", "view2") {
    +  test("correctly handle a cyclic view reference") {
    +    withView("view1", "view2", "view3") {
           sql("CREATE VIEW view1 AS SELECT * FROM jt")
           sql("CREATE VIEW view2 AS SELECT * FROM view1")
    -      intercept[AnalysisException](sql("ALTER VIEW view1 AS SELECT * FROM view2"))
    +      sql("CREATE VIEW view3 AS SELECT * FROM view2")
    +
    +      // Detect cyclic view reference on ALTER VIEW.
    +      val e1 = intercept[AnalysisException] {
    +        sql("ALTER VIEW view1 AS SELECT * FROM view2")
    +      }.getMessage
    +      assert(e1.contains("Recursive view `default`.`view1` detected (cycle: `default`.`view1` " +
    +        "-> `default`.`view2` -> `default`.`view1`)"))
    +
    +      // Detect the most left cycle when there exists multiple cyclic view references.
    +      val e2 = intercept[AnalysisException] {
    +        sql("ALTER VIEW view1 AS SELECT * FROM view3 JOIN view2")
    +      }.getMessage
    +      assert(e2.contains("Recursive view `default`.`view1` detected (cycle: `default`.`view1` " +
    +        "-> `default`.`view3` -> `default`.`view2` -> `default`.`view1`)"))
    --- End diff --
    
    What is missing in your code is whenever you hit a `SubqueryExpression`, you need to traverse the `plan` of that expression to detect cyclic references? See an example of the code in https://github.com/apache/spark/pull/16493.


---
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


[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by nsyca <gi...@git.apache.org>.
Github user nsyca commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17152#discussion_r104707409
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala ---
    @@ -358,4 +366,51 @@ object ViewHelper {
           generateViewDefaultDatabase(viewDefaultDatabase) ++
           generateQueryColumnNames(queryOutput)
       }
    +
    +  /**
    +   * Recursively search the logical plan to detect cyclic view references, throw an
    +   * AnalysisException if cycle detected.
    +   *
    +   * A cyclic view reference is a cycle of reference dependencies, for example, if the following
    +   * statements are executed:
    +   * CREATE VIEW testView AS SELECT id FROM tbl
    +   * CREATE VIEW testView2 AS SELECT id FROM testView
    +   * ALTER VIEW testView AS SELECT * FROM testView2
    +   * The view `testView` references `testView2`, and `testView2` also references `testView`,
    +   * therefore a reference cycle (testView -> testView2 -> testView) exists.
    +   *
    +   * @param plan the logical plan we detect cyclic view references from.
    +   * @param path the path between the altered view and current node.
    +   * @param viewIdent the table identifier of the altered view, we compare two views by the
    +   *                  `desc.identifier`.
    +   */
    +  def checkCyclicViewReference(
    +      plan: LogicalPlan,
    +      path: Seq[TableIdentifier],
    +      viewIdent: TableIdentifier): Unit = {
    +    plan match {
    +      case v: View =>
    +        val ident = v.desc.identifier
    +        val newPath = path :+ ident
    +        // If the table identifier equals to the `viewIdent`, current view node is the same with
    +        // the altered view. We detect a view reference cycle, should throw an AnalysisException.
    +        if (ident == viewIdent) {
    +          throw new AnalysisException(s"Recursive view $viewIdent detected " +
    +            s"(cycle: ${newPath.mkString(" -> ")})")
    +        } else {
    +          v.children.foreach { child =>
    +            checkCyclicViewReference(child, newPath, viewIdent)
    +          }
    +        }
    +      case _ =>
    +        plan.children.foreach(child => checkCyclicViewReference(child, path, viewIdent))
    +    }
    +
    +    // Detect cyclic references from subqueries.
    +    plan.expressions.foreach { expr =>
    +      if (expr.isInstanceOf[SubqueryExpression]) {
    +        checkCyclicViewReference(expr.asInstanceOf[SubqueryExpression].plan, path, viewIdent)
    --- End diff --
    
    Shall we use the pattern matching instead of `isInstanceOf-asInstanceOf`?


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by nsyca <gi...@git.apache.org>.
Github user nsyca commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17152#discussion_r104459690
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
    @@ -609,12 +609,25 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
         }
       }
     
    -  // TODO: Check for cyclic view references on ALTER VIEW.
    -  ignore("correctly handle a cyclic view reference") {
    -    withView("view1", "view2") {
    +  test("correctly handle a cyclic view reference") {
    +    withView("view1", "view2", "view3") {
           sql("CREATE VIEW view1 AS SELECT * FROM jt")
           sql("CREATE VIEW view2 AS SELECT * FROM view1")
    -      intercept[AnalysisException](sql("ALTER VIEW view1 AS SELECT * FROM view2"))
    +      sql("CREATE VIEW view3 AS SELECT * FROM view2")
    +
    +      // Detect cyclic view reference on ALTER VIEW.
    +      val e1 = intercept[AnalysisException] {
    +        sql("ALTER VIEW view1 AS SELECT * FROM view2")
    +      }.getMessage
    +      assert(e1.contains("Recursive view `default`.`view1` detected (cycle: `default`.`view1` " +
    +        "-> `default`.`view2` -> `default`.`view1`)"))
    +
    +      // Detect the most left cycle when there exists multiple cyclic view references.
    +      val e2 = intercept[AnalysisException] {
    +        sql("ALTER VIEW view1 AS SELECT * FROM view3 JOIN view2")
    +      }.getMessage
    +      assert(e2.contains("Recursive view `default`.`view1` detected (cycle: `default`.`view1` " +
    +        "-> `default`.`view3` -> `default`.`view2` -> `default`.`view1`)"))
    --- End diff --
    
    How about this test case?
    
    `sql("alter view v1 as select * from jt where exists (select 1 from v2)")`
    
    Should we get the same exception as well?


---
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


[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/17152


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #73854 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/73854/testReport)** for PR 17152 at commit [`1bd0260`](https://github.com/apache/spark/commit/1bd02603fa24e6790994105cd47c8b55a4c1de40).


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Yeah. The temporary view does not have such an issue, because we did not change it. My typo. 
    
    What I mean is `CREATE OR REPLACE VIEW`. `AlterViewAsCommand` does not cover that code path. : )


---
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


[GitHub] spark pull request #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17152#discussion_r104743057
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala ---
    @@ -358,4 +366,51 @@ object ViewHelper {
           generateViewDefaultDatabase(viewDefaultDatabase) ++
           generateQueryColumnNames(queryOutput)
       }
    +
    +  /**
    +   * Recursively search the logical plan to detect cyclic view references, throw an
    +   * AnalysisException if cycle detected.
    +   *
    +   * A cyclic view reference is a cycle of reference dependencies, for example, if the following
    +   * statements are executed:
    +   * CREATE VIEW testView AS SELECT id FROM tbl
    +   * CREATE VIEW testView2 AS SELECT id FROM testView
    +   * ALTER VIEW testView AS SELECT * FROM testView2
    +   * The view `testView` references `testView2`, and `testView2` also references `testView`,
    +   * therefore a reference cycle (testView -> testView2 -> testView) exists.
    +   *
    +   * @param plan the logical plan we detect cyclic view references from.
    +   * @param path the path between the altered view and current node.
    +   * @param viewIdent the table identifier of the altered view, we compare two views by the
    +   *                  `desc.identifier`.
    +   */
    +  def checkCyclicViewReference(
    +      plan: LogicalPlan,
    +      path: Seq[TableIdentifier],
    +      viewIdent: TableIdentifier): Unit = {
    +    plan match {
    +      case v: View =>
    +        val ident = v.desc.identifier
    +        val newPath = path :+ ident
    +        // If the table identifier equals to the `viewIdent`, current view node is the same with
    +        // the altered view. We detect a view reference cycle, should throw an AnalysisException.
    +        if (ident == viewIdent) {
    +          throw new AnalysisException(s"Recursive view $viewIdent detected " +
    +            s"(cycle: ${newPath.mkString(" -> ")})")
    +        } else {
    +          v.children.foreach { child =>
    +            checkCyclicViewReference(child, newPath, viewIdent)
    +          }
    +        }
    +      case _ =>
    +        plan.children.foreach(child => checkCyclicViewReference(child, path, viewIdent))
    +    }
    +
    +    // Detect cyclic references from subqueries.
    +    plan.expressions.foreach { expr =>
    +      if (expr.isInstanceOf[SubqueryExpression]) {
    +        checkCyclicViewReference(expr.asInstanceOf[SubqueryExpression].plan, path, viewIdent)
    --- End diff --
    
    +1


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    When do other databases report this error? During view creating/alter or during view resolution?


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #73854 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/73854/testReport)** for PR 17152 at commit [`1bd0260`](https://github.com/apache/spark/commit/1bd02603fa24e6790994105cd47c8b55a4c1de40).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Based on our current impl of view, `createOrReplaceTempView` can still trigger the cyclic view reference. Right?


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    @gatorsmile @nsyca Thank you for your comments! I've added the coverage for both `CREATE OR REPLACE VIEW` and `SubqueryExpression`s.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #74169 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74169/testReport)** for PR 17152 at commit [`46da41e`](https://github.com/apache/spark/commit/46da41e2b74ef08945b6d147a182ad7940533ceb).


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/74088/
    Test PASSed.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    @gatorsmile Currently we don't perform recursive resolution over a temporary view, so perhaps that won't trigger a cyclic view reference. For example:
    ```
    scala> spark.sql("CREATE TEMPORARY VIEW v1 AS SELECT * FROM tab")
    res3: org.apache.spark.sql.DataFrame = []
    
    scala> spark.sql("CREATE TEMPORARY VIEW v2 AS SELECT * FROM v1")
    res4: org.apache.spark.sql.DataFrame = []
    
    scala> spark.sql("ALTER VIEW v1 AS SELECT * FROM v2")
    res5: org.apache.spark.sql.DataFrame = []
    
    scala> spark.sql("SELECT * FROM v1")
    res6: org.apache.spark.sql.DataFrame = [a: int, b: string]
    ```


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by nsyca <gi...@git.apache.org>.
Github user nsyca commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Going back to @gatorsmile 's question, does this fix cover the scenario below?
    
    `sql("create or replace view v1 as select * from v2")`
    
    If this is an existing problem and your PR does not cover it, would you intend to address it in this PR? 


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Hive report the error during alter view:
    ```
    hive> CREATE VIEW v1 AS SELECT * FROM t1;
    OK
    Time taken: 0.556 seconds
    hive> CREATE VIEW v2 AS SELECT * FROM v1;
    OK
    Time taken: 0.099 seconds
    hive> ALTER VIEW v1 AS SELECT * FROM v2;
    FAILED: SemanticException Recursive view default.v1 detected (cycle: default.v1 -> default.v2 -> default.v1).
    hive> CREATE VIEW v3 AS SELECT * FROM v2;
    OK
    Time taken: 0.354 seconds
    hive> ALTER VIEW v1 AS SELECT * FROM v3 JOIN v2;
    FAILED: SemanticException Recursive view default.v1 detected (cycle: default.v1 -> default.v3 -> default.v2 -> default.v1).
    ```


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #74088 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74088/testReport)** for PR 17152 at commit [`f487af3`](https://github.com/apache/spark/commit/f487af3732045a1d461f8a8d0981931db4a4c47c).


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #74088 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74088/testReport)** for PR 17152 at commit [`f487af3`](https://github.com/apache/spark/commit/f487af3732045a1d461f8a8d0981931db4a4c47c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/74169/
    Test PASSed.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    cc @gatorsmile @hvanhovell @cloud-fan @nsyca 


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    **[Test build #74169 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74169/testReport)** for PR 17152 at commit [`46da41e`](https://github.com/apache/spark/commit/46da41e2b74ef08945b6d147a182ad7940533ceb).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark issue #17152: [SPARK-18389][SQL] Disallow cyclic view reference

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17152
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/73854/
    Test PASSed.


---
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