{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/22788","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/22788/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/22788/comments","events_url":"https://api.github.com/repos/apache/spark/issues/22788/events","html_url":"https://github.com/apache/spark/pull/22788","id":372331817,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NTUyNTAw","number":22788,"title":"[SPARK-25769][SQL]escape nested columns by backtick each of the column name","user":{"login":"huaxingao","id":13592258,"node_id":"MDQ6VXNlcjEzNTkyMjU4","avatar_url":"https://avatars3.githubusercontent.com/u/13592258?v=4","gravatar_id":"","url":"https://api.github.com/users/huaxingao","html_url":"https://github.com/huaxingao","followers_url":"https://api.github.com/users/huaxingao/followers","following_url":"https://api.github.com/users/huaxingao/following{/other_user}","gists_url":"https://api.github.com/users/huaxingao/gists{/gist_id}","starred_url":"https://api.github.com/users/huaxingao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huaxingao/subscriptions","organizations_url":"https://api.github.com/users/huaxingao/orgs","repos_url":"https://api.github.com/users/huaxingao/repos","events_url":"https://api.github.com/users/huaxingao/events{/privacy}","received_events_url":"https://api.github.com/users/huaxingao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-10-21T16:24:32Z","updated_at":"2018-10-23T06:47:58Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/22788","html_url":"https://github.com/apache/spark/pull/22788","diff_url":"https://github.com/apache/spark/pull/22788.diff","patch_url":"https://github.com/apache/spark/pull/22788.patch"},"body":"## What changes were proposed in this pull request?\r\nCurrently, the nested columns are not escaped correctly:\r\n```\r\nscala> $\"a.b\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres0: String = `a.b`\r\n\r\nscala> $\"`a.b`\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres1: String = `a.b`   // ambiguous\r\n\r\nscala> $\"`a`.b\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres2: String = `a.b`    // ambiquous\r\n\r\nscala> $\"`a.b`.c\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres3: String = ```a.b``.c`    // two verbose\r\n```\r\nIt should be something as the following:\r\n```\r\nscala> $\"a.b\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres0: String = `a`.`b`\r\n\r\nscala> $\"`a.b`\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres1: String = `a.b`\r\n\r\nscala> $\"`a`.b\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres2: String = `a`.`b`\r\n\r\nscala> $\"`a.b`.c\".expr.asInstanceOf[org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute].sql\r\nres3: String = `a.b`.`c`\r\n```\r\n\r\n\r\n\r\n\r\n## How was this patch tested?\r\nAdd test\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/432115815","html_url":"https://github.com/apache/spark/pull/22788#issuecomment-432115815","issue_url":"https://api.github.com/repos/apache/spark/issues/22788","id":432115815,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjExNTgxNQ==","user":{"login":"cloud-fan","id":3182036,"node_id":"MDQ6VXNlcjMxODIwMzY=","avatar_url":"https://avatars3.githubusercontent.com/u/3182036?v=4","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":"2018-10-23T06:47:58Z","updated_at":"2018-10-23T06:47:58Z","author_association":"CONTRIBUTOR","body":"Yea I think so, we can even use JSON to be safer. e.g. for `a.b.c.d`, we can encode it as a json array [a,b,c,d]. At data source side, use a json parser to read it back."}}
{"actor":{"display_login":"cloud-fan"}}