{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/22448","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/22448/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/22448/comments","events_url":"https://api.github.com/repos/apache/spark/issues/22448/events","html_url":"https://github.com/apache/spark/pull/22448","id":361149596,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2MTkzMTk0","number":22448,"title":"[SPARK-25417][SQL] Improve findTightestCommonType to coerce Integral and decimal types","user":{"login":"dilipbiswal","id":14225158,"node_id":"MDQ6VXNlcjE0MjI1MTU4","avatar_url":"https://avatars0.githubusercontent.com/u/14225158?v=4","gravatar_id":"","url":"https://api.github.com/users/dilipbiswal","html_url":"https://github.com/dilipbiswal","followers_url":"https://api.github.com/users/dilipbiswal/followers","following_url":"https://api.github.com/users/dilipbiswal/following{/other_user}","gists_url":"https://api.github.com/users/dilipbiswal/gists{/gist_id}","starred_url":"https://api.github.com/users/dilipbiswal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilipbiswal/subscriptions","organizations_url":"https://api.github.com/users/dilipbiswal/orgs","repos_url":"https://api.github.com/users/dilipbiswal/repos","events_url":"https://api.github.com/users/dilipbiswal/events{/privacy}","received_events_url":"https://api.github.com/users/dilipbiswal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-09-18T06:12:10Z","updated_at":"2018-09-18T19:13:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/22448","html_url":"https://github.com/apache/spark/pull/22448","diff_url":"https://github.com/apache/spark/pull/22448.diff","patch_url":"https://github.com/apache/spark/pull/22448.patch"},"body":"## What changes were proposed in this pull request?\r\nCurrently `findTightestCommonType` is not able to coerce between integral and decimal types properly. For example, while trying to find a common type between (int, decimal) , it is able to find a common type only when the number of digits to the left of decimal point of the decimal number is >= 10. This PR enhances the logic to to correctly find a wider decimal type between the integral and decimal types.\r\n\r\nHere are some examples of the result of `findTightestCommonType`\r\n```\r\nint, decimal(3, 2) => decimal(12, 2)\r\nint, decimal(4, 3) => decimal(13, 3)\r\nint, decimal(11, 3) => decimal(14, 3)\r\nint, decimal(38, 18) => decimal(38, 18)\r\nint, decimal(38, 29) => None \r\n```\r\n\r\n## How was this patch tested?\r\nAdded tests to TypeCoercionSuite."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/422513457","html_url":"https://github.com/apache/spark/pull/22448#issuecomment-422513457","issue_url":"https://api.github.com/repos/apache/spark/issues/22448","id":422513457,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjUxMzQ1Nw==","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-09-18T19:13:20Z","updated_at":"2018-09-18T19:13:20Z","author_association":"NONE","body":"**[Test build #96195 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/96195/testReport)** for PR 22448 at commit [`8104b1f`](https://github.com/apache/spark/commit/8104b1f0e6902755c8b0d93cd8a055784bc02dc7)."}}
{"actor":{"display_login":"SparkQA"}}