GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/11987
[SPARK-14182] [SQL] Parse DDL Command: Alter View
#### What changes were proposed in this pull request?
This PR is to provide native parsing support for DDL commands: `Alter
View`. Since its AST trees are highly similar to `Alter Table`. Thus, both
implementation are integrated into the same one.
Based on the Hive DDL document:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL and
https://cwiki.apache.org/confluence/display/Hive/PartitionedViews
##### 1. ALTER VIEW RENAME
**Syntax:**
```SQL
ALTER VIEW view_name RENAME TO new_view_name
```
- to change the name of a view to a different name
##### 2. ALTER VIEW SET TBLPROPERTIES
**Syntax:**
```SQL
ALTER VIEW view_name SET TBLPROPERTIES ('comment' = new_comment);
```
- to add metadata to a view
##### 3. ALTER VIEW UNSET TBLPROPERTIES
**Syntax:**
```SQL
ALTER VIEW view_name UNSET TBLPROPERTIES [IF EXISTS] ('comment', 'key')
```
- to remove metadata from a view
##### 4. ALTER VIEW ADD PARTITION
**Syntax:**
```SQL
ALTER VIEW view_name ADD [IF NOT EXISTS] PARTITION spec1[, PARTITION spec2,
...]
```
- to add the partitioning metadata for a view.
- the syntax of partition spec in `ALTER VIEW` is identical to `ALTER
TABLE`, **EXCEPT** that it is **ILLEGAL** to specify a `LOCATION` clause.
##### 5. ALTER VIEW DROP PARTITION
**Syntax:**
```SQL
ALTER VIEW view_name DROP [IF EXISTS] PARTITION spec1[, PARTITION spec2,
...]
```
- to drop the related partition metadata for a view.
#### How was this patch tested?
Added the related test cases to `DDLCommandSuite`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark parseAlterView
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/11987.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 #11987
----
commit b1ffb0d2dfc4676f0a35fe6a3a197179a96dc138
Author: gatorsmile <[email protected]>
Date: 2016-03-27T05:58:44Z
native parsing support for alter view.
commit ea44a9f1d90420d03e93d918fdbbe7fbf4128170
Author: gatorsmile <[email protected]>
Date: 2016-03-27T06:02:28Z
Merge remote-tracking branch 'upstream/master' into parseAlterView
commit 3b7b41b1c4b33e4ec721131f5578ddbfc0b84035
Author: gatorsmile <[email protected]>
Date: 2016-03-27T07:21:24Z
added comments and fixed bugs.
commit 7322fb1a5062e841538fea864116c961c1daf3ac
Author: gatorsmile <[email protected]>
Date: 2016-03-27T07:32:06Z
update comments.
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]