{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/22419","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/22419/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/22419/comments","events_url":"https://api.github.com/repos/apache/spark/issues/22419/events","html_url":"https://github.com/apache/spark/pull/22419","id":360206521,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NTE4NzE2","number":22419,"title":"[SPARK-23906][SQL] Add built-in UDF TRUNCATE(number)","user":{"login":"wangyum","id":5399861,"node_id":"MDQ6VXNlcjUzOTk4NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/5399861?v=4","gravatar_id":"","url":"https://api.github.com/users/wangyum","html_url":"https://github.com/wangyum","followers_url":"https://api.github.com/users/wangyum/followers","following_url":"https://api.github.com/users/wangyum/following{/other_user}","gists_url":"https://api.github.com/users/wangyum/gists{/gist_id}","starred_url":"https://api.github.com/users/wangyum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangyum/subscriptions","organizations_url":"https://api.github.com/users/wangyum/orgs","repos_url":"https://api.github.com/users/wangyum/repos","events_url":"https://api.github.com/users/wangyum/events{/privacy}","received_events_url":"https://api.github.com/users/wangyum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2018-09-14T08:30:15Z","updated_at":"2018-10-22T05:17:19Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/22419","html_url":"https://github.com/apache/spark/pull/22419","diff_url":"https://github.com/apache/spark/pull/22419.diff","patch_url":"https://github.com/apache/spark/pull/22419.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nAdd UDF `TRUNCATE(number)`:\r\n```sql\r\n> SELECT TRUNCATE(1234567891.1234567891, 4);\r\n 1234567891.1234\r\n> SELECT TRUNCATE(1234567891.1234567891, -4);\r\n 1234560000\r\n> SELECT TRUNCATE(1234567891.1234567891, 0);\r\n 1234567891\r\n> SELECT TRUNCATE(1234567891.1234567891);\r\n 1234567891\r\n```\r\n\r\nIt's similar to MySQL [TRUNCATE(X, D)](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_truncate)\r\n\r\n## How was this patch tested?\r\n\r\nunit tests\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/431742357","html_url":"https://github.com/apache/spark/pull/22419#issuecomment-431742357","issue_url":"https://api.github.com/repos/apache/spark/issues/22419","id":431742357,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTc0MjM1Nw==","user":{"login":"SparkQA","id":8108735,"node_id":"MDQ6VXNlcjgxMDg3MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/8108735?v=4","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2018-10-22T05:17:19Z","updated_at":"2018-10-22T05:17:19Z","author_association":"NONE","body":"**[Test build #97709 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/97709/testReport)** for PR 22419 at commit [`ae7eb73`](https://github.com/apache/spark/commit/ae7eb73a94815f396f576747712be72071257b28)."}}
{"actor":{"display_login":"SparkQA"}}