Set type when inlining aggregation functions.

Fixes issue #862. Test in CountTest.qOuterJoinLength.

Now targeting the right branch...