BroadcastNestedLoopJoinExec Binary Physical Operator¶
BroadcastNestedLoopJoinExec
is a binary physical operator (with two child <
-
canBuildRight join type and
right
physical operator broadcastable -
canBuildLeft join type and
left
broadcastable -
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]
[[metrics]] .BroadcastNestedLoopJoinExec's Performance Metrics [cols="1,2,2",options="header",width="100%"] |=== | Key | Name (in web UI) | Description
| [[numOutputRows]] numOutputRows
| number of output rows | |===
.BroadcastNestedLoopJoinExec in web UI (Details for Query) image::images/spark-sql-BroadcastNestedLoopJoinExec-webui-details-for-query.png[align="center"]
[[requiredChildDistribution]] .BroadcastNestedLoopJoinExec's Required Child Output Distributions [cols="1m,2,2",options="header",width="100%"] |=== | BuildSide | Left Child | Right Child
| BuildLeft | BroadcastDistribution (uses IdentityBroadcastMode
broadcast mode) | UnspecifiedDistribution
| BuildRight | UnspecifiedDistribution | BroadcastDistribution (uses IdentityBroadcastMode
broadcast mode) |===
=== [[creating-instance]] Creating BroadcastNestedLoopJoinExec Instance
BroadcastNestedLoopJoinExec
takes the following when created:
- [[left]] Left SparkPlan.md[physical operator]
- [[right]] Right SparkPlan.md[physical operator]
- [[buildSide]]
BuildSide
- [[joinType]] spark-sql-joins.md#join-types[Join type]
- [[condition]] Optional join condition expressions/Expression.md[expressions]