Beispiel #1
0
        private static IGroupByQueryDescriptor ConfigureAggregationSpec(
            IGroupByQueryDescriptor aggregation,
            TimeSlot timeslot,
            IFilterSpec filter,
            IReadOnlyList <string> dimensions)
        {
            if (filter != null)
            {
                aggregation = aggregation.Filter(filter);
            }

            if (dimensions.Any())
            {
                aggregation = aggregation.Dimensions(dimensions);
            }

            return(aggregation
                   .DataSource(BigBankCube.DataSource)
                   .Granularity(Granularities.All)
                   .Interval(timeslot.Start, timeslot.End)
                   .Aggregations(
                       new DoubleSumAggregator(BigBankCube.Metrics.Price, BigBankCube.Metrics.Price),
                       new LongSumAggregator(BigBankCube.Metrics.Count, BigBankCube.Metrics.Count))
                   .PostAggregations(new ArithmeticPostAggregator(
                                         BigBankCube.Metrics.AveragePrice,
                                         ArithmeticFunction.Divide,
                                         fields: new IPostAggregationSpec[]
            {
                new FieldAccessPostAggregator(BigBankCube.Metrics.Price, BigBankCube.Metrics.Price),
                new FieldAccessPostAggregator(BigBankCube.Metrics.Count, BigBankCube.Metrics.Count)
            })));
        }
Beispiel #2
0
        public IGroupByQueryDescriptor DataSource(Func <IGroupByQueryDescriptor, IGroupByQueryDescriptor> innerGroupByQueryDescriptor)
        {
            var qd = (GroupByQueryDescriptor)innerGroupByQueryDescriptor(new GroupByQueryDescriptor());

            InnerDataSourceValue = qd;

            return(this);
        }