spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nattavut Sutyanyong (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SPARK-18389) Disallow cyclic view reference
Date Wed, 09 Nov 2016 21:10:59 GMT

    [ https://issues.apache.org/jira/browse/SPARK-18389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15652039#comment-15652039
] 

Nattavut Sutyanyong edited comment on SPARK-18389 at 11/9/16 9:10 PM:
----------------------------------------------------------------------

In CREATE VIEW, if we will check that the objects in the view definition need to exist in
the Catalog, then CREATE VIEW cannot create a cyclic reference. It is only the ALTER VIEW
that can create this problem. We will need to expand the objects referenced and any descendant
views recursively during the processing of ALTER VIEW.

I have a side question regarding how Spark deals with the concurrency and locking of catalog
changes.

{code}
time        |   session 1          |  session 2 
T1          | CREATE TAB T1        |
T2          | CREATE VIEW V1 -> T1 |
T3          | CREATE VIEW V2 -> V1 |
T4          | CREATE VIEW V3 -> V2 | ALTER VIEW V2-> V3 
{code}

Does the current code have a mechanism to lock the entry of V2 during the compilation of VIEW
V3 in time T4 to prevent any change made to the definition of V2 in session 2?


was (Author: nsyca):
In CREATE VIEW, if we will check that the objects in the view definition need to exist in
the Catalog, then CREATE VIEW cannot create a cyclic reference. It is only the ALTER VIEW
that can create this problem. We will need to expand the objects referenced and any descendant
views recursively during the processing of ALTER VIEW.

I have a side question regarding how Spark deals with the concurrency and locking of catalog
changes.

````
time        |   session 1          |  session 2 

T1          | CREATE TAB T1        |
T2          | CREATE VIEW V1 -> T1 |
T3          | CREATE VIEW V2 -> V1 |
T4          | CREATE VIEW V3 -> V2 | ALTER VIEW V2-> V3 
````

Does the current code have a mechanism to lock the entry of V2 during the compilation of VIEW
V3 in time T4 to prevent any change made to the definition of V2 in session 2?

> Disallow cyclic view reference
> ------------------------------
>
>                 Key: SPARK-18389
>                 URL: https://issues.apache.org/jira/browse/SPARK-18389
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Reynold Xin
>
> The following should not be allowed:
> {code}
> CREATE VIEW testView AS SELECT id FROM jt
> CREATE VIEW testView2 AS SELECT id FROM testView
> ALTER VIEW testView AS SELECT * FROM testView2
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message