protected override ISortedStream <Correlated <AggregationResult <TIn, TKey, TAggrRes> >, TKey> CreateOutputStream(PivotSortedCorrelatedArgs <TIn, TAggrRes, TKey> args) { var aggregationProcessor = new AggregationProcessor <Correlated <TIn>, TIn, TAggrRes, CorrelatedAggregator <TIn> >(args.AggregationDescriptor); return(CreateSortedStream( args.InputStream.Observable.AggregateGrouped( aggregationProcessor.CreateAggregators, args.InputStream.SortDefinition.GetKey, aggregationProcessor.Aggregate, (i, k, a) => { HashSet <Guid> correlationKeys = new HashSet <Guid>(); a.Values.Select(i => i.CorrelationKeys).ToList().ForEach(correlationKeys.UnionWith); return new Correlated <AggregationResult <TIn, TKey, TAggrRes> > { Row = new AggregationResult <TIn, TKey, TAggrRes> { Aggregation = aggregationProcessor.CreateInstance(a), FirstValue = i.Row, Key = k }, CorrelationKeys = correlationKeys }; }), new SortDefinition <Correlated <AggregationResult <TIn, TKey, TAggrRes> >, TKey>(i => i.Row.Key, args.InputStream.SortDefinition.KeyPosition))); }
protected override IStream <AggregationResult <TIn, TKey, TAggrRes> > CreateOutputStream(PivotArgs <TIn, TAggrRes, TKey> args) { var aggregationProcessor = new AggregationProcessor <TIn, TAggrRes>(args.AggregationDescriptor); return(CreateUnsortedStream( args.InputStream.Observable.Aggregate( aggregationProcessor.CreateAggregators, args.GetKey, aggregationProcessor.Aggregate, (i, k, a) => new AggregationResult <TIn, TKey, TAggrRes> { Aggregation = aggregationProcessor.CreateInstance(a), FirstValue = i, Key = k }))); }
protected override ISortedStream <AggregationResult <TIn, TKey, TAggrRes>, TKey> CreateOutputStream(PivotSortedArgs <TIn, TAggrRes, TKey> args) { var aggregationProcessor = new AggregationProcessor <TIn, TAggrRes>(args.AggregationDescriptor); return(CreateSortedStream( args.InputStream.Observable.AggregateGrouped( aggregationProcessor.CreateAggregators, args.InputStream.SortDefinition.GetKey, aggregationProcessor.Aggregate, (i, k, a) => new AggregationResult <TIn, TKey, TAggrRes> { Aggregation = aggregationProcessor.CreateInstance(a), FirstValue = i, Key = k }), new SortDefinition <AggregationResult <TIn, TKey, TAggrRes>, TKey>(i => i.Key, args.InputStream.SortDefinition.KeyPosition))); }