cloud-fan commented on a change in pull request #27893: [SPARK-31134][SQL]
optimize skew join after shuffle partitions are coalesced
URL: https://github.com/apache/spark/pull/27893#discussion_r392766089
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeSkewedJoin.scala
##########
@@ -328,6 +287,48 @@ case class OptimizeSkewedJoin(conf: SQLConf) extends
Rule[SparkPlan] {
}
}
+private object ShuffleStage {
+ def unapply(plan: SparkPlan): Option[ShuffleStageInfo] = plan match {
+ case s: ShuffleQueryStageExec =>
+ val mapStats = getMapStats(s)
+ val sizes = mapStats.bytesByPartitionId
+ val partitions = sizes.zipWithIndex.map {
+ case (size, i) => CoalescedPartitionSpec(i, i + 1) -> size
+ }
+ Some(ShuffleStageInfo(s, mapStats, partitions))
+
+ case CustomShuffleReaderExec(s: ShuffleQueryStageExec, partitionSpecs, _)
=>
+ val mapStats = getMapStats(s)
+ val sizes = mapStats.bytesByPartitionId
+ val partitions = partitionSpecs.map {
+ case spec @ CoalescedPartitionSpec(start, end) =>
+ var sum = 0L
Review comment:
`slice` will create a new array, which is less efficient.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]