BroadcastNestedLoopJoinExec Binary Physical Operator

BroadcastNestedLoopJoinExec is a binary physical operator (with two child left and right physical operators) that is created (and converted to) when JoinSelection physical plan strategy finds a Join logical operator that meets either case:

  1. canBuildRight join type and right physical operator broadcastable

  2. canBuildLeft join type and left broadcastable

  3. non-InnerLike join type

Note
BroadcastNestedLoopJoinExec is the default physical operator when no other operators have matched selection requirements.
Note

canBuildRight join types are:

  • CROSS, INNER, LEFT ANTI, LEFT OUTER, LEFT SEMI or Existence

canBuildLeft join types are:

  • CROSS, INNER, RIGHT OUTER

val nums = spark.range(2)
val letters = ('a' to 'c').map(_.toString).toDF("letter")
val q = nums.crossJoin(letters)

scala> q.explain
== Physical Plan ==
BroadcastNestedLoopJoin BuildRight, Cross
:- *Range (0, 2, step=1, splits=Some(8))
+- BroadcastExchange IdentityBroadcastMode
   +- LocalTableScan [letter#69]
Table 1. BroadcastNestedLoopJoinExec’s SQLMetrics
Name Description

numOutputRows

Number of output rows

spark sql BroadcastNestedLoopJoinExec webui details for query.png
Figure 1. BroadcastNestedLoopJoinExec in web UI (Details for Query)
Table 2. BroadcastNestedLoopJoinExec’s Required Child Output Distributions
BuildSide Left Child Right Child

BuildLeft

BroadcastDistribution <1>

UnspecifiedDistribution

BuildRight

UnspecifiedDistribution

BroadcastDistribution <1>

  1. BroadcastDistribution uses IdentityBroadcastMode broadcast mode

Creating BroadcastNestedLoopJoinExec Instance

BroadcastNestedLoopJoinExec takes the following when created:

results matching ""

    No results matching ""