cloud-fan commented on a change in pull request #27226: [SPARK-30524] [SQL]
Disable OptimizeSkewedJoin rule when introducing additional shuffle
URL: https://github.com/apache/spark/pull/27226#discussion_r367213628
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeSkewedJoin.scala
##########
@@ -114,79 +120,124 @@ case class OptimizeSkewedJoin(conf: SQLConf) extends
Rule[SparkPlan] {
stage.shuffle.shuffleDependency.rdd.partitions.length
}
- def handleSkewJoin(plan: SparkPlan): SparkPlan = plan.transformUp {
- case smj @ SortMergeJoinExec(leftKeys, rightKeys, joinType, condition,
- s1 @ SortExec(_, _, left: ShuffleQueryStageExec, _),
- s2 @ SortExec(_, _, right: ShuffleQueryStageExec, _))
- if supportedJoinTypes.contains(joinType) =>
- val leftStats = getStatistics(left)
- val rightStats = getStatistics(right)
- val numPartitions = leftStats.bytesByPartitionId.length
-
- val leftMedSize = medianSize(leftStats)
- val rightMedSize = medianSize(rightStats)
- val leftSizeInfo = s"median size: $leftMedSize, max size:
${leftStats.bytesByPartitionId.max}"
- val rightSizeInfo = s"median size: $rightMedSize," +
- s" max size: ${rightStats.bytesByPartitionId.max}"
- logDebug(
- s"""
- |Try to optimize skewed join.
- |Left side partition size: $leftSizeInfo
- |Right side partition size: $rightSizeInfo
+ private def containShuffleQueryStage(plan : SparkPlan): (Boolean,
ShuffleQueryStageExec) =
+ plan match {
+ case stage: ShuffleQueryStageExec => (true, stage)
+ case sort: SortExec if (sort.child.isInstanceOf[ShuffleQueryStageExec])
=>
+ (true, sort.child.asInstanceOf[ShuffleQueryStageExec])
+ case _ => (false, null)
+ }
+
+ private def reOptimizeChild(
+ skewedReader: SkewedPartitionReaderExec,
+ child: SparkPlan): SparkPlan = child match {
+ case sort: SortExec if (sort.child.isInstanceOf[ShuffleQueryStageExec]) =>
Review comment:
ditto
----------------------------------------------------------------
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]