{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/12132","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/12132/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/12132/comments","events_url":"https://api.github.com/repos/apache/spark/issues/12132/events","html_url":"https://github.com/apache/spark/pull/12132","id":145412246,"number":12132,"title":"[SPARK-14346] [SQL][WIP]Show create table ","user":{"login":"xwu0226","id":14225992,"avatar_url":"https://avatars.githubusercontent.com/u/14225992?v=3","gravatar_id":"","url":"https://api.github.com/users/xwu0226","html_url":"https://github.com/xwu0226","followers_url":"https://api.github.com/users/xwu0226/followers","following_url":"https://api.github.com/users/xwu0226/following{/other_user}","gists_url":"https://api.github.com/users/xwu0226/gists{/gist_id}","starred_url":"https://api.github.com/users/xwu0226/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwu0226/subscriptions","organizations_url":"https://api.github.com/users/xwu0226/orgs","repos_url":"https://api.github.com/users/xwu0226/repos","events_url":"https://api.github.com/users/xwu0226/events{/privacy}","received_events_url":"https://api.github.com/users/xwu0226/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-04-02T20:04:18Z","updated_at":"2016-04-05T03:28:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/12132","html_url":"https://github.com/apache/spark/pull/12132","diff_url":"https://github.com/apache/spark/pull/12132.diff","patch_url":"https://github.com/apache/spark/pull/12132.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\n1. add `SHOW CREATE TABLE tableIdentifier`  in **SqlBase.g4** file\r\n\r\n2. create a `RunnableCommand ` class for `ShowCreateTableCommand`, that invokes `SessionCatalog.generateTableDDL`\r\n\r\n3. add `generateTableDDL ` method in `SessionCatalog `and override it in `HiveSessionCatalog`.\r\n\r\n4. `HiveSessionCatalog.generateTableDDL` is to create DDL for metastore tables. and for tempTables in Spark, it may not be quite practical. For now, we throw exception in `SessionCatalog.generateTableDDL`. If the community thinks it is also necessary, we can implement this later. \r\n\r\n5. `HiveSessionCatalog.generateTableDDL` branches out to generate Hive syntax DDL for hive tables, while it is also supposed to branch out to generate DataSource syntax DDL for datasource tables. Latter part is in progress.\r\n\r\nTODO:\r\n1. Implement generate DDL for DataSource table with DataSource syntax DDL like \"**USING**... **OPTIONS**...\"\r\n\r\n2. Currently for hive table DDL syntax, there are also a few potential gaps like sortBucketSpec, skewSpec, storageHandler case, etc. that are not quite supported in `CatalogTable`.. we may need to discuss whether we need to complete this. \r\n\r\n3. Complete the unit testcase with checkAnswer.. Right now, it put the show() to display what it generates. \r\n\r\n## How was this patch tested?\r\nunite tests with manual observation so far. Testcases will be completed as TODO \r\n\r\nWIP"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/205623935","html_url":"https://github.com/apache/spark/pull/12132#issuecomment-205623935","issue_url":"https://api.github.com/repos/apache/spark/issues/12132","id":205623935,"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-05T03:28:50Z","updated_at":"2016-04-05T03:28:50Z","body":"**[Test build #54920 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/54920/consoleFull)** for PR 12132 at commit [`f8feff9`](https://github.com/apache/spark/commit/f8feff95a8126295412176824f229cff4c63699c).\n * This patch passes all tests.\n * This patch merges cleanly.\n * This patch adds the following public classes _(experimental)_:\n  * `class HiveShowDDLSuite extends QueryTest with SQLTestUtils with TestHiveSingleton `"}}