{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/14257","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/14257/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/14257/comments","events_url":"https://api.github.com/repos/apache/spark/issues/14257/events","html_url":"https://github.com/apache/spark/pull/14257","id":166266790,"number":14257,"title":"[SPARK-16621][SQL][WIP] Use a stable ID generation method for attributes in SQLBuilder","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,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-19T07:38:11Z","updated_at":"2016-07-24T05:15:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/14257","html_url":"https://github.com/apache/spark/pull/14257","diff_url":"https://github.com/apache/spark/pull/14257.diff","patch_url":"https://github.com/apache/spark/pull/14257.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nCurrently, the generated SQL has stable IDs for `subquery`, but not-stable IDs for `gen_attr`. This issue provides stable IDs for `gen_attr`, too.\r\n\r\nThe stable generated SQL will give more benefit for understanding or testing the queries.\r\n\r\n**Before**\r\n```scala\r\nscala> new org.apache.spark.sql.catalyst.SQLBuilder(sql(\"select 1\")).toSQL\r\nres0: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) AS gen_subquery_0\r\nscala> new org.apache.spark.sql.catalyst.SQLBuilder(sql(\"select 1\")).toSQL\r\nres1: String = SELECT `gen_attr_4` AS `1` FROM (SELECT 1 AS `gen_attr_4`) AS gen_subquery_0\r\n```\r\n\r\n**After**\r\n```scala\r\nscala> new org.apache.spark.sql.catalyst.SQLBuilder(sql(\"select 1\")).toSQL\r\nres1: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) AS gen_subquery_0\r\nscala> new org.apache.spark.sql.catalyst.SQLBuilder(sql(\"select 1\")).toSQL\r\nres2: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) AS gen_subquery_0\r\n```\r\n\r\nTODO:\r\n - [x] Make `gen_subquery_xxx` unique\r\n - [x] Provide stable `gen_attr_xxx`\r\n - [x] Provide internal pretty SQL formatter for **generated** SQLs\r\n - [ ] Pass the HiveCompatibilitySuite.\r\n\r\n## How was this patch tested?\r\n\r\nPass the existing Jenkins tests."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/234758323","html_url":"https://github.com/apache/spark/pull/14257#issuecomment-234758323","issue_url":"https://api.github.com/repos/apache/spark/issues/14257","id":234758323,"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-07-24T05:15:35Z","updated_at":"2016-07-24T05:15:35Z","body":"Test FAILed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62761/\nTest FAILed."}}
{"actor":{"display_login":"AmplabJenkins"}}