public static void AssignExpressionStrategies( EPStatementStartMethodSelectDesc selectDesc, AggregationService aggregationService, IDictionary <ExprSubselectNode, SubSelectStrategyHolder> subselectStrategyInstances, IDictionary <ExprPriorNode, ExprPriorEvalStrategy> priorStrategyInstances, IDictionary <ExprPreviousNode, ExprPreviousEvalStrategy> previousStrategyInstances, ICollection <ExprPreviousMatchRecognizeNode> matchRecognizeNodes, RegexExprPreviousEvalStrategy matchRecognizePrevEvalStrategy, IDictionary <ExprTableAccessNode, ExprTableAccessEvalStrategy> tableAccessStrategyInstances) { // initialize aggregation expression nodes if (selectDesc.ResultSetProcessorPrototypeDesc.AggregationServiceFactoryDesc != null && aggregationService != null) { EPStatementStartMethodHelperAssignExpr.AssignAggregations(aggregationService, selectDesc.ResultSetProcessorPrototypeDesc.AggregationServiceFactoryDesc.Expressions); } // assign subquery nodes AssignSubqueryStrategies(selectDesc.SubSelectStrategyCollection, subselectStrategyInstances); // assign prior nodes AssignPriorStrategies(priorStrategyInstances); // assign previous nodes AssignPreviousStrategies(previousStrategyInstances); // assign match-recognize previous nodes AssignMatchRecognizePreviousStrategies(matchRecognizeNodes, matchRecognizePrevEvalStrategy); // assign table access nodes AssignTableAccessStrategies(tableAccessStrategyInstances); }
public static ResultSetProcessor GetAssignResultSetProcessor(AgentInstanceContext agentInstanceContext, ResultSetProcessorFactoryDesc resultSetProcessorPrototype) { AggregationService aggregationService = null; if (resultSetProcessorPrototype.AggregationServiceFactoryDesc != null) { aggregationService = resultSetProcessorPrototype.AggregationServiceFactoryDesc.AggregationServiceFactory.MakeService(agentInstanceContext, agentInstanceContext.StatementContext.MethodResolutionService); } OrderByProcessor orderByProcessor = null; if (resultSetProcessorPrototype.OrderByProcessorFactory != null) { orderByProcessor = resultSetProcessorPrototype.OrderByProcessorFactory.Instantiate( aggregationService, agentInstanceContext); } var processor = resultSetProcessorPrototype.ResultSetProcessorFactory.Instantiate(orderByProcessor, aggregationService, agentInstanceContext); // initialize aggregation expression nodes if (resultSetProcessorPrototype.AggregationServiceFactoryDesc != null) { foreach (var aggregation in resultSetProcessorPrototype.AggregationServiceFactoryDesc.Expressions) { aggregation.AssignFuture(aggregationService); } } return(processor); }
public override void Evaluate( EventBean[] eventsPerStream, ICollection <EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext) { AggregationService.ClearResults(exprEvaluatorContext); if (matchingEvents == null) { return; } var events = new EventBean[eventsPerStream.Length + 1]; Array.Copy(eventsPerStream, 0, events, 1, eventsPerStream.Length); var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext); foreach (EventBean subselectEvent in matchingEvents) { events[0] = subselectEvent; var pass = (bool?)FilterExpr.Evaluate(evaluateParams); if (pass ?? false) { AggregationService.ApplyEnter(events, null, exprEvaluatorContext); } } }
public SubselectAggregationPreprocessorFilteredUngrouped( AggregationService aggregationService, ExprEvaluator filterExpr, ExprEvaluator[] groupKeys) : base(aggregationService, filterExpr, groupKeys) { }
public ResultSetProcessor Instantiate(OrderByProcessor orderByProcessor, AggregationService aggregationService, AgentInstanceContext agentInstanceContext) { if (_noDataWindowSingleSnapshot && !IsHistoricalOnly) { return(new ResultSetProcessorRowPerGroupRollupUnbound(this, orderByProcessor, aggregationService, agentInstanceContext)); } return(new ResultSetProcessorRowPerGroupRollup(this, orderByProcessor, aggregationService, agentInstanceContext)); }
public void AssignService( int serviceId, AggregationService aggregationService) { AIRegistryUtil.CheckExpand(serviceId, services); services.Array[serviceId] = aggregationService; InstanceCount++; }
public SubselectAggregatorViewUnfilteredUngrouped( AggregationService aggregationService, ExprEvaluator optionalFilterExpr, ExprEvaluatorContext exprEvaluatorContext, ExprEvaluator[] groupKeys) : base(aggregationService, optionalFilterExpr, exprEvaluatorContext, groupKeys) { }
public JsonResult ReIndex(int bucketSize = 2048, int poolSize = 10) { if (!Core.Services.ReIndexState.IsIndexing) { AggregationService.ReIndex(bucketSize, poolSize); } return(Json(Core.Services.ReIndexState.GetAsStruct())); }
protected SubselectAggregationPreprocessorBase( AggregationService aggregationService, ExprEvaluator filterExpr, ExprEvaluator[] groupKeys) { AggregationService = aggregationService; FilterExpr = filterExpr; GroupKeys = groupKeys; }
public Object Evaluate( EventBean[] eventsPerStream, bool isNewData, ICollection <EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, AggregationService aggregationService) { return(true); }
public SubselectAggregationPreprocessorBase( AggregationService aggregationService, ExprEvaluator filterEval, ExprEvaluator groupKeys) { this.aggregationService = aggregationService; this.filterEval = filterEval; this.groupKeys = groupKeys; }
public CFAggregationIndexViewModel(CFAggregation aggregation) { Name = aggregation.Name; Id = aggregation.Id; MappedGuid = aggregation.MappedGuid; EntityType = aggregation.EntityType.Name; string modelType = aggregation.Data.Attribute("model-type").Value; Label = AggregationService.GetModelTypeLabel(modelType); }
public SubselectAggregationPreprocessorUnfilteredGrouped( AggregationService aggregationService, ExprEvaluator filterEval, ExprEvaluator groupKeys) : base( aggregationService, filterEval, groupKeys) { }
public SubselectAggregatorViewFilteredGrouped( AggregationService aggregationService, ExprEvaluator optionalFilterExpr, ExprEvaluatorContext exprEvaluatorContext, ExprEvaluator[] groupKeys, ExprNode filterExprNode) : base(aggregationService, optionalFilterExpr, exprEvaluatorContext, groupKeys) { _filterExprNode = filterExprNode; }
public ResultSetProcessorAggregateAll(ResultSetProcessorAggregateAllFactory prototype, SelectExprProcessor selectExprProcessor, OrderByProcessor orderByProcessor, AggregationService aggregationService, ExprEvaluatorContext exprEvaluatorContext) { _prototype = prototype; _selectExprProcessor = selectExprProcessor; _orderByProcessor = orderByProcessor; _aggregationService = aggregationService; _exprEvaluatorContext = exprEvaluatorContext; _outputLastUnordHelper = prototype.IsOutputLast ? new ResultSetProcessorAggregateAllOutputLastHelper(this) : null; _outputAllUnordHelper = prototype.IsOutputAll ? new ResultSetProcessorAggregateAllOutputAllHelper(this) : null; }
public void Setup() { _unitOfWork = new Mock <IUnitOfWork>(); var options = new Mock <IOptions <MonitoringSettings> >(); options.Setup(x => x.Value).Returns(MonitoringSettings); _aggregationService = new AggregationService(_unitOfWork.Object, options.Object); }
public SubselectAggregatorViewBase( AggregationService aggregationService, ExprEvaluator optionalFilterExpr, ExprEvaluatorContext exprEvaluatorContext, ExprEvaluator groupKeys) { this.aggregationService = aggregationService; this.optionalFilterExpr = optionalFilterExpr; this.exprEvaluatorContext = exprEvaluatorContext; this.groupKeys = groupKeys; }
public SubselectAggregatorViewBase( AggregationService aggregationService, ExprEvaluator optionalFilterExpr, ExprEvaluatorContext exprEvaluatorContext, ExprEvaluator[] groupKeys) { AggregationService = aggregationService; OptionalFilterExpr = optionalFilterExpr; ExprEvaluatorContext = exprEvaluatorContext; GroupKeys = groupKeys; }
/// <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)); }
public override UniformPair <EventBean[]> ProcessViewResult(EventBean[] newData, EventBean[] oldData, bool isSynthesize) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QResultSetProcessGroupedRowPerGroup(); } var newDataMultiKey = GenerateGroupKeysView(newData, EventPerGroupBuf, true); var oldDataMultiKey = GenerateGroupKeysView(oldData, EventPerGroupBuf, false); EventBean[] selectOldEvents = null; if (Prototype.IsSelectRStream) { selectOldEvents = GenerateOutputEventsView(EventPerGroupBuf, false, isSynthesize); } // update aggregates var eventsPerStream = new EventBean[1]; if (newData != null) { for (var i = 0; i < newData.Length; i++) { eventsPerStream[0] = newData[i]; AggregationService.ApplyEnter(eventsPerStream, newDataMultiKey[i], AgentInstanceContext); } } if (oldData != null) { for (var i = 0; i < oldData.Length; i++) { eventsPerStream[0] = oldData[i]; AggregationService.ApplyLeave(eventsPerStream, oldDataMultiKey[i], AgentInstanceContext); } } // generate new events using select expressions var selectNewEvents = GenerateOutputEventsView(EventPerGroupBuf, true, isSynthesize); if ((selectNewEvents != null) || (selectOldEvents != null)) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AResultSetProcessGroupedRowPerGroup(selectNewEvents, selectOldEvents); } return(new UniformPair <EventBean[]>(selectNewEvents, selectOldEvents)); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AResultSetProcessGroupedRowPerGroup(null, null); } return(null); }
public void NoPets_NotIncludedInResults_Test() { var service = new AggregationService(); var result = service.Aggregate(mockPeople, p => p.Name, p => p.Name != null, p => p.Type ); Assert.False(result.ContainsKey("Ann")); }
public void GroupByPersonName_FilterByPetName_ProjectType_Test() { var service = new AggregationService(); var result = service.Aggregate(mockPeople, p => p.Name, p => p.Name == "Snappy", p => p.Type ); Assert.NotEmpty(result); Assert.Equal(PetType.Dog, result["John"].First()); }
public Object Evaluate( EventBean[] eventsPerStream, bool isNewData, ICollection <EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, AggregationService aggregationService) { if (matchingEvents == null || matchingEvents.Count == 0) { return(false); } return(!aggregationService.GetGroupKeys(exprEvaluatorContext).IsEmpty()); }
public async void NoPeople_DoesNotThrow_Test() { ICollection <Person> people = null; var personProviderMock = new Mock <IPersonProvider>(); personProviderMock.Setup(c => c.LoadPeople()) .Returns(() => Task.FromResult(people)); var aggregationService = new AggregationService(); var service = new CatLoaderService(personProviderMock.Object, aggregationService); await service.Run(); }
public void GroupByGender_FilterByPetType_ProjectName_Test() { var service = new AggregationService(); var result = service.Aggregate(mockPeople, p => p.Gender, p => p.Type == PetType.Fish, p => p.Name ); Assert.NotEmpty(result); Assert.Equal("Talky", result[Gender.Female].First()); }
/// <summary> /// Ctor. /// </summary> /// <param name="sourceIterator">is the parent iterator</param> /// <param name="resultSetProcessor">for constructing result rows</param> /// <param name="aggregationService">for pointing to the right aggregation row</param> /// <param name="exprEvaluatorContext">context for expression evalauation</param> public ResultSetAggregateGroupedIterator( IEnumerator <EventBean> sourceIterator, ResultSetProcessorAggregateGrouped resultSetProcessor, AggregationService aggregationService, ExprEvaluatorContext exprEvaluatorContext) { _sourceIterator = sourceIterator; _resultSetProcessor = resultSetProcessor; _aggregationService = aggregationService; _eventsPerStream = new EventBean[1]; _exprEvaluatorContext = exprEvaluatorContext; _currResult = null; _iterate = true; }
public SubSelectFactoryResult( ViewableActivationResult subselectActivationResult, SubSelectStrategyRealization realization, SubordTableLookupStrategy lookupStrategy) { this.subselectActivationResult = subselectActivationResult; this.lookupStrategy = lookupStrategy; this.subselectAggregationPreprocessor = realization.SubselectAggregationPreprocessor; this.aggregationService = realization.AggregationService; this.priorStrategy = realization.PriorStrategy; this.previousStrategy = realization.PreviousStrategy; this.subselectView = realization.SubselectView; this.indexes = realization.Indexes; }
public SubSelectStrategyHolder(ExprSubselectStrategy stategy, AggregationService subselectAggregationService, IDictionary <ExprPriorNode, ExprPriorEvalStrategy> priorStrategies, IDictionary <ExprPreviousNode, ExprPreviousEvalStrategy> previousNodeStrategies, Viewable subselectView, StatementAgentInstancePostLoad postLoad) { Stategy = stategy; SubselectAggregationService = subselectAggregationService; PriorStrategies = priorStrategies; PreviousNodeStrategies = previousNodeStrategies; SubselectView = subselectView; PostLoad = postLoad; }
public void Assign( int agentInstanceId, SubordTableLookupStrategy lookupStrategy, AggregationService aggregationService, PriorEvalStrategy priorEvalStrategy, PreviousGetterStrategy previousGetterStrategy) { LookupStrategies.AssignService(agentInstanceId, lookupStrategy); AggregationServices?.AssignService(agentInstanceId, aggregationService); PriorEvalStrategies?.AssignService(agentInstanceId, priorEvalStrategy); PreviousGetterStrategies?.AssignService(agentInstanceId, previousGetterStrategy); }
public StatementAIFactoryAssignmentsImpl( AggregationService aggregationResultFuture, PriorEvalStrategy[] priorStrategies, PreviousGetterStrategy[] previousStrategies, IDictionary<int, SubSelectFactoryResult> subselects, IDictionary<int, ExprTableEvalStrategy> tableAccesses, RowRecogPreviousStrategy rowRecogPreviousStrategy) { AggregationResultFuture = aggregationResultFuture; PriorStrategies = priorStrategies; PreviousStrategies = previousStrategies; Subselects = subselects; this.tableAccesses = tableAccesses; RowRecogPreviousStrategy = rowRecogPreviousStrategy; }