Add tests for outer join also. Fix the query pattern to be ordered deter...

...ministic.

Waiting for Jenkins...