You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "mcdull-zhang (via GitHub)" <gi...@apache.org> on 2023/06/04 03:36:13 UTC

[GitHub] [spark] mcdull-zhang commented on a diff in pull request #41419: [SPARK-43911] [SQL] Use toSet to deduplicate the iterator data to prevent the creation of large Array

mcdull-zhang commented on code in PR #41419:
URL: https://github.com/apache/spark/pull/41419#discussion_r1216118752


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala:
##########
@@ -93,7 +94,9 @@ case class SubqueryBroadcastExec(
         val rows = if (broadcastRelation.keyIsUnique) {
           keyIter.toArray[InternalRow]
         } else {
-          keyIter.toArray[InternalRow].distinct
+          val set = new HashSet[InternalRow]()
+          keyIter.foreach(set.add(_))
+          set.toArray[InternalRow]

Review Comment:
   > `keyIter.toSet[InternalRow].toArray`?
   
   It really should do this, otherwise it won't compile



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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