cloud-fan commented on a change in pull request #34069:
URL: https://github.com/apache/spark/pull/34069#discussion_r714933792
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/LogicalQueryStageStrategy.scala
##########
@@ -35,21 +35,27 @@ import
org.apache.spark.sql.execution.joins.{BroadcastHashJoinExec, BroadcastNes
* stage in case of the larger join child relation finishes before the
smaller relation. Note
* that this rule needs to be applied before regular join strategies.
*/
-object LogicalQueryStageStrategy extends Strategy with PredicateHelper {
+object LogicalQueryStageStrategy extends Strategy with PredicateHelper with
JoinSelectionHelper {
private def isBroadcastStage(plan: LogicalPlan): Boolean = plan match {
case LogicalQueryStage(_, _: BroadcastQueryStageExec) => true
case _ => false
}
def apply(plan: LogicalPlan): Seq[SparkPlan] = plan match {
- case ExtractEquiJoinKeys(joinType, leftKeys, rightKeys, otherCondition, _,
+ case j @ ExtractEquiJoinKeys(joinType, leftKeys, rightKeys,
otherCondition, _,
left, right, hint)
if isBroadcastStage(left) || isBroadcastStage(right) =>
val buildSide = if (isBroadcastStage(left)) BuildLeft else BuildRight
- Seq(BroadcastHashJoinExec(
- leftKeys, rightKeys, joinType, buildSide, otherCondition,
planLater(left),
- planLater(right)))
+ if ((hintToBroadcastNLLeft(hint) && isBroadcastStage(left)) ||
+ hintToBroadcastNLRight(hint) && isBroadcastStage(right)) {
Review comment:
The code here looks a bit hacky to me, as it assumes how
`BroadcastNestedLoopJoinExec` can be generated.
I feel a clearer way is to update `JoinSelection` and make it consider the
broadcast stage directly.
--
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]