Partitioning with groups of elements

* put in group-end markers correctly when grouped data is partitioned
* don't use the partitioning function on every element and instead apply the function on the first
element and put all following elements in the same channel
(which assumes that partitioning is always done with the keys used for the grouping)