AngersZhuuuu commented on a change in pull request #27988: 
[SPARK-31226][CORE][TEST] SizeBasedCoalesce logic will lose partition
URL: https://github.com/apache/spark/pull/27988#discussion_r402014223
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
 ##########
 @@ -1298,18 +1298,18 @@ class SizeBasedCoalescer(val maxSize: Int) extends 
PartitionCoalescer with Seria
       val splitSize = fileSplit.getLength
       if (currentSum + splitSize < maxSize) {
         addPartition(partition, splitSize)
-        index += 1
-        if (index == partitions.size) {
-          updateGroups
-        }
       } else {
-        if (currentGroup.partitions.size == 0) {
+        if (currentGroup.partitions.isEmpty) {
           addPartition(partition, splitSize)
-          index += 1
         } else {
-          updateGroups
+          updateGroups()
+          addPartition(partition, splitSize)
         }
       }
+      index += 1
+      if (index == partitions.length) {
+        updateGroups()
+      }
 
 Review comment:
   > BTW, the previous code was added at 2.0.0. Did you hit a test flakiness 
due to this?
   
   Yeah, these days I am testing a way to  fix spark small out put file 
problem, and I use this logic, during test, found that this logic is wrong.
   https://github.com/apache/spark/pull/27248

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