public static IEnumerator<EventBean> For(
            IEnumerator<EventBean> sourceIterator,
            ResultSetProcessorRowPerGroup resultSetProcessor,
            AggregationService aggregationService,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            var eventsPerStream = new EventBean[1];
            var priorSeenGroups = new HashSet<object>();
            var hasHavingClause = resultSetProcessor.HasHavingClause;

            while (sourceIterator.MoveNext()) {
                eventsPerStream[0] = sourceIterator.Current;
                var groupKey = resultSetProcessor.GenerateGroupKeySingle(eventsPerStream, true);
                aggregationService.SetCurrentAccess(groupKey, exprEvaluatorContext.AgentInstanceId, null);

                if (hasHavingClause) {
                    var pass = resultSetProcessor.EvaluateHavingClause(eventsPerStream, true, exprEvaluatorContext);
                    if (!pass) {
                        continue;
                    }
                }

                if (priorSeenGroups.Contains(groupKey)) {
                    continue;
                }

                priorSeenGroups.Add(groupKey);
                yield return resultSetProcessor.SelectExprProcessor.Process(
                    eventsPerStream,
                    true,
                    true,
                    exprEvaluatorContext);
            }
        }
Esempio n. 2
0
        public void SetUp()
        {
            _container            = SupportContainer.Reset();
            _agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(
                "abc", new StatementEventTypeRefImpl(_container.RWLockManager()));
            var factory = new SelectExprProcessorHelper(
                Collections.GetEmptyList <int>(),
                SupportSelectExprFactory.MakeSelectListFromIdent("TheString", "s0"),
                Collections.GetEmptyList <SelectExprStreamDesc>(),
                null, null, false,
                new SupportStreamTypeSvc1Stream(),
                _container.Resolve <EventAdapterService>(), null,
                selectExprEventTypeRegistry,
                _agentInstanceContext.StatementContext.EngineImportService,
                1, "stmtname", null,
                new Configuration(_container), null,
                new TableServiceImpl(_container),
                null);
            var selectProcessor = factory.GetEvaluator();

            _supportAggregationService = new SupportAggregationService();

            var groupKeyNodes = new ExprEvaluator[2];

            groupKeyNodes[0] = SupportExprNodeFactory.MakeIdentNode("IntPrimitive", "s0").ExprEvaluator;
            groupKeyNodes[1] = SupportExprNodeFactory.MakeIdentNode("IntBoxed", "s0").ExprEvaluator;

            var prototype = new ResultSetProcessorRowPerGroupFactory(selectProcessor, null, groupKeyNodes, null, true, false, null, false, false, false, false, null, false, 1, null);

            _processor = (ResultSetProcessorRowPerGroup)prototype.Instantiate(null, _supportAggregationService, _agentInstanceContext);
        }
 public ResultSetProcessorRowPerGroupOutputLastHelper MakeRSRowPerGroupOutputLastOpt(
     AgentInstanceContext agentInstanceContext,
     ResultSetProcessorRowPerGroup resultSetProcessorRowPerGroup,
     Type[] groupKeyTypes,
     DataInputOutputSerde serde,
     EventType[] eventTypes)
 {
     return new ResultSetProcessorRowPerGroupOutputLastHelperImpl(resultSetProcessorRowPerGroup);
 }
 /// <summary>
 /// Creates a new enumeration wrapper.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="resultSetProcessor">The result set processor.</param>
 /// <param name="aggregationService">The aggregation service.</param>
 /// <param name="exprEvaluatorContext">The expr evaluator context.</param>
 /// <returns></returns>
 public static IEnumerator <EventBean> New(
     IEnumerable <EventBean> source,
     ResultSetProcessorRowPerGroup resultSetProcessor,
     AggregationService aggregationService,
     ExprEvaluatorContext exprEvaluatorContext)
 {
     return(New(
                source.GetEnumerator(),
                resultSetProcessor,
                aggregationService,
                exprEvaluatorContext));
 }
        /// <summary>
        /// Creates a new enumeration wrapper.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="resultSetProcessor">The result set processor.</param>
        /// <param name="aggregationService">The aggregation service.</param>
        /// <param name="exprEvaluatorContext">The expr evaluator context.</param>
        /// <returns></returns>
        public static IEnumerator <EventBean> New(
            IEnumerator <EventBean> source,
            ResultSetProcessorRowPerGroup resultSetProcessor,
            AggregationService aggregationService,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            var eventsPerStream     = new EventBean[1];
            var priorSeenGroups     = new HashSet <object>();
            var evaluateParams      = new EvaluateParams(eventsPerStream, true, exprEvaluatorContext);
            var optionHavingNode    = resultSetProcessor.OptionalHavingNode;
            var selectExprProcessor = resultSetProcessor.SelectExprProcessor;

            while (source.MoveNext())
            {
                var candidate = source.Current;
                eventsPerStream[0] = candidate;
                var groupKey = resultSetProcessor.GenerateGroupKey(eventsPerStream, true);
                aggregationService.SetCurrentAccess(groupKey, exprEvaluatorContext.AgentInstanceId, null);

                if (optionHavingNode != null)
                {
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().QHavingClauseNonJoin(candidate);
                    }
                    var pass = resultSetProcessor.OptionalHavingNode.Evaluate(evaluateParams);
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().AHavingClauseJoin(pass.AsBoxedBoolean());
                    }
                    if ((pass != null) && false.Equals(pass))
                    {
                        continue;
                    }
                }

                if (priorSeenGroups.Contains(groupKey))
                {
                    continue;
                }

                priorSeenGroups.Add(groupKey);

                yield return(selectExprProcessor.Process(eventsPerStream, true, true, exprEvaluatorContext));
            }
        }
Esempio n. 6
0
 public ResultSetProcessorRowPerGroupOutputLastHelperImpl(ResultSetProcessorRowPerGroup processor)
 {
     _processor = processor;
 }
 public ResultSetProcessorRowPerGroupOutputLastHelper(ResultSetProcessorRowPerGroup processor)
 {
     this.processor = processor;
 }
 public ResultSetProcessorRowPerGroupOutputLastHelper MakeRSRowPerGroupOutputLastOpt(AgentInstanceContext agentInstanceContext, ResultSetProcessorRowPerGroup resultSetProcessorRowPerGroup, ResultSetProcessorRowPerGroupFactory prototype)
 {
     return(new ResultSetProcessorRowPerGroupOutputLastHelperImpl(resultSetProcessorRowPerGroup));
 }
 public ResultSetProcessorRowPerGroupOutputAllHelperImpl(ResultSetProcessorRowPerGroup processor)
 {
     this.processor = processor;
 }
Esempio n. 10
0
 public ResultSetProcessorRowPerGroupOutputAllHelper(ResultSetProcessorRowPerGroup processor)
 {
     Processor = processor;
 }