mgaido91 commented on a change in pull request #24505: [SPARK-27607][SQL] 
Improve Row.toString performance
URL: https://github.com/apache/spark/pull/24505#discussion_r280113048
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala
 ##########
 @@ -465,16 +465,34 @@ trait Row extends Serializable {
   }
 
   /** Displays all elements of this sequence in a string (without a 
separator). */
-  def mkString: String = toSeq.mkString
+  def mkString: String = mkString("")
 
   /** Displays all elements of this sequence in a string using a separator 
string. */
-  def mkString(sep: String): String = toSeq.mkString(sep)
+  def mkString(sep: String): String = mkString("", sep, "")
 
   /**
    * Displays all elements of this traversable or iterator in a string using
    * start, end, and separator strings.
    */
-  def mkString(start: String, sep: String, end: String): String = 
toSeq.mkString(start, sep, end)
+  def mkString(start: String, sep: String, end: String): String = {
+    var first = true
+    var i = 0
+    val n = length
+    val builder = new StringBuilder
+    builder.append(start)
+    while (i < n) {
+      if (first) {
 
 Review comment:
   like this idea, let me try and do that, thanks

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to