fix post aggs with group by in #472

Uses the test case in #592 (with a minor change of using doubles for post aggs instead of longs).
I'm not sure I understand what getBaseFactories is meant to return, but the underlying javascript function may depend on all fieldNames being passed, so we cannot limit to a single column.