GitHub user xwu0226 opened a pull request:
https://github.com/apache/spark/pull/16878
[SPARK-19539][SQL] Block duplicate temp table during creation
## What changes were proposed in this pull request?
Current `CREATE TEMPORARY TABLE ... ` is deprecated and recommend users to
use `CREATE TEMPORARY VIEW ...` And it does not support `IF NOT EXISTS `clause.
However, if there is an existing temporary view defined, it is possible to
unintentionally replace this existing view by issuing `CREATE TEMPORARY TABLE
...` with the same table/view name.
This PR is to disallow `CREATE TEMPORARY TABLE ...` with an existing view
name.
Under the cover, `CREATE TEMPORARY TABLE ...` will be changed to create
temporary view, however, passing in a flag `replace=false`, instead of
currently `true`. So when creating temporary view under the cover, if there is
existing view with the same name, the operation will be blocked.
## How was this patch tested?
New unit test case is added and updated some existing test cases to adapt
the new behavior
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xwu0226/spark block_duplicate_temp_table
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16878.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 #16878
----
commit 9da7942dc9068debb23f357454ee718fd9399e56
Author: Xin Wu <[email protected]>
Date: 2017-02-10T00:24:31Z
don't allow create temporary table to replace existing temp view
commit 12702b359102fe5ad979947d1170bf0df75981af
Author: Xin Wu <[email protected]>
Date: 2017-02-10T00:54:11Z
update testcases
commit 133bd99b1158f08bf2fe5e278cd632efc39d7ddb
Author: Xin Wu <[email protected]>
Date: 2017-02-10T01:19:03Z
update testcases
----
---
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]