maryannxue commented on a change in pull request #27833: [SPARK-31070][SQL] 
make skew join split skewed partitions more evenly
URL: https://github.com/apache/spark/pull/27833#discussion_r389827733
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/ShufflePartitionsUtilSuite.scala
 ##########
 @@ -252,4 +252,28 @@ class ShufflePartitionsCoalescerSuite extends 
SparkFunSuite {
         targetSize, minNumPartitions)
     }
   }
+
+  test("splitSizeListByTargetSize") {
+    val targetSize = 100
+
+    // merge the small partitions at the beginning/end
+    val sizeList1 = Seq[Long](15, 90, 15, 15, 15, 90, 15)
+    assert(ShufflePartitionsUtil.splitSizeListByTargetSize(sizeList1, 
targetSize).toSeq ==
+      Seq(0, 2, 5))
+
+    // merge the small partitions in the middle
+    val sizeList2 = Seq[Long](30, 15, 90, 10, 90, 15, 30)
+    assert(ShufflePartitionsUtil.splitSizeListByTargetSize(sizeList2, 
targetSize).toSeq ==
+      Seq(0, 2, 4, 5))
+
+    // merge the small partition even if it leads to a very large partition
+    val sizeList3 = Seq[Long](15, 1000, 15, 1000)
+    assert(ShufflePartitionsUtil.splitSizeListByTargetSize(sizeList3, 
targetSize).toSeq ==
+      Seq(0, 3))
+
+    // merge the small partitions even if it exceeds targetSize * 0.2
 
 Review comment:
   nit: merge small partitions if the combined size is smaller than targetSize 
* MERGED_PARTITION_FACTOR.

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