cloud-fan commented on a change in pull request #32781:
URL: https://github.com/apache/spark/pull/32781#discussion_r647274944
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/CoalesceShufflePartitions.scala
##########
@@ -48,15 +48,20 @@ case class CoalesceShufflePartitions(session: SparkSession)
extends CustomShuffl
}
val shuffleStageInfos = collectShuffleStageInfos(plan)
+ val shuffles = shuffleStageInfos.map(_.shuffleStage.shuffle)
// ShuffleExchanges introduced by repartition do not support changing the
number of partitions.
// We change the number of partitions in the stage only if all the
ShuffleExchanges support it.
- if (!shuffleStageInfos.forall(s =>
supportCoalesce(s.shuffleStage.shuffle))) {
+ if (!shuffles.forall(supportCoalesce)) {
plan
} else {
// We fall back to Spark default parallelism if the minimum number of
coalesced partitions
// is not set, so to avoid perf regressions compared to no coalescing.
- val minPartitionNum =
conf.getConf(SQLConf.COALESCE_PARTITIONS_MIN_PARTITION_NUM)
- .getOrElse(session.sparkContext.defaultParallelism)
+ val minPartitionNum = if (shuffles.forall(isUsedToCoalescePartitions)) {
+ 1
Review comment:
why do we need this?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]