{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/11596","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/11596/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/11596/comments","events_url":"https://api.github.com/repos/apache/spark/issues/11596/events","html_url":"https://github.com/apache/spark/pull/11596","id":139454535,"number":11596,"title":"[SPARK-12719][SQL] [WIP] SQL generation support for generators, including UDTF","user":{"login":"dilipbiswal","id":14225158,"avatar_url":"https://avatars.githubusercontent.com/u/14225158?v=3","gravatar_id":"","url":"https://api.github.com/users/dilipbiswal","html_url":"https://github.com/dilipbiswal","followers_url":"https://api.github.com/users/dilipbiswal/followers","following_url":"https://api.github.com/users/dilipbiswal/following{/other_user}","gists_url":"https://api.github.com/users/dilipbiswal/gists{/gist_id}","starred_url":"https://api.github.com/users/dilipbiswal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilipbiswal/subscriptions","organizations_url":"https://api.github.com/users/dilipbiswal/orgs","repos_url":"https://api.github.com/users/dilipbiswal/repos","events_url":"https://api.github.com/users/dilipbiswal/events{/privacy}","received_events_url":"https://api.github.com/users/dilipbiswal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-03-09T02:19:57Z","updated_at":"2016-03-14T13:39:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/11596","html_url":"https://github.com/apache/spark/pull/11596","diff_url":"https://github.com/apache/spark/pull/11596.diff","patch_url":"https://github.com/apache/spark/pull/11596.patch"},"body":"## What changes were proposed in this pull request?\r\nThis is a alternate way to convert SQL from analyzed logical plans containing Generate operator.\r\nIn this PR , generators in projection list are expressed as LATERAL VIEW.\r\n\r\nSample Plan :\r\n```\r\nGlobalLimit 3\r\n+- LocalLimit 3\r\n   +- Project [gencol2#204]\r\n      +- Generate explode(gencol1#203), true, false, Some(gentab2), [gencol2#204]\r\n         +- Generate explode(array(array(1, 2, 3))), true, false, Some(gentab1), [gencol1#203]\r\n            +- MetastoreRelation default, t4, None\r\n```\r\nGenerated Query:\r\n\r\n```\r\nSELECT `gentab2`.`gencol2` FROM `default`.`t4` LATERAL VIEW explode(array(array(1, 2, 3))) `gentab1` AS `gencol1` LATERAL VIEW explode(`gentab1`.`gencol1`) `gentab2` AS `gencol2` LIMIT 3\r\n```\r\n\r\n\r\n## How was this patch tested?\r\n\r\nTests added to LogicalPlanToSQLSuite\r\n\r\n(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/196313956","html_url":"https://github.com/apache/spark/pull/11596#issuecomment-196313956","issue_url":"https://api.github.com/repos/apache/spark/issues/11596","id":196313956,"user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T13:39:19Z","updated_at":"2016-03-14T13:39:19Z","body":"Hi @dilipbiswal , sorry that recently I made a major refactor to `SQLBuilder`, and it changed some assumptions to the `Generate` SQL generation, so I took over your PR and send a new one with some simplification: #11696, do you mind taking a look?"}}