protected override IStream <AggregationResult <TIn, TMultiKey, TAggrRes> > CreateOutputStream(AggregateMultiKeyArgs <TIn, TAggrRes, TMultiKey> args) { var keyProcessor = GroupProcessor.Create(args.GetKeys); var observableOut = args.InputStream.Observable.Do(keyProcessor.ProcessRow).Last().MultiMap <TIn, AggregationResult <TIn, TMultiKey, TAggrRes> >((i, pushValue) => { foreach (var group in keyProcessor.GetGroups()) { TIn first = default; TAggrRes aggrRes = default; foreach (var item in group.Value) { if (first != null) { first = item; aggrRes = args.CreateEmptyAggregation(first); } aggrRes = args.Aggregate(aggrRes, item); } pushValue(new AggregationResult <TIn, TMultiKey, TAggrRes> { Aggregation = aggrRes, FirstValue = first, Key = group.Key }); } }); return(CreateUnsortedStream(observableOut)); }
public AggregateMultiKeyStreamNode(string name, AggregateMultiKeyArgs <TIn, TAggrRes, TMultiKey> args) : base(name, args) { }