{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/29553257","id":29553257,"diff_hunk":"@@ -194,12 +195,34 @@ class DataFrame private[sql](\n       }\n     }\n \n-    // Pad the cells\n-    rows.map { row =>\n-      row.zipWithIndex.map { case (cell, i) =>\n-        String.format(s\"%-${colWidths(i)}s\", cell)\n-      }.mkString(\" \")\n-    }.mkString(\"\\n\")\n+    // Create SeparateLine\n+    val sep:String = {\n+      \"+\" + colWidths.map {\n+        size =>\n+          val columnSep = new Array[Char](size)\n+          for (i <- 0 until size)\n+            columnSep(i) = '-'\n+          String.valueOf(columnSep)\n+      }.mkString(\"+\") + \"+\\n\"\n+    }\n+\n+    sb.append(sep)\n+\n+    // append column names\n+    sb.append(\"|\").append(rows.head.zipWithIndex.map { case (cell, i) =>\n+        String.format(s\"%${colWidths(i)}s\", cell)","path":"sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala","position":33,"original_position":33,"commit_id":"7394fd523d4e5291d3c051def14576c3137ee295","original_commit_id":"7394fd523d4e5291d3c051def14576c3137ee295","user":{"login":"rxin","id":323388,"avatar_url":"https://avatars.githubusercontent.com/u/323388?v=3","gravatar_id":"","url":"https://api.github.com/users/rxin","html_url":"https://github.com/rxin","followers_url":"https://api.github.com/users/rxin/followers","following_url":"https://api.github.com/users/rxin/following{/other_user}","gists_url":"https://api.github.com/users/rxin/gists{/gist_id}","starred_url":"https://api.github.com/users/rxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxin/subscriptions","organizations_url":"https://api.github.com/users/rxin/orgs","repos_url":"https://api.github.com/users/rxin/repos","events_url":"https://api.github.com/users/rxin/events{/privacy}","received_events_url":"https://api.github.com/users/rxin/received_events","type":"User","site_admin":false},"body":"maybe use the padding function on string directly, rather than doing the format.","created_at":"2015-05-03T05:33:52Z","updated_at":"2015-05-03T05:33:52Z","html_url":"https://github.com/apache/spark/pull/5865#discussion_r29553257","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/5865","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/29553257"},"html":{"href":"https://github.com/apache/spark/pull/5865#discussion_r29553257"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/5865"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5865","id":34586148,"html_url":"https://github.com/apache/spark/pull/5865","diff_url":"https://github.com/apache/spark/pull/5865.diff","patch_url":"https://github.com/apache/spark/pull/5865.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/5865","number":5865,"state":"open","locked":false,"title":"[SPARK-7319][SQL] Improve the output from DataFrame.show()","user":{"login":"kaka1992","id":3379043,"avatar_url":"https://avatars.githubusercontent.com/u/3379043?v=3","gravatar_id":"","url":"https://api.github.com/users/kaka1992","html_url":"https://github.com/kaka1992","followers_url":"https://api.github.com/users/kaka1992/followers","following_url":"https://api.github.com/users/kaka1992/following{/other_user}","gists_url":"https://api.github.com/users/kaka1992/gists{/gist_id}","starred_url":"https://api.github.com/users/kaka1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaka1992/subscriptions","organizations_url":"https://api.github.com/users/kaka1992/orgs","repos_url":"https://api.github.com/users/kaka1992/repos","events_url":"https://api.github.com/users/kaka1992/events{/privacy}","received_events_url":"https://api.github.com/users/kaka1992/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-02T14:07:36Z","updated_at":"2015-05-03T05:33:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ff11a2ea8c6ff826f9a6d9c33e5a8fbdf2bfe68","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/5865/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/5865/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/5865/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/7394fd523d4e5291d3c051def14576c3137ee295","head":{"label":"kaka1992:df.show","ref":"df.show","sha":"7394fd523d4e5291d3c051def14576c3137ee295","user":{"login":"kaka1992","id":3379043,"avatar_url":"https://avatars.githubusercontent.com/u/3379043?v=3","gravatar_id":"","url":"https://api.github.com/users/kaka1992","html_url":"https://github.com/kaka1992","followers_url":"https://api.github.com/users/kaka1992/followers","following_url":"https://api.github.com/users/kaka1992/following{/other_user}","gists_url":"https://api.github.com/users/kaka1992/gists{/gist_id}","starred_url":"https://api.github.com/users/kaka1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaka1992/subscriptions","organizations_url":"https://api.github.com/users/kaka1992/orgs","repos_url":"https://api.github.com/users/kaka1992/repos","events_url":"https://api.github.com/users/kaka1992/events{/privacy}","received_events_url":"https://api.github.com/users/kaka1992/received_events","type":"User","site_admin":false},"repo":{"id":32562603,"name":"spark","full_name":"kaka1992/spark","owner":{"login":"kaka1992","id":3379043,"avatar_url":"https://avatars.githubusercontent.com/u/3379043?v=3","gravatar_id":"","url":"https://api.github.com/users/kaka1992","html_url":"https://github.com/kaka1992","followers_url":"https://api.github.com/users/kaka1992/followers","following_url":"https://api.github.com/users/kaka1992/following{/other_user}","gists_url":"https://api.github.com/users/kaka1992/gists{/gist_id}","starred_url":"https://api.github.com/users/kaka1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaka1992/subscriptions","organizations_url":"https://api.github.com/users/kaka1992/orgs","repos_url":"https://api.github.com/users/kaka1992/repos","events_url":"https://api.github.com/users/kaka1992/events{/privacy}","received_events_url":"https://api.github.com/users/kaka1992/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaka1992/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/kaka1992/spark","forks_url":"https://api.github.com/repos/kaka1992/spark/forks","keys_url":"https://api.github.com/repos/kaka1992/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaka1992/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaka1992/spark/teams","hooks_url":"https://api.github.com/repos/kaka1992/spark/hooks","issue_events_url":"https://api.github.com/repos/kaka1992/spark/issues/events{/number}","events_url":"https://api.github.com/repos/kaka1992/spark/events","assignees_url":"https://api.github.com/repos/kaka1992/spark/assignees{/user}","branches_url":"https://api.github.com/repos/kaka1992/spark/branches{/branch}","tags_url":"https://api.github.com/repos/kaka1992/spark/tags","blobs_url":"https://api.github.com/repos/kaka1992/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaka1992/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaka1992/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaka1992/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaka1992/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/kaka1992/spark/languages","stargazers_url":"https://api.github.com/repos/kaka1992/spark/stargazers","contributors_url":"https://api.github.com/repos/kaka1992/spark/contributors","subscribers_url":"https://api.github.com/repos/kaka1992/spark/subscribers","subscription_url":"https://api.github.com/repos/kaka1992/spark/subscription","commits_url":"https://api.github.com/repos/kaka1992/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaka1992/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaka1992/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaka1992/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaka1992/spark/contents/{+path}","compare_url":"https://api.github.com/repos/kaka1992/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaka1992/spark/merges","archive_url":"https://api.github.com/repos/kaka1992/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaka1992/spark/downloads","issues_url":"https://api.github.com/repos/kaka1992/spark/issues{/number}","pulls_url":"https://api.github.com/repos/kaka1992/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/kaka1992/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/kaka1992/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaka1992/spark/labels{/name}","releases_url":"https://api.github.com/repos/kaka1992/spark/releases{/id}","created_at":"2015-03-20T04:34:21Z","updated_at":"2015-05-02T14:02:11Z","pushed_at":"2015-05-03T03:09:28Z","git_url":"git://github.com/kaka1992/spark.git","ssh_url":"git@github.com:kaka1992/spark.git","clone_url":"https://github.com/kaka1992/spark.git","svn_url":"https://github.com/kaka1992/spark","homepage":null,"size":103317,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"ecc6eb50a59172dc132bd8f97957734f6f009024","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-05-03T00:09:38Z","pushed_at":"2015-05-03T02:56:34Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1585722,"stargazers_count":3838,"watchers_count":3838,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3324,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":298,"forks":3324,"open_issues":298,"watchers":3838,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/5865"},"html":{"href":"https://github.com/apache/spark/pull/5865"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/5865"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/5865/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/5865/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/5865/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/7394fd523d4e5291d3c051def14576c3137ee295"}}}}