shrirangmhalgi commented on code in PR #56243:
URL: https://github.com/apache/spark/pull/56243#discussion_r3354184289
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/CoalesceShufflePartitions.scala:
##########
@@ -90,9 +90,38 @@ case class CoalesceShufflePartitions(session: SparkSession)
extends AQEShuffleRe
}
}
+ // For groups that feed a partitioned join
(SortMergeJoin/ShuffledHashJoin), enforce a
+ // minimum partition count to avoid eliminating join parallelism.
+ // Design choice: we use a pre-coalesce floor (Option A) rather than
post-coalesce skew
+ // re-checking (Option B). Option A is simpler and avoids re-running skew
detection after
+ // coalescing. Option B would be more robust for edge cases but adds
significant complexity
+ // and can be explored as a follow-up.
+ val adjustedMinNumPartitionsByGroup =
coalesceGroups.zip(minNumPartitionsByGroup).map {
+ case (group, minNum) if group.feedsJoin =>
+ val totalSize = group.shuffleStages.flatMap(
Review Comment:
Nit: `mapStats` is an `Option`, so stages where it's `None` contribute 0
bytes silently. If both sides of a join had `mapStats = None`, totalSize would
be 0 and the floor would be skipped entirely (`totalSize <= advisorySize` →
true → no floor applied). In practice this shouldn't happen because AQE
coalescing runs after stage completion, but a defensive assert or
early-return-if-empty guard would make the invariant explicit.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]