added group by and partition of a collect. generate a custom map