AngersZhuuuu removed a comment on issue #27988: [SPARK-31226][CORE][TEST] 
SizeBasedCoalesce logic will lose partition
URL: https://github.com/apache/spark/pull/27988#issuecomment-602974768
 
 
   @dongjoon-hyun 
   ```
   
     // 3. since index = partition.size now,  jump out of the loop , then the 
last partition is lost since we won't call updatePartition() again.
   while (index < partitions.size) {
        //  we assume that when index = partitions.length -1  and 
         //  splitSize > maxSize
         val partition = partitions(index)
         val fileSplit =
           
partition.asInstanceOf[HadoopPartition].inputSplit.value.asInstanceOf[FileSplit]
         val splitSize = fileSplit.getLength
         if (currentSum + splitSize < maxSize) {
           addPartition(partition, splitSize)
           index += 1
           if (index == partitions.size) {
             updateGroups
           }
         } else {
          //  2.then  will addPartition() to currentGroup and index updated , 
index = partition.size now
           if (currentGroup.partitions.size == 0) {
             addPartition(partition, splitSize)
             index += 1
           } else {
           //   1. will call updateGroups() here first, and index won't update
             updateGroups
           }
         }
       }
       groups.toArray
     }
   }
   ```

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