{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/12099","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/12099/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/12099/comments","events_url":"https://api.github.com/repos/apache/spark/issues/12099/events","html_url":"https://github.com/apache/spark/pull/12099","id":145030761,"number":12099,"title":"[SPARK-14251][SQL] Add SQL command for printing out generated code for debugging","user":{"login":"dongjoon-hyun","id":9700541,"avatar_url":"https://avatars.githubusercontent.com/u/9700541?v=3","gravatar_id":"","url":"https://api.github.com/users/dongjoon-hyun","html_url":"https://github.com/dongjoon-hyun","followers_url":"https://api.github.com/users/dongjoon-hyun/followers","following_url":"https://api.github.com/users/dongjoon-hyun/following{/other_user}","gists_url":"https://api.github.com/users/dongjoon-hyun/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjoon-hyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjoon-hyun/subscriptions","organizations_url":"https://api.github.com/users/dongjoon-hyun/orgs","repos_url":"https://api.github.com/users/dongjoon-hyun/repos","events_url":"https://api.github.com/users/dongjoon-hyun/events{/privacy}","received_events_url":"https://api.github.com/users/dongjoon-hyun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-31T22:02:52Z","updated_at":"2016-04-01T00:36:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/12099","html_url":"https://github.com/apache/spark/pull/12099","diff_url":"https://github.com/apache/spark/pull/12099.diff","patch_url":"https://github.com/apache/spark/pull/12099.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nThis PR implements `EXPLAIN CODEGEN` SQL command. In short, this command do the `explain` and `debugCodegen` at one command. For example, \r\n* (1) `sql(\"explain extended select 'a' as a group by 1\").collect().foreach(println)`\r\n* (2) `sql(\"select 'a' as a group by 1\").debugCodegen()`\r\n* (1+2: This PR) `sql(\"explain extended codegen select 'a' as a group by 1\").collect().foreach(println)`\r\n\r\n**Before**\r\n```\r\nscala> import org.apache.spark.sql.execution.debug._\r\nscala> sql(\"explain extended select 'a' as a group by 1\").collect().foreach(println)\r\n[== Parsed Logical Plan ==]\r\n...\r\n[== Analyzed Logical Plan ==]\r\n...\r\n[== Optimized Logical Plan ==]\r\n...\r\n[== Physical Plan ==]\r\n...\r\n\r\nscala> sql(\"select 'a' as a group by 1\").debugCodegen()\r\nFound 2 WholeStageCodegen subtrees.\r\n== Subtree 1 / 2 ==\r\n...\r\n\r\nGenerated code:\r\n...\r\n\r\n== Subtree 2 / 2 ==\r\n...\r\n\r\nGenerated code:\r\n...\r\n```\r\n\r\n**After**\r\n```\r\nscala> sql(\"explain extended codegen select 'a' as a group by 1\").collect().foreach(println)\r\n[== Parsed Logical Plan ==]\r\n...\r\n[== Analyzed Logical Plan ==]\r\n...\r\n[== Optimized Logical Plan ==]\r\n...\r\n[== Physical Plan ==]\r\n...\r\n[]\r\n[Found 2 WholeStageCodegen subtrees.]\r\n[== Subtree 1 / 2 ==]\r\n...\r\n[]\r\n[Generated code:]\r\n...\r\n[]\r\n[== Subtree 2 / 2 ==]\r\n...\r\n[]\r\n[Generated code:]\r\n...\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nPass the Jenkins tests (including new testcases)"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/204191621","html_url":"https://github.com/apache/spark/pull/12099#issuecomment-204191621","issue_url":"https://api.github.com/repos/apache/spark/issues/12099","id":204191621,"user":{"login":"AmplabJenkins","id":4031291,"avatar_url":"https://avatars.githubusercontent.com/u/4031291?v=3","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T00:36:10Z","updated_at":"2016-04-01T00:36:10Z","body":"Test PASSed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/54673/\nTest PASSed."}}