Add unit test for DISTINCT aggregation on a JOIN