Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5865#discussion_r29553258
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -194,12 +195,34 @@ class DataFrame private[sql](
}
}
- // Pad the cells
- rows.map { row =>
- row.zipWithIndex.map { case (cell, i) =>
- String.format(s"%-${colWidths(i)}s", cell)
- }.mkString(" ")
- }.mkString("\n")
+ // Create SeparateLine
+ val sep:String = {
+ "+" + colWidths.map {
+ size =>
+ val columnSep = new Array[Char](size)
+ for (i <- 0 until size)
+ columnSep(i) = '-'
+ String.valueOf(columnSep)
+ }.mkString("+") + "+\n"
+ }
+
+ sb.append(sep)
+
+ // append column names
+ sb.append("|").append(rows.head.zipWithIndex.map { case (cell, i) =>
+ String.format(s"%${colWidths(i)}s", cell)
+ }.mkString("|")).append("|\n")
--- End diff --
indentation here is off, and it is very confusing to have it wrapping this
way
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]