AngersZhuuuu commented on a change in pull request #27988:
URL: https://github.com/apache/spark/pull/27988#discussion_r452681058



##########
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:
       > nit: can we do this after the loop exit? There is no early stop in 
this loop.
   
   Sure, updated, since before exit loop, the last action is `addPartition` so 
currentGourps if not empty, we don't need to check if currentGroup is empty, 
just `updateGroups`




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to