cloud-fan commented on a change in pull request #26516: [SPARK-29893] improve
the local shuffle reader performance by changing the reading task number from 1
to multi.
URL: https://github.com/apache/spark/pull/26516#discussion_r347730237
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeLocalShuffleReader.scala
##########
@@ -27,49 +27,71 @@ import
org.apache.spark.sql.execution.exchange.{EnsureRequirements, ShuffleExcha
import org.apache.spark.sql.execution.joins.{BroadcastHashJoinExec, BuildLeft,
BuildRight, BuildSide}
import org.apache.spark.sql.internal.SQLConf
+
object BroadcastJoinWithShuffleLeft {
- def unapply(plan: SparkPlan): Option[(QueryStageExec, BuildSide)] = plan
match {
- case join: BroadcastHashJoinExec if
ShuffleQueryStageExec.isShuffleQueryStageExec(join.left) =>
- Some((join.left.asInstanceOf[QueryStageExec], join.buildSide))
+ def unapply(plan: SparkPlan): Option[(SparkPlan, BuildSide)] = plan match {
+ case join: BroadcastHashJoinExec if
ShuffleQueryStageExec.isShuffleQueryStageExec(join.left)
+ || join.left.isInstanceOf[CoalescedShuffleReaderExec] =>
+ Some((join.left, join.buildSide))
case _ => None
}
}
object BroadcastJoinWithShuffleRight {
- def unapply(plan: SparkPlan): Option[(QueryStageExec, BuildSide)] = plan
match {
- case join: BroadcastHashJoinExec if
ShuffleQueryStageExec.isShuffleQueryStageExec(join.right) =>
- Some((join.right.asInstanceOf[QueryStageExec], join.buildSide))
+ def unapply(plan: SparkPlan): Option[(SparkPlan, BuildSide)] = plan match {
+ case join: BroadcastHashJoinExec if
ShuffleQueryStageExec.isShuffleQueryStageExec(join.right)
+ || join.right.isInstanceOf[CoalescedShuffleReaderExec] =>
+ Some((join.right, join.buildSide))
case _ => None
}
}
/**
* A rule to optimize the shuffle reader to local reader as far as possible
Review comment:
```
A rule to optimize the shuffle reader to local reader iff no additional
shuffles
will be introduced:
1. if the input plan is a shuffle, add local reader directly as we can never
introduce
extra shuffles in this case.
2. otherwise, add local reader to the probe side of broadcast hash join and
then run `EnsureRequirements` to
check whether additional shuffle introduced. If introduced, we will
revert all the local readers.
```
----------------------------------------------------------------
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]