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/03/24 02:33:26 UTC

[GitHub] [spark] AngersZhuuuu commented on issue #27988: [SPARK-31226][SQL][TEST] SizeBasedCoalesce logic will lose partition

AngersZhuuuu commented on issue #27988: [SPARK-31226][SQL][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:
users@infra.apache.org


With regards,
Apache Git Services

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