{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/5833","labels_url":"https://api.github.com/repos/apache/spark/issues/5833/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/5833/comments","events_url":"https://api.github.com/repos/apache/spark/issues/5833/events","html_url":"https://github.com/apache/spark/pull/5833","id":72388769,"number":5833,"title":"[SPARK-7299][SQL] Set precision and scale for Decimal according to JDBC metadata instead of returned BigDecimal","user":{"login":"viirya","id":68855,"avatar_url":"https://avatars.githubusercontent.com/u/68855?v=3","gravatar_id":"","url":"https://api.github.com/users/viirya","html_url":"https://github.com/viirya","followers_url":"https://api.github.com/users/viirya/followers","following_url":"https://api.github.com/users/viirya/following{/other_user}","gists_url":"https://api.github.com/users/viirya/gists{/gist_id}","starred_url":"https://api.github.com/users/viirya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viirya/subscriptions","organizations_url":"https://api.github.com/users/viirya/orgs","repos_url":"https://api.github.com/users/viirya/repos","events_url":"https://api.github.com/users/viirya/events{/privacy}","received_events_url":"https://api.github.com/users/viirya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":36,"created_at":"2015-05-01T09:03:47Z","updated_at":"2015-05-16T10:54:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5833","html_url":"https://github.com/apache/spark/pull/5833","diff_url":"https://github.com/apache/spark/pull/5833.diff","patch_url":"https://github.com/apache/spark/pull/5833.patch"},"body":"JIRA: https://issues.apache.org/jira/browse/SPARK-7299\r\n\r\nWhen connecting with oracle db through jdbc, the precision and scale of `BigDecimal` object returned by `ResultSet.getBigDecimal` is not correctly matched to the table schema reported by `ResultSetMetaData.getPrecision` and `ResultSetMetaData.getScale`.\r\n\r\nSo in case you insert a value like `19999` into a column with `NUMBER(12, 2)` type, you get through a `BigDecimal` object with scale as 0. But the dataframe schema has correct type as `DecimalType(12, 2)`. Thus, after you save the dataframe into parquet file and then retrieve it, you will get wrong result `199.99`.\r\n\r\nBecause it is reported to be problematic on jdbc connection with oracle db. It might be difficult to add test case for it. But according to the user's test on JIRA, it solves this problem."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/102607849","html_url":"https://github.com/apache/spark/pull/5833#issuecomment-102607849","issue_url":"https://api.github.com/repos/apache/spark/issues/5833","id":102607849,"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-16T10:54:55Z","updated_at":"2015-05-16T10:54:55Z","body":"Merged build finished. Test PASSed."}}