GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/12324
[SPARK-14125] [SQL] Native DDL Support: Alter View
#### What changes were proposed in this pull request?
This PR is to provide a native DDL support for the following three Alter
View commands:
Based on the Hive DDL document:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
##### 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
- not allowed to rename a view's name by ALTER TABLE
##### 2. ALTER VIEW SET TBLPROPERTIES
**Syntax:**
```SQL
ALTER VIEW view_name SET TBLPROPERTIES ('comment' = new_comment);
```
- to add metadata to a view
- not allowed to set views' properties by ALTER TABLE
- ignore it if trying to set a view's existing property key when the value
is the same
- overwrite the value if trying to set a view's existing key to a different
value
##### 3. ALTER VIEW UNSET TBLPROPERTIES
**Syntax:**
```SQL
ALTER VIEW view_name UNSET TBLPROPERTIES [IF EXISTS] ('comment', 'key')
```
- to remove metadata from a view
- not allowed to unset views' properties by ALTER TABLE
- issue an exception if trying to unset a view's non-existent key
#### How was this patch tested?
Added test cases to verify if it works properly.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark alterView
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/12324.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 #12324
----
commit 34e44dac2c9f731fd69081ac0846800e3198de70
Author: gatorsmile <[email protected]>
Date: 2016-04-07T21:11:04Z
fix 1
commit c040e1d4599f19a8354cc064b186dbbf66845e87
Author: gatorsmile <[email protected]>
Date: 2016-04-10T06:24:56Z
Merge remote-tracking branch 'upstream/master' into alterView
commit c8811bca6ebda2b29d7efdd66bdc384e9c7b32ea
Author: gatorsmile <[email protected]>
Date: 2016-04-10T06:45:01Z
correct compilation errors
commit 66cb2c12d667e4d63c2112cd091100ecafe9ff0f
Author: gatorsmile <[email protected]>
Date: 2016-04-12T03:26:37Z
Merge remote-tracking branch 'upstream/master' into alterView
commit c55ab123f016d166a4b4af98c5424967bac685b9
Author: gatorsmile <[email protected]>
Date: 2016-04-12T04:20:50Z
impl
commit ed5a7d0bf4dc4d0f997fe27a274e2d9cfa1749cc
Author: gatorsmile <[email protected]>
Date: 2016-04-12T06:52:10Z
added more test cases.
commit cd20636f09eeb9ecd814a72b9c457d4f07a3142f
Author: gatorsmile <[email protected]>
Date: 2016-04-12T06:58:18Z
Merge remote-tracking branch 'upstream/master' into alterView
----
---
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]