User defined aggregates

Review after #594 

@domoritz , you are probably the best reviewer if you have time. UserDefinedAggregator is essentially a fork of StatefulApply, except that the emitters only trigger at EOS and the emitters are not allowed to use the input tuples.
I may rename the Aggregate operators to GroupBy s instead, but yes this is a good idea.