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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]