{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/34649502","id":34649502,"diff_hunk":"@@ -520,3 +522,202 @@ case class Logarithm(left: Expression, right: Expression)\n     \"\"\"\n   }\n }\n+\n+/**\n+ * Round the `child`'s result to `scale` decimal place when `scale` >= 0\n+ * or round at integral part when `scale` < 0.\n+ * For example, round(31.415, 2) would eval to 31.42 and round(31.415, -1) would eval to 30.\n+ *\n+ * Child of IntegralType would eval to itself when `scale` >= 0.\n+ * Child of FractionalType whose value is NaN or Infinite would always eval to itself.\n+ *\n+ * Round's dataType would always equal to `child`'s dataType except for [[DecimalType.Fixed]],\n+ * which leads to scale update in DecimalType's [[PrecisionInfo]]\n+ *\n+ * @param child expr to be round, all [[NumericType]] is allowed as Input\n+ * @param scale new scale to be round to, this should be a constant int at runtime\n+ */\n+case class Round(child: Expression, scale: Expression)\n+  extends BinaryExpression with ExpectsInputTypes {","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala","position":32,"original_position":32,"commit_id":"07a124c4ac57e933d9b645fc43953dc035bab147","original_commit_id":"07a124c4ac57e933d9b645fc43953dc035bab147","user":{"login":"rxin","id":323388,"avatar_url":"https://avatars.githubusercontent.com/u/323388?v=3","gravatar_id":"","url":"https://api.github.com/users/rxin","html_url":"https://github.com/rxin","followers_url":"https://api.github.com/users/rxin/followers","following_url":"https://api.github.com/users/rxin/following{/other_user}","gists_url":"https://api.github.com/users/rxin/gists{/gist_id}","starred_url":"https://api.github.com/users/rxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxin/subscriptions","organizations_url":"https://api.github.com/users/rxin/orgs","repos_url":"https://api.github.com/users/rxin/repos","events_url":"https://api.github.com/users/rxin/events{/privacy}","received_events_url":"https://api.github.com/users/rxin/received_events","type":"User","site_admin":false},"body":"ExpectsInputTypes -> ImplicitCastInputTypes","created_at":"2015-07-15T06:35:17Z","updated_at":"2015-07-15T06:35:17Z","html_url":"https://github.com/apache/spark/pull/6938#discussion_r34649502","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/6938","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/34649502"},"html":{"href":"https://github.com/apache/spark/pull/6938#discussion_r34649502"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/6938"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/6938","id":38258604,"html_url":"https://github.com/apache/spark/pull/6938","diff_url":"https://github.com/apache/spark/pull/6938.diff","patch_url":"https://github.com/apache/spark/pull/6938.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/6938","number":6938,"state":"closed","locked":false,"title":"[SPARK-8279][SQL]Add math function round","user":{"login":"yijieshen","id":1387718,"avatar_url":"https://avatars.githubusercontent.com/u/1387718?v=3","gravatar_id":"","url":"https://api.github.com/users/yijieshen","html_url":"https://github.com/yijieshen","followers_url":"https://api.github.com/users/yijieshen/followers","following_url":"https://api.github.com/users/yijieshen/following{/other_user}","gists_url":"https://api.github.com/users/yijieshen/gists{/gist_id}","starred_url":"https://api.github.com/users/yijieshen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yijieshen/subscriptions","organizations_url":"https://api.github.com/users/yijieshen/orgs","repos_url":"https://api.github.com/users/yijieshen/repos","events_url":"https://api.github.com/users/yijieshen/events{/privacy}","received_events_url":"https://api.github.com/users/yijieshen/received_events","type":"User","site_admin":false},"body":"JIRA: https://issues.apache.org/jira/browse/SPARK-8279","created_at":"2015-06-22T18:01:58Z","updated_at":"2015-07-15T06:35:17Z","closed_at":"2015-07-15T06:31:49Z","merged_at":null,"merge_commit_sha":"bc542dc11e0ae123804794b10f8c87992215cf50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/6938/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/6938/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/6938/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/07a124c4ac57e933d9b645fc43953dc035bab147","head":{"label":"yijieshen:udf_round_3","ref":"udf_round_3","sha":"07a124c4ac57e933d9b645fc43953dc035bab147","user":{"login":"yijieshen","id":1387718,"avatar_url":"https://avatars.githubusercontent.com/u/1387718?v=3","gravatar_id":"","url":"https://api.github.com/users/yijieshen","html_url":"https://github.com/yijieshen","followers_url":"https://api.github.com/users/yijieshen/followers","following_url":"https://api.github.com/users/yijieshen/following{/other_user}","gists_url":"https://api.github.com/users/yijieshen/gists{/gist_id}","starred_url":"https://api.github.com/users/yijieshen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yijieshen/subscriptions","organizations_url":"https://api.github.com/users/yijieshen/orgs","repos_url":"https://api.github.com/users/yijieshen/repos","events_url":"https://api.github.com/users/yijieshen/events{/privacy}","received_events_url":"https://api.github.com/users/yijieshen/received_events","type":"User","site_admin":false},"repo":{"id":32433144,"name":"spark","full_name":"yijieshen/spark","owner":{"login":"yijieshen","id":1387718,"avatar_url":"https://avatars.githubusercontent.com/u/1387718?v=3","gravatar_id":"","url":"https://api.github.com/users/yijieshen","html_url":"https://github.com/yijieshen","followers_url":"https://api.github.com/users/yijieshen/followers","following_url":"https://api.github.com/users/yijieshen/following{/other_user}","gists_url":"https://api.github.com/users/yijieshen/gists{/gist_id}","starred_url":"https://api.github.com/users/yijieshen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yijieshen/subscriptions","organizations_url":"https://api.github.com/users/yijieshen/orgs","repos_url":"https://api.github.com/users/yijieshen/repos","events_url":"https://api.github.com/users/yijieshen/events{/privacy}","received_events_url":"https://api.github.com/users/yijieshen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yijieshen/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/yijieshen/spark","forks_url":"https://api.github.com/repos/yijieshen/spark/forks","keys_url":"https://api.github.com/repos/yijieshen/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yijieshen/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yijieshen/spark/teams","hooks_url":"https://api.github.com/repos/yijieshen/spark/hooks","issue_events_url":"https://api.github.com/repos/yijieshen/spark/issues/events{/number}","events_url":"https://api.github.com/repos/yijieshen/spark/events","assignees_url":"https://api.github.com/repos/yijieshen/spark/assignees{/user}","branches_url":"https://api.github.com/repos/yijieshen/spark/branches{/branch}","tags_url":"https://api.github.com/repos/yijieshen/spark/tags","blobs_url":"https://api.github.com/repos/yijieshen/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yijieshen/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yijieshen/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/yijieshen/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yijieshen/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/yijieshen/spark/languages","stargazers_url":"https://api.github.com/repos/yijieshen/spark/stargazers","contributors_url":"https://api.github.com/repos/yijieshen/spark/contributors","subscribers_url":"https://api.github.com/repos/yijieshen/spark/subscribers","subscription_url":"https://api.github.com/repos/yijieshen/spark/subscription","commits_url":"https://api.github.com/repos/yijieshen/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/yijieshen/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/yijieshen/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/yijieshen/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/yijieshen/spark/contents/{+path}","compare_url":"https://api.github.com/repos/yijieshen/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yijieshen/spark/merges","archive_url":"https://api.github.com/repos/yijieshen/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yijieshen/spark/downloads","issues_url":"https://api.github.com/repos/yijieshen/spark/issues{/number}","pulls_url":"https://api.github.com/repos/yijieshen/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/yijieshen/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/yijieshen/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yijieshen/spark/labels{/name}","releases_url":"https://api.github.com/repos/yijieshen/spark/releases{/id}","created_at":"2015-03-18T02:27:58Z","updated_at":"2015-05-02T04:50:02Z","pushed_at":"2015-07-15T06:21:53Z","git_url":"git://github.com/yijieshen/spark.git","ssh_url":"git@github.com:yijieshen/spark.git","clone_url":"https://github.com/yijieshen/spark.git","svn_url":"https://github.com/yijieshen/spark","homepage":null,"size":112815,"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":"408b384de96b9dbe94945753f7947fbe84272ae1","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}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-07-15T05:29:23Z","pushed_at":"2015-07-15T06:31:09Z","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":1516960,"stargazers_count":4755,"watchers_count":4755,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4233,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":340,"forks":4233,"open_issues":340,"watchers":4755,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/6938"},"html":{"href":"https://github.com/apache/spark/pull/6938"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/6938"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/6938/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/6938/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/6938/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/07a124c4ac57e933d9b645fc43953dc035bab147"}}}}