Esempio n. 1
0
 protected override IStream <Correlated <AggregationResult <TIn, TKey, TAggrRes> > > CreateOutputStream(AggregateCorrelatedArgs <TIn, TAggrRes, TKey> args)
 {
     return(CreateUnsortedStream(
                args.InputStream.Observable.Aggregate(
                    i => new Correlated <TAggrRes>
     {
         Row = args.CreateEmptyAggregation(i.Row),
         CorrelationKeys = new HashSet <Guid>()
     },
                    i => args.GetKey(i.Row),
                    (a, i) =>
     {
         a.Row = args.Aggregate(a.Row, i.Row);
         a.CorrelationKeys.UnionWith(i.CorrelationKeys);
         return a;
     },
                    (i, k, a) => new Correlated <AggregationResult <TIn, TKey, TAggrRes> >
     {
         CorrelationKeys = a.CorrelationKeys,
         Row = new AggregationResult <TIn, TKey, TAggrRes>
         {
             Aggregation = a.Row,
             FirstValue = i.Row,
             Key = k
         }
     })));
 }