{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/12146","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/12146/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/12146/comments","events_url":"https://api.github.com/repos/apache/spark/issues/12146/events","html_url":"https://github.com/apache/spark/pull/12146","id":145591990,"number":12146,"title":"[SPARK-14362] [SPARK-14406] [SQL] DDL Native Support: Drop View and Drop Table","user":{"login":"gatorsmile","id":11567269,"avatar_url":"https://avatars.githubusercontent.com/u/11567269?v=3","gravatar_id":"","url":"https://api.github.com/users/gatorsmile","html_url":"https://github.com/gatorsmile","followers_url":"https://api.github.com/users/gatorsmile/followers","following_url":"https://api.github.com/users/gatorsmile/following{/other_user}","gists_url":"https://api.github.com/users/gatorsmile/gists{/gist_id}","starred_url":"https://api.github.com/users/gatorsmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gatorsmile/subscriptions","organizations_url":"https://api.github.com/users/gatorsmile/orgs","repos_url":"https://api.github.com/users/gatorsmile/repos","events_url":"https://api.github.com/users/gatorsmile/events{/privacy}","received_events_url":"https://api.github.com/users/gatorsmile/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2016-04-04T05:58:30Z","updated_at":"2016-04-09T07:47:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/12146","html_url":"https://github.com/apache/spark/pull/12146","diff_url":"https://github.com/apache/spark/pull/12146.diff","patch_url":"https://github.com/apache/spark/pull/12146.patch"},"body":"#### What changes were proposed in this pull request?\r\n\r\nThis PR is to provide a native support for DDL `DROP VIEW` and `DROP TABLE`. The PR includes native parsing and native analysis.\r\n\r\nBased on the HIVE DDL document for [DROP_VIEW_WEB_LINK](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-\r\nDropView\r\n), `DROP VIEW` is defined as, \r\n**Syntax:**\r\n```SQL\r\nDROP VIEW [IF EXISTS] [db_name.]view_name;\r\n```\r\n - to remove metadata for the specified view. \r\n - illegal to use DROP TABLE on a view.\r\n - illegal to use DROP VIEW on a table.\r\n - this command only works in `HiveContext`. In `SQLContext`, we will get an exception. \r\n\r\nThis PR also handles `DROP TABLE`. \r\n**Syntax:**\r\n```SQL\r\nDROP TABLE [IF EXISTS] table_name [PURGE];\r\n```\r\n- Previously, the `DROP TABLE` command only can drop Hive tables in `HiveContext`. Now, after this PR, this command also can drop temporary table, external table, external data source table in `SQLContext`. \r\n- In `HiveContext`, we will not issue an exception if the to-be-dropped table does not exist and users did not specify `IF EXISTS`. Instead, we just log an error message. If `IF EXISTS` is specified, we will not issue any error message/exception.  \r\n- In `SQLContext`, we will issue an exception if the to-be-dropped table does not exist, unless `IF EXISTS` is specified.\r\n\r\n#### How was this patch tested?\r\nFor verifying command parsing, added test cases in `spark/sql/hive/HiveDDLCommandSuite.scala`\r\nFor verifying command analysis, added test cases in `spark/sql/hive/execution/HiveDDLSuite.scala`"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/207736709","html_url":"https://github.com/apache/spark/pull/12146#issuecomment-207736709","issue_url":"https://api.github.com/repos/apache/spark/issues/12146","id":207736709,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2016-04-09T07:47:37Z","updated_at":"2016-04-09T07:47:37Z","body":"**[Test build #55424 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55424/consoleFull)** for PR 12146 at commit [`f280ec4`](https://github.com/apache/spark/commit/f280ec4e539e6cae5ef687ae3916711beca08f6a).\n * This patch **fails Spark unit tests**.\n * This patch merges cleanly.\n * This patch adds no public classes."}}