コード例 #1
0
ファイル: PivotStreamNode.cs プロジェクト: paillave/Etl.Net
 public PivotCorrelatedStreamNode(string name, PivotCorrelatedArgs <TIn, TAggrRes, TKey> args) : base(name, args)
 {
 }
コード例 #2
0
ファイル: PivotStreamNode.cs プロジェクト: paillave/Etl.Net
        protected override IStream <Correlated <AggregationResult <TIn, TKey, TAggrRes> > > CreateOutputStream(PivotCorrelatedArgs <TIn, TAggrRes, TKey> args)
        {
            var aggregationProcessor = new AggregationProcessor <Correlated <TIn>, TIn, TAggrRes, CorrelatedAggregator <TIn> >(args.AggregationDescriptor);

            return(CreateUnsortedStream(
                       args.InputStream.Observable.Aggregate(
                           i => aggregationProcessor.CreateAggregators(i),
                           i => args.GetKey(i.Row),
                           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
                };
            })));
        }