cloud-fan commented on a change in pull request #33123: URL: https://github.com/apache/spark/pull/33123#discussion_r660368966
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/ShufflePartitionsUtil.scala ########## @@ -173,7 +176,11 @@ object ShufflePartitionsUtil extends Logging { if (numPartitions > start) { val partitionSpecs = coalescePartitions( partitionIndices(start), partitionIndices.last + 1, validMetrics, targetSize) - newPartitionSpecsSeq.zip(partitionSpecs).foreach(spec => spec._1 ++= spec._2) + assert(numPartitions > 0) + // skip empty partition iff all shuffle are empty after coalesced + if (!partitionSpecs.forall(specs => specs.size == 1 && specs.head.dataSize.contains(0))) { Review comment: I looked into `coalescePartitions`, it does skip empty partitions, but it needs to at least return one `CoalescedPartitionSpec`. I think we can pass one more boolean flag to `coalescePartitions` to allow it to return no `CoalescedPartitionSpec`, for coalescing partitions between skewed partitions. -- 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