slick/slick — pull request #142 by szeiger (2013-04-23 11:06:11+00:00)
Title: Proper rewriting of aggregation functions over explicit joins.

Aggregations over the left or right side of an explicit join were not
properly translated in ConvertToComprehensions.convertSimpleGrouping.

We still have a design problem here: In SQL, a count over a single column
disregards NULL values whereas a count(*) counts all rows of a view. This
distinction should not exist in collection semantics (and it cannot be
implemented in ConvertToComprehensions, long after TableRefExpansions have
been eliminated, since there is no way of telling a count of a single
column from a count of a view of which we only use a single column later).

For now, the fix is to count the first column of the projection. This is
in line with the behaviour in 1.0.0, allows the correct handling of
single-column projections and produces the right result in most cases of
counting joined tables.

We should improve this further when we add proper support for nested
collections.

Fixes issue #135. Test in AggregateTest.testGroupBy.

Review by @cvogt