MODE-2297 Corrected asymmetric set operations

A recent change introduced a bug that caused some parts of joins to be removed when rewritten.
Merge pull request #1244 from rhauch/mode-2297

MODE-2297 Corrected asymmetric set operations