{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/10215","labels_url":"https://api.github.com/repos/apache/spark/issues/10215/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/10215/comments","events_url":"https://api.github.com/repos/apache/spark/issues/10215/events","html_url":"https://github.com/apache/spark/pull/10215","id":121156250,"number":10215,"title":"[SPARK-12164] [SQL] Decode the encoded values and then display","user":{"login":"gatorsmile","id":11567269,"avatar_url":"https://avatars.githubusercontent.com/u/11567269?v=3","gravatar_id":"","url":"https://api.github.com/users/gatorsmile","html_url":"https://github.com/gatorsmile","followers_url":"https://api.github.com/users/gatorsmile/followers","following_url":"https://api.github.com/users/gatorsmile/following{/other_user}","gists_url":"https://api.github.com/users/gatorsmile/gists{/gist_id}","starred_url":"https://api.github.com/users/gatorsmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gatorsmile/subscriptions","organizations_url":"https://api.github.com/users/gatorsmile/orgs","repos_url":"https://api.github.com/users/gatorsmile/repos","events_url":"https://api.github.com/users/gatorsmile/events{/privacy}","received_events_url":"https://api.github.com/users/gatorsmile/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-09T04:14:03Z","updated_at":"2015-12-15T08:33:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/10215","html_url":"https://github.com/apache/spark/pull/10215","diff_url":"https://github.com/apache/spark/pull/10215.diff","patch_url":"https://github.com/apache/spark/pull/10215.patch"},"body":"Based on the suggestions from @marmbrus @cloud-fan in https://github.com/apache/spark/pull/10165 , this PR is to print the decoded values(user objects) in `Dataset.show`\r\n```scala\r\n    implicit val kryoEncoder = Encoders.kryo[KryoClassData]\r\n    val ds = Seq(KryoClassData(\"a\", 1), KryoClassData(\"b\", 2), KryoClassData(\"c\", 3)).toDS()\r\n    ds.show(20, false);\r\n```\r\nThe current output is like \r\n```\r\n+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n|value                                                                                                                                                                                 |\r\n+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n|[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 97, 116, -31, 1, 1, -126, 97, 2]|\r\n|[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 97, 116, -31, 1, 1, -126, 98, 4]|\r\n|[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 97, 116, -31, 1, 1, -126, 99, 6]|\r\n+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n```\r\nAfter the fix, it will be like the below if and only if the users override the `toString` function in the class `KryoClassData`  \r\n```scala\r\noverride def toString: String = s\"KryoClassData($a, $b)\"\r\n```\r\n```\r\n+-------------------+\r\n|value              |\r\n+-------------------+\r\n|KryoClassData(a, 1)|\r\n|KryoClassData(b, 2)|\r\n|KryoClassData(c, 3)|\r\n+-------------------+\r\n```\r\n\r\n\r\nIf users do not override the `toString` function, the results will be like \r\n```\r\n+---------------------------------------+\r\n|value                                  |\r\n+---------------------------------------+\r\n|org.apache.spark.sql.KryoClassData@68ef|\r\n|org.apache.spark.sql.KryoClassData@6915|\r\n|org.apache.spark.sql.KryoClassData@693b|\r\n+---------------------------------------+\r\n```\r\n\r\nQuestion: Should we add another optional parameter in the function `show`? It will decide if the function `show` will display the hex values or the object values?"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/164683537","html_url":"https://github.com/apache/spark/pull/10215#issuecomment-164683537","issue_url":"https://api.github.com/repos/apache/spark/issues/10215","id":164683537,"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-12-15T08:33:12Z","updated_at":"2015-12-15T08:33:12Z","body":"Merged build finished. Test PASSed."}}