Ejemplo n.º 1
0
        public override void ApplyEnter(EventBean[] eventsPerStream, Object groupByKey, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QAggregationGroupedApplyEnterLeave(true, Aggregators.Length, AccessAggregations.Length, groupByKey);
            }
            AggregationRowPair groupAggregators = AggregatorsPerGroup.Get(groupByKey);

            // The aggregators for this group do not exist, need to create them from the prototypes
            AggregationState[] states;

            if (groupAggregators == null)
            {
                AggregationMethod[] methods = AggSvcGroupByUtil.NewAggregators(Aggregators);
                states           = AggSvcGroupByUtil.NewAccesses(exprEvaluatorContext.AgentInstanceId, IsJoin, AccessAggregations, groupByKey, null);
                groupAggregators = new AggregationRowPair(methods, states);
                AggregatorsPerGroup.Put(groupByKey, groupAggregators);
            }

            var evaluateParams = new EvaluateParams(eventsPerStream, true, exprEvaluatorContext);

            // For this row, evaluate sub-expressions, enter result
            _currentAggregatorRow = groupAggregators;
            AggregationMethod[] groupAggMethods = groupAggregators.Methods;
            for (int i = 0; i < Evaluators.Length; i++)
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QAggNoAccessEnterLeave(true, i, groupAggMethods[i], Aggregators[i].AggregationExpression);
                }
                Object columnResult = Evaluators[i].Evaluate(evaluateParams);
                groupAggMethods[i].Enter(columnResult);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AAggNoAccessEnterLeave(true, i, groupAggMethods[i]);
                }
            }

            states = _currentAggregatorRow.States;
            for (int i = 0; i < states.Length; i++)
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QAggAccessEnterLeave(true, i, states[i], AccessAggregations[i].AggregationExpression);
                }
                states[i].ApplyEnter(eventsPerStream, exprEvaluatorContext);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AAggAccessEnterLeave(true, i, states[i]);
                }
            }

            InternalHandleUpdated(groupByKey, groupAggregators);
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AAggregationGroupedApplyEnterLeave(true);
            }
        }
Ejemplo n.º 2
0
        public override void SetCurrentAccess(Object groupByKey, int agentInstanceId, AggregationGroupByRollupLevel rollupLevel)
        {
            _currentAggregatorRow = AggregatorsPerGroup.Get(groupByKey);
            _currentGroupKey      = groupByKey;

            if (_currentAggregatorRow == null)
            {
                AggregationMethod[] methods = AggSvcGroupByUtil.NewAggregators(Aggregators);
                AggregationState[]  states  = AggSvcGroupByUtil.NewAccesses(agentInstanceId, IsJoin, AccessAggregations, groupByKey, null);
                _currentAggregatorRow = new AggregationRowPair(methods, states);
                AggregatorsPerGroup.Put(groupByKey, _currentAggregatorRow);
            }
        }
Ejemplo n.º 3
0
 public void InternalHandleUpdated(Object groupByKey, AggregationRowPair groupAggregators)
 {
     // no action required
 }