Init with groupFields. Handle scanLeft and sortBy.