Fix issue with DISTINCT (new parser) and a logic issue with semijoins