Project on input fields before groupBy.

Issue #474