You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/10 23:36:05 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27988: [SPARK-31226][CORE][TESTS] SizeBasedCoalesce logic will lose partition

dongjoon-hyun commented on a change in pull request #27988:
URL: https://github.com/apache/spark/pull/27988#discussion_r453121553



##########
File path: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
##########
@@ -1298,19 +1298,17 @@ 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)
         }

Review comment:
       Instead of the following,
   ```scala
   if (currentGroup.partitions.isEmpty) {
     addPartition(partition, splitSize)
   } else {
     updateGroups()
     addPartition(partition, splitSize)
   }
   ```
   
   The following will be better.
   ```scala
   if (currentGroup.partitions.nonEmpty) {
     updateGroups()
   }
   addPartition(partition, splitSize)
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



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