{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/67225998","id":67225998,"diff_hunk":"@@ -199,9 +201,18 @@ class TypeCoercionSuite extends PlanTest {\n   }\n \n   private def ruleTest(rule: Rule[LogicalPlan], initial: Expression, transformed: Expression) {\n+    ruleTest(Seq(rule), initial, transformed)\n+  }\n+\n+  private def ruleTest(\n+      rules: Seq[Rule[LogicalPlan]], initial: Expression, transformed: Expression): Unit = {","path":"sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala","position":22,"original_position":22,"commit_id":"2589b57d5b78cb82f3806242e8ee0f87a88accb7","original_commit_id":"2589b57d5b78cb82f3806242e8ee0f87a88accb7","user":{"login":"hvanhovell","id":9616802,"avatar_url":"https://avatars.githubusercontent.com/u/9616802?v=3","gravatar_id":"","url":"https://api.github.com/users/hvanhovell","html_url":"https://github.com/hvanhovell","followers_url":"https://api.github.com/users/hvanhovell/followers","following_url":"https://api.github.com/users/hvanhovell/following{/other_user}","gists_url":"https://api.github.com/users/hvanhovell/gists{/gist_id}","starred_url":"https://api.github.com/users/hvanhovell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvanhovell/subscriptions","organizations_url":"https://api.github.com/users/hvanhovell/orgs","repos_url":"https://api.github.com/users/hvanhovell/repos","events_url":"https://api.github.com/users/hvanhovell/events{/privacy}","received_events_url":"https://api.github.com/users/hvanhovell/received_events","type":"User","site_admin":false},"body":"NIT: one argument per line","created_at":"2016-06-15T19:08:03Z","updated_at":"2016-06-15T19:08:03Z","html_url":"https://github.com/apache/spark/pull/13651#discussion_r67225998","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/13651","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/67225998"},"html":{"href":"https://github.com/apache/spark/pull/13651#discussion_r67225998"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/13651"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/13651","id":73652560,"html_url":"https://github.com/apache/spark/pull/13651","diff_url":"https://github.com/apache/spark/pull/13651.diff","patch_url":"https://github.com/apache/spark/pull/13651.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/13651","number":13651,"state":"open","locked":false,"title":"[SPARK-15776][SQL] Divide Expression inside Aggregation function is casted to wrong type","user":{"login":"clockfly","id":2595532,"avatar_url":"https://avatars.githubusercontent.com/u/2595532?v=3","gravatar_id":"","url":"https://api.github.com/users/clockfly","html_url":"https://github.com/clockfly","followers_url":"https://api.github.com/users/clockfly/followers","following_url":"https://api.github.com/users/clockfly/following{/other_user}","gists_url":"https://api.github.com/users/clockfly/gists{/gist_id}","starred_url":"https://api.github.com/users/clockfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockfly/subscriptions","organizations_url":"https://api.github.com/users/clockfly/orgs","repos_url":"https://api.github.com/users/clockfly/repos","events_url":"https://api.github.com/users/clockfly/events{/privacy}","received_events_url":"https://api.github.com/users/clockfly/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nThis PR fixes the problem that Divide Expression inside Aggregation function is casted to wrong type, which cause `select 1/2` and `select sum(1/2)`returning different result.\r\n\r\n**Before the change:**\r\n\r\n```\r\nscala> sql(\"select 1/2 as a\").show()\r\n+---+\r\n|  a|\r\n+---+\r\n|0.5|\r\n+---+\r\n\r\nscala> sql(\"select sum(1/2) as a\").show()\r\n+---+\r\n|  a|\r\n+---+\r\n|0  |\r\n+---+\r\n\r\nscala> sql(\"select sum(1 / 2) as a\").schema\r\nres4: org.apache.spark.sql.types.StructType = StructType(StructField(a,LongType,true))\r\n```\r\n\r\n**After the change:**\r\n\r\n```\r\nscala> sql(\"select 1/2 as a\").show()\r\n+---+\r\n|  a|\r\n+---+\r\n|0.5|\r\n+---+\r\n\r\nscala> sql(\"select sum(1/2) as a\").show()\r\n+---+\r\n|  a|\r\n+---+\r\n|0.5|\r\n+---+\r\n\r\nscala> sql(\"select sum(1/2) as a\").schema\r\nres4: org.apache.spark.sql.types.StructType = StructType(StructField(a,DoubleType,true))\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nUnit test.\r\n\r\nThis PR is based on https://github.com/apache/spark/pull/13524 by @Sephiroth-Lin","created_at":"2016-06-13T22:18:44Z","updated_at":"2016-06-15T19:08:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f41eed7d463fcde16e80ada5d633d3184379ff66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/13651/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/13651/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/13651/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/2589b57d5b78cb82f3806242e8ee0f87a88accb7","head":{"label":"clockfly:SPARK-15776","ref":"SPARK-15776","sha":"2589b57d5b78cb82f3806242e8ee0f87a88accb7","user":{"login":"clockfly","id":2595532,"avatar_url":"https://avatars.githubusercontent.com/u/2595532?v=3","gravatar_id":"","url":"https://api.github.com/users/clockfly","html_url":"https://github.com/clockfly","followers_url":"https://api.github.com/users/clockfly/followers","following_url":"https://api.github.com/users/clockfly/following{/other_user}","gists_url":"https://api.github.com/users/clockfly/gists{/gist_id}","starred_url":"https://api.github.com/users/clockfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockfly/subscriptions","organizations_url":"https://api.github.com/users/clockfly/orgs","repos_url":"https://api.github.com/users/clockfly/repos","events_url":"https://api.github.com/users/clockfly/events{/privacy}","received_events_url":"https://api.github.com/users/clockfly/received_events","type":"User","site_admin":false},"repo":{"id":57937220,"name":"spark","full_name":"clockfly/spark","owner":{"login":"clockfly","id":2595532,"avatar_url":"https://avatars.githubusercontent.com/u/2595532?v=3","gravatar_id":"","url":"https://api.github.com/users/clockfly","html_url":"https://github.com/clockfly","followers_url":"https://api.github.com/users/clockfly/followers","following_url":"https://api.github.com/users/clockfly/following{/other_user}","gists_url":"https://api.github.com/users/clockfly/gists{/gist_id}","starred_url":"https://api.github.com/users/clockfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockfly/subscriptions","organizations_url":"https://api.github.com/users/clockfly/orgs","repos_url":"https://api.github.com/users/clockfly/repos","events_url":"https://api.github.com/users/clockfly/events{/privacy}","received_events_url":"https://api.github.com/users/clockfly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clockfly/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/clockfly/spark","forks_url":"https://api.github.com/repos/clockfly/spark/forks","keys_url":"https://api.github.com/repos/clockfly/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clockfly/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clockfly/spark/teams","hooks_url":"https://api.github.com/repos/clockfly/spark/hooks","issue_events_url":"https://api.github.com/repos/clockfly/spark/issues/events{/number}","events_url":"https://api.github.com/repos/clockfly/spark/events","assignees_url":"https://api.github.com/repos/clockfly/spark/assignees{/user}","branches_url":"https://api.github.com/repos/clockfly/spark/branches{/branch}","tags_url":"https://api.github.com/repos/clockfly/spark/tags","blobs_url":"https://api.github.com/repos/clockfly/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clockfly/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clockfly/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/clockfly/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clockfly/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/clockfly/spark/languages","stargazers_url":"https://api.github.com/repos/clockfly/spark/stargazers","contributors_url":"https://api.github.com/repos/clockfly/spark/contributors","subscribers_url":"https://api.github.com/repos/clockfly/spark/subscribers","subscription_url":"https://api.github.com/repos/clockfly/spark/subscription","commits_url":"https://api.github.com/repos/clockfly/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/clockfly/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/clockfly/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/clockfly/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/clockfly/spark/contents/{+path}","compare_url":"https://api.github.com/repos/clockfly/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clockfly/spark/merges","archive_url":"https://api.github.com/repos/clockfly/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clockfly/spark/downloads","issues_url":"https://api.github.com/repos/clockfly/spark/issues{/number}","pulls_url":"https://api.github.com/repos/clockfly/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/clockfly/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/clockfly/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clockfly/spark/labels{/name}","releases_url":"https://api.github.com/repos/clockfly/spark/releases{/id}","deployments_url":"https://api.github.com/repos/clockfly/spark/deployments","created_at":"2016-05-03T02:58:50Z","updated_at":"2016-05-03T02:59:11Z","pushed_at":"2016-06-15T18:42:48Z","git_url":"git://github.com/clockfly/spark.git","ssh_url":"git@github.com:clockfly/spark.git","clone_url":"https://github.com/clockfly/spark.git","svn_url":"https://github.com/clockfly/spark","homepage":null,"size":177037,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"dae4d5db21368faaa46fa8d1a256c27428694c2c","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-06-15T15:36:19Z","pushed_at":"2016-06-15T19:03:17Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":495265,"stargazers_count":8927,"watchers_count":8927,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8294,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":442,"forks":8294,"open_issues":442,"watchers":8927,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/13651"},"html":{"href":"https://github.com/apache/spark/pull/13651"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/13651"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/13651/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/13651/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/13651/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/2589b57d5b78cb82f3806242e8ee0f87a88accb7"}}}}
{"actor":{"display_login":"hvanhovell"}}