GitHub user gatorsmile opened a pull request: https://github.com/apache/spark/pull/13572
[SPARK-15838] CACHE TABLE AS SELECT should not replace the existing Temp Table #### What changes were proposed in this pull request? If the temp table already exists, we should not silently replace it when doing `CACHE TABLE AS SELECT`. This PR is to fix this silent drop. Second, the table name in `CACHE TABLE AS SELECT` should NOT contain database prefix like "database.table". Thus, this PR captures this and output a better error message, instead of reporting the view already exists. Third, refactoring the `Parser` to generate table identifiers instead of returning the table name string. #### How was this patch tested? - Added a test case for caching qualified table names - Fixed a few test cases that do not drop temp table at the end - Added two test cases for the two issues resolved in this PR You can merge this pull request into a Git repository by running: $ git pull https://github.com/gatorsmile/spark cacheTableAsSelect Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/13572.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 #13572 ---- commit b4719fe5aab92b09dd13e66a063bda494af7dbb2 Author: gatorsmile <gatorsm...@gmail.com> Date: 2016-06-09T06:05:13Z fix commit c1b1e6e0f86bb1b40cf292537cc7614fd85fb0c9 Author: gatorsmile <gatorsm...@gmail.com> Date: 2016-06-09T06:19:26Z test case. commit 16f7c41386317c0c1165c4ee4aec7994d51f397c Author: gatorsmile <gatorsm...@gmail.com> Date: 2016-06-09T06:20:30Z style fix. commit 082c8f27adc49ba8cbb9b32a2fac74a16bc999f2 Author: gatorsmile <gatorsm...@gmail.com> Date: 2016-06-09T06:21:37Z revert change. ---- --- 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