Reduce task to array grouping