{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/5798","labels_url":"https://api.github.com/repos/apache/spark/issues/5798/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/5798/comments","events_url":"https://api.github.com/repos/apache/spark/issues/5798/events","html_url":"https://github.com/apache/spark/pull/5798","id":72042314,"number":5798,"title":"[SPARK-7269] [SQL] Incorrect analysis for aggregation","user":{"login":"chenghao-intel","id":2367031,"avatar_url":"https://avatars.githubusercontent.com/u/2367031?v=3","gravatar_id":"","url":"https://api.github.com/users/chenghao-intel","html_url":"https://github.com/chenghao-intel","followers_url":"https://api.github.com/users/chenghao-intel/followers","following_url":"https://api.github.com/users/chenghao-intel/following{/other_user}","gists_url":"https://api.github.com/users/chenghao-intel/gists{/gist_id}","starred_url":"https://api.github.com/users/chenghao-intel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenghao-intel/subscriptions","organizations_url":"https://api.github.com/users/chenghao-intel/orgs","repos_url":"https://api.github.com/users/chenghao-intel/repos","events_url":"https://api.github.com/users/chenghao-intel/events{/privacy}","received_events_url":"https://api.github.com/users/chenghao-intel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":63,"created_at":"2015-04-30T02:36:34Z","updated_at":"2015-05-10T16:22:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5798","html_url":"https://github.com/apache/spark/pull/5798","diff_url":"https://github.com/apache/spark/pull/5798.diff","patch_url":"https://github.com/apache/spark/pull/5798.patch"},"body":"https://issues.apache.org/jira/browse/SPARK-7269\r\nIn a case in-sensitive system, the `AttributeReference` object may not the same literally, as the `name` in different capital, however, in semantic it's should be identical, as after being resolved, the `exprId` is exactly the same.\r\n\r\nFor example:\r\n```\r\nSELECT kEy + 1 FROM src GROUP BY key+ 1\r\n```\r\nIt's actually a legal query in HiveContext(case insensitive), however, it will fail in `CheckAnalysis` as\r\n`Add(AttributeReference(\"key\"), Literal(1))` and\r\n`Add(AttributeReference(\"kEy\"), Literal(1))` are not identical in literal. As we have code\r\n```scala\r\ncase e if groupingExprs.contains(e) => // OK\r\n```\r\nin `CheckAnalysis.scala` for `Aggregate`, as well as in `patterns.scala` for partial aggregation.\r\n\r\nIn order not to confusing people by overwriting the method `AttributeReference.equals()`, we provide a utility classes for the equality checking purpose.\r\n\r\nIn long term, we probably need to refactor the `Expression` a little bit for supporting the `semanticEquals()` instead of `equals()`(literally equality checking)"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/100664631","html_url":"https://github.com/apache/spark/pull/5798#issuecomment-100664631","issue_url":"https://api.github.com/repos/apache/spark/issues/5798","id":100664631,"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":"2015-05-10T16:22:11Z","updated_at":"2015-05-10T16:22:11Z","body":" Merged build triggered."}}