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.
Why is this a separate if statement and not the `DEFAULT` of the switch? I guess because this way the compiler can warn us if we forget a case.