Move common join operations into util.
Merge pull request #119 from InABlender/join_gen

Generalize joinDups optimization