Ejemplo n.º 1
0
        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)));
        }
Ejemplo n.º 2
0
 public PivotSortedCorrelatedStreamNode(string name, PivotSortedCorrelatedArgs <TIn, TAggrRes, TKey> args) : base(name, args)
 {
 }