GitHub user andrewor14 opened a pull request: https://github.com/apache/spark/pull/13490
[SPARK-15722][SQL] Disallow specifying schema in CTAS statement ## What changes were proposed in this pull request? As of this patch, this leads to an exception because the schemas may not match: ``` CREATE TABLE students (age INT, name STRING) AS SELECT * FROM boxes ``` but this is OK: ``` CREATE TABLE students AS SELECT * FROM boxes ``` this is also OK because there's not an existing schema for us to borrow from: ``` CREATE TABLE students (age INT, name STRING) AS SELECT 1, 'hello' ``` ## How was this patch tested? SQLQuerySuite, HiveDDLCommandSuite You can merge this pull request into a Git repository by running: $ git pull https://github.com/andrewor14/spark ctas-no-column Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/13490.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 #13490 ---- commit 1e3704550dde279215a49db41cfa3bdbd44809d4 Author: Andrew Or <and...@databricks.com> Date: 2016-06-02T01:04:14Z Ban CTAS with schema commit 347d8b361ecc21c446e6b5186e2af2e519c5d549 Author: Andrew Or <and...@databricks.com> Date: 2016-06-02T01:08:45Z Fix tests commit fc372f5d487109bf5cf7cc59f41f38004f2bc108 Author: Andrew Or <and...@databricks.com> Date: 2016-06-03T01:13:18Z Fix tests Now we throw an exception only if the SELECT statement actually reads from a table, which has a schema. ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org