[
https://issues.apache.org/jira/browse/SPARK-16678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-16678.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.1.0
Issue resolved by pull request 14314
[https://github.com/apache/spark/pull/14314]
> Disallow Creating/Altering a View when the same-name Table Exists
> -----------------------------------------------------------------
>
> Key: SPARK-16678
> URL: https://issues.apache.org/jira/browse/SPARK-16678
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.0
> Reporter: Xiao Li
> Fix For: 2.1.0
>
>
> When we create OR alter a view, we check whether the view already exists. In
> the current implementation, if a table with the same name exists, we treat it
> as a view. However, this is not the right behavior. We should follow what
> Hive does. For example,
> {noformat}
> hive> CREATE TABLE tab1 (id int);
> OK
> Time taken: 0.196 seconds
> hive> CREATE OR REPLACE VIEW tab1 AS SELECT * FROM t1;
> FAILED: SemanticException [Error 10218]: Existing table is not a view
> The following is an existing table, not a view: default.tab1
> hive> ALTER VIEW tab1 AS SELECT * FROM t1;
> FAILED: SemanticException [Error 10218]: Existing table is not a view
> The following is an existing table, not a view: default.tab1
> hive> CREATE VIEW IF NOT EXISTS tab1 AS SELECT * FROM t1;
> OK
> Time taken: 0.678 seconds
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]