Finished first half of JoinOptimizer