{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/13632","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/13632/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/13632/comments","events_url":"https://api.github.com/repos/apache/spark/issues/13632/events","html_url":"https://github.com/apache/spark/pull/13632","id":159870717,"number":13632,"title":"[SPARK-15910][SQL] Check schema consistency when using Kryo encoder to convert DataFrame to Dataset","user":{"login":"clockfly","id":2595532,"avatar_url":"https://avatars.githubusercontent.com/u/2595532?v=3","gravatar_id":"","url":"https://api.github.com/users/clockfly","html_url":"https://github.com/clockfly","followers_url":"https://api.github.com/users/clockfly/followers","following_url":"https://api.github.com/users/clockfly/following{/other_user}","gists_url":"https://api.github.com/users/clockfly/gists{/gist_id}","starred_url":"https://api.github.com/users/clockfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockfly/subscriptions","organizations_url":"https://api.github.com/users/clockfly/orgs","repos_url":"https://api.github.com/users/clockfly/repos","events_url":"https://api.github.com/users/clockfly/events{/privacy}","received_events_url":"https://api.github.com/users/clockfly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-06-13T04:17:01Z","updated_at":"2016-06-14T00:44:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/13632","html_url":"https://github.com/apache/spark/pull/13632","diff_url":"https://github.com/apache/spark/pull/13632.diff","patch_url":"https://github.com/apache/spark/pull/13632.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nThis PR enforces schema check when converting DataFrame to Dataset using Kryo encoder. For example.\r\n\r\n**Before the change:**\r\n\r\nSchema is NOT checked when converting DataFrame to Dataset using kryo encoder.\r\n```\r\nscala> case class B(b: Int)\r\nscala> implicit val encoder = Encoders.kryo[B]\r\nscala> val df = Seq((1)).toDF(\"b\")\r\nscala> val ds = df.as[B] // Schema compatibility is NOT checked\r\n```\r\n\r\n**After the change:**\r\nReport AnalysisException since the schema is NOT compatible. \r\n```\r\nscala> val ds = Seq((1)).toDF(\"b\").as[B]\r\norg.apache.spark.sql.AnalysisException: cannot resolve 'CAST(`b` AS BINARY)' due to data type mismatch: cannot cast IntegerType to BinaryType;\r\n...\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nUnit test.\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/225750417","html_url":"https://github.com/apache/spark/pull/13632#issuecomment-225750417","issue_url":"https://api.github.com/repos/apache/spark/issues/13632","id":225750417,"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},"created_at":"2016-06-14T00:44:50Z","updated_at":"2016-06-14T00:44:50Z","body":"thanks, merging to master/2.0"}}
{"actor":{"display_login":"cloud-fan"}}