You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/05/05 03:35:53 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #24524: Improve inner merge logic

dongjoon-hyun commented on a change in pull request #24524: Improve inner merge logic
URL: https://github.com/apache/spark/pull/24524#discussion_r281002703
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala
 ##########
 @@ -59,8 +59,18 @@ object Row {
    */
   @deprecated("This method is deprecated and will be removed in future versions.", "3.0.0")
   def merge(rows: Row*): Row = {
-    // TODO: Improve the performance of this if used in performance critical part.
-    new GenericRow(rows.flatMap(_.toSeq).toArray)
+    var elementNumber = 0
+    for (row <- rows)
+      elementNumber += row.length
+    val allValues = new Array[Any](elementNumber)
+    var arrayPos = 0
+    for (row <- rows) {
+      for (rowIndex <- (0 until row.length)) {
+        allValues.update(arrayPos, row.get(rowIndex))
+        arrayPos += 1
+      }
+    }
+    new GenericRow(allValues)
 
 Review comment:
   Hi, @g1thubhub . Thank you for showing your interest to improve Apache Spark, but this function is deprecated and will be removed. So, there is no need to improve this at this time. Could you close this PR?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org