GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/14113
[SPARK-16457] [SQL] Fix Wrong Messages when CTAS with a Partition By Clause
#### What changes were proposed in this pull request?
When doing a CTAS with a Partition By clause, we got a wrong error message.
For example,
```SQL
CREATE TABLE gen__tmp
PARTITIONED BY (key string)
AS SELECT key, value FROM mytable1
```
The error message we get now is like
```
Operation not allowed: Schema may not be specified in a Create Table As
Select (CTAS) statement(line 2, pos 0)
```
However, based on the code, the message we should get is like
```
Operation not allowed: A Create Table As Select (CTAS) statement is not
allowed to create a partitioned table using Hive's file formats. Please use the
syntax of "CREATE TABLE tableName USING dataSource OPTIONS (...) PARTITIONED BY
...\" to create a partitioned table through a CTAS statement.(line 2, pos 0)
```
Currently, partitioning columns is part of the schema. This PR fixes the
bug by changing the detection orders.
#### How was this patch tested?
Added test cases.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark ctas
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14113.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 #14113
----
commit 55b1a8c4f44611b2f7372acef5b79dad5833d105
Author: gatorsmile <[email protected]>
Date: 2016-07-09T07:32:57Z
fix.
----
---
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]