GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/13926

    [SPARK-16229] [SQL] Drop Empty Table After CREATE TABLE AS SELECT fails

    #### What changes were proposed in this pull request?
    In `CREATE TABLE AS SELECT`, if the `SELECT` query failed, the table should 
not exist. For example,
    
    ```SQL
    CREATE TABLE tab
    STORED AS TEXTFILE
    SELECT 1 AS a, (SELECT a FROM (SELECT 1 AS a UNION ALL SELECT 2 AS a) t) AS 
b
    ```
    The above query failed as expected but an empty table `t` is created. 
    
    This PR is to drop the created table when hitting any non-fatal exception.
    
    #### How was this patch tested?
    Added a test case to verify the behavior

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark dropTableAfterException

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/13926.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 #13926
    
----
commit c0f08a518332deac260bc69c787cba06ddf9cf98
Author: gatorsmile <[email protected]>
Date:   2016-06-27T18:22:49Z

    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]

Reply via email to