{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/9840","labels_url":"https://api.github.com/repos/apache/spark/issues/9840/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/9840/comments","events_url":"https://api.github.com/repos/apache/spark/issues/9840/events","html_url":"https://github.com/apache/spark/pull/9840","id":117859965,"number":9840,"title":"[SPARK-11856][SQL] add type cast if the real type is different but compatible with encoder schema","user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-11-19T17:09:11Z","updated_at":"2015-12-01T02:20:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/9840","html_url":"https://github.com/apache/spark/pull/9840","diff_url":"https://github.com/apache/spark/pull/9840.diff","patch_url":"https://github.com/apache/spark/pull/9840.patch"},"body":"When we build the `fromRowExpression` for an encoder, we set up a lot of \"unresolved\" stuff and lost the required data type, which may lead to runtime error if the real type doesn't match the encoder's schema.\r\nFor example, we build an encoder for `case class Data(a: Int, b: String)` and the real type is `[a: int, b: long]`, then we will hit runtime error and say that we can't construct class `Data` with int and long, because we lost the information that `b` should be a string."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/160826945","html_url":"https://github.com/apache/spark/pull/9840#issuecomment-160826945","issue_url":"https://api.github.com/repos/apache/spark/issues/9840","id":160826945,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","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":"2015-12-01T02:20:41Z","updated_at":"2015-12-01T02:20:41Z","body":"**[Test build #46927 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/46927/consoleFull)** for PR 9840 at commit [`57b0d7e`](https://github.com/apache/spark/commit/57b0d7e5df19d7eda1fcc3ac54f6d3f96890d366)."}}