Skip to content

Commit

Permalink
Consolidate two adjacent pattern matchings.
Browse files Browse the repository at this point in the history
  • Loading branch information
concretevitamin committed Jul 31, 2014
1 parent 96d312a commit 68e6c5b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -369,19 +369,16 @@ case class BroadcastNestedLoopJoin(
while (i < broadcastedRelation.value.size) {
// TODO: One bitset per partition instead of per row.
val broadcastedRow = broadcastedRelation.value(i)
val jr = buildSide match {
case BuildRight => joinedRow(streamedRow, broadcastedRow)
case BuildLeft => joinedRow(broadcastedRow, streamedRow)
}
if (boundCondition(jr)) {
// Putting this branching inside this conditional: assume ++ has a
// much higher cost than another branch & pattern matching.
buildSide match {
case BuildRight => matchedRows += joinedRow(streamedRow, broadcastedRow).copy()
case BuildLeft => matchedRows += joinedRow(broadcastedRow, streamedRow).copy()
}
streamRowMatched = true
includedBroadcastTuples += i
buildSide match {
case BuildRight if boundCondition(joinedRow(streamedRow, broadcastedRow)) =>
matchedRows += joinedRow(streamedRow, broadcastedRow).copy()
streamRowMatched = true
includedBroadcastTuples += i
case BuildLeft if boundCondition(joinedRow(broadcastedRow, streamedRow)) =>
matchedRows += joinedRow(broadcastedRow, streamedRow).copy()
streamRowMatched = true
includedBroadcastTuples += i
case _ =>
}
i += 1
}
Expand Down

0 comments on commit 68e6c5b

Please sign in to comment.