Set type when inlining aggregation functions.

Fixes issue #862. Test in CountTest.qOuterJoinLength
Merge pull request #867 from slick/tmp/issue-862

Set type when inlining aggregation functions.