[SPARK-1880] [SQL] Eliminate unnecessary job executions.

There are unnecessary job executions in `BroadcastNestedLoopJoin`.

When `Innner` or `LeftOuter` join, preparation of `rightOuterMatches` for `RightOuter` or `FullOuter` join is not neccessary.
And when `RightOuter` or `FullOuter`, it should use not `count` and then `reduce` but `fold`.