AngersZhuuuu commented on a change in pull request #29692:
URL: https://github.com/apache/spark/pull/29692#discussion_r486140524
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeSkewedJoin.scala
##########
@@ -248,6 +249,74 @@ case class OptimizeSkewedJoin(conf: SQLConf) extends
Rule[SparkPlan] {
} else {
smj
}
+
+ case bnl @ BroadcastNestedLoopJoinExec(leftChild, rightChild, buildSide,
joinType, _, _) =>
+ def resolveBroadcastNLJoinSkew(
+ stream: ShuffleStageInfo,
+ joinType: JoinType,
+ buildSide: BuildSide): SparkPlan = {
+ val streamMedSize = medianSize(stream.mapStats)
+ val numPartitions = stream.partitionsWithSizes.length
+ logDebug(
+ s"""
+ |Optimizing skewed join.
+ |Build Side:
+ |${buildSide}
+ |Stream side partitions size info:
+ |${getSizeInfo(streamMedSize, stream.mapStats.bytesByPartitionId)}
+ """.stripMargin)
+ val canSplitStream = canSplitLeftSide(joinType)
+ val streamActualSizes = stream.partitionsWithSizes.map(_._2)
+ val streamTargetSize = targetSize(streamActualSizes, streamMedSize)
+ val streamSidePartitions =
mutable.ArrayBuffer.empty[ShufflePartitionSpec]
+ var numSkewedStream = 0
+ for (partitionIndex <- 0 until numPartitions) {
+ val streamActualSize = streamActualSizes(partitionIndex)
+ val isStreamSkew = isSkewed(streamActualSize, streamMedSize) &&
canSplitStream
Review comment:
> If `canSplitStream=false`, we need to process this for loop?
We should remove this condition, miss this part .
----------------------------------------------------------------
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]