yaooqinn commented on a change in pull request #33172:
URL: https://github.com/apache/spark/pull/33172#discussion_r662141208



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/ShufflePartitionsUtil.scala
##########
@@ -61,7 +63,9 @@ object ShufflePartitionsUtil extends Logging {
     // `maxTargetSize` from being set to 0.
     val maxTargetSize = math.max(
       math.ceil(totalPostShuffleInputSize / minNumPartitions.toDouble).toLong, 
16)
-    val targetSize = math.min(maxTargetSize, advisoryTargetSize)
+    // The target size can be very small if minNumPartitions is super big. 
Here we use
+    // minPartitionSize as the lower bound to avoid too small partitions after 
coalescing.
+    val targetSize = math.max(math.min(maxTargetSize, advisoryTargetSize), 
minPartitionSize)
 
     val shuffleIds = 
mapOutputStatistics.flatMap(_.map(_.shuffleId)).mkString(", ")
     logInfo(s"For shuffle($shuffleIds), advisory target size: 
$advisoryTargetSize, " +

Review comment:
       shall we mention the minPartitionSize here?




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

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to