public void PreloadAggregation(ResultSetProcessor resultSetProcessor) { var newEvents = _joinSetComposer.StaticJoin(); var oldEvents = new HashSet <MultiKey <EventBean> >(); resultSetProcessor.ProcessJoinResult(newEvents, oldEvents, false); }
/// <summary> /// This process (update) method is for participation in a join. /// </summary> /// <param name="newEvents">new events</param> /// <param name="oldEvents">old events</param> /// <param name="exprEvaluatorContext">the evaluator context</param> public override void Process( ISet<MultiKeyArrayOfKeys<EventBean>> newEvents, ISet<MultiKeyArrayOfKeys<EventBean>> oldEvents, ExprEvaluatorContext exprEvaluatorContext) { var statementResultService = _agentInstanceContext.StatementResultService; var isGenerateSynthetic = statementResultService.IsMakeSynthetic; var isGenerateNatural = statementResultService.IsMakeNatural; var newOldEvents = _resultSetProcessor.ProcessJoinResult(newEvents, oldEvents, isGenerateSynthetic); if (!isGenerateSynthetic && !isGenerateNatural) { if (AuditPath.isAuditEnabled) { OutputStrategyUtil.IndicateEarlyReturn(_agentInstanceContext.StatementContext, newOldEvents); } return; } if (newOldEvents == null) { return; } // Child view can be null in replay from named window if (child != null) { PostProcess(false, newOldEvents, child); } }
public override void HandleMatching( EventBean[] triggerEvents, EventBean[] matchingEvents) { agentInstanceContext.InstrumentationProvider.QInfraOnAction( OnTriggerType.ON_SELECT, triggerEvents, matchingEvents); // clear state from prior results resultSetProcessor.Clear(); // build join result // use linked hash set to retain order of join results for last/first/window to work most intuitively ISet<MultiKeyArrayOfKeys<EventBean>> newEvents = OnExprViewNamedWindowSelect.BuildJoinResult(triggerEvents, matchingEvents); // process matches UniformPair<EventBean[]> pair = resultSetProcessor.ProcessJoinResult( newEvents, Collections.GetEmptySet<MultiKeyArrayOfKeys<EventBean>>(), false); EventBean[] newData = pair?.First; // handle distinct and insert newData = InfraOnSelectUtil.HandleDistintAndInsert( newData, parent, agentInstanceContext, tableInstanceInsertInto, audit); // The on-select listeners receive the events selected if ((newData != null) && (newData.Length > 0)) { // And post only if we have listeners/subscribers that need the data StatementResultService statementResultService = agentInstanceContext.StatementResultService; if (statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic) { Child.Update(newData, null); } } // clear state from prior results resultSetProcessor.Clear(); // Events to delete are indicated via old data if (deleteAndSelect) { foreach (EventBean @event in matchingEvents) { tableInstance.DeleteEvent(@event); } } agentInstanceContext.InstrumentationProvider.AInfraOnAction(); }
public override void HandleMatching( EventBean[] triggerEvents, EventBean[] matchingEvents) { agentInstanceContext.InstrumentationProvider.QInfraOnAction( OnTriggerType.ON_SELECT, triggerEvents, matchingEvents); // clear state from prior results resultSetProcessor.Clear(); // build join result // use linked hash set to retain order of join results for last/first/window to work most intuitively var newEvents = BuildJoinResult(triggerEvents, matchingEvents); // process matches var pair = resultSetProcessor.ProcessJoinResult(newEvents, oldEvents, false); var newData = pair != null ? pair.First : null; // handle distinct and insert newData = InfraOnSelectUtil.HandleDistintAndInsert( newData, parent, agentInstanceContext, tableInstanceInsertInto, audit); // The on-select listeners receive the events selected if (newData != null && newData.Length > 0) { if (Child != null) { // And post only if we have listeners/subscribers that need the data var statementResultService = agentInstanceContext.StatementResultService; if (statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic) { Child.Update(newData, null); } } } // clear state from prior results resultSetProcessor.Clear(); // Events to delete are indicated via old data if (isDelete) { rootView.Update(null, matchingEvents); } agentInstanceContext.InstrumentationProvider.AInfraOnAction(); }
/// <summary> /// This process (update) method is for participation in a join. /// </summary> /// <param name="newEvents">- new events</param> /// <param name="oldEvents">- old events</param> /// <param name="exprEvaluatorContext">The expr evaluator context.</param> public override void Process( ISet <MultiKey <EventBean> > newEvents, ISet <MultiKey <EventBean> > oldEvents, ExprEvaluatorContext exprEvaluatorContext) { if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".process Received update, " + " newData.Length==" + ((newEvents == null) ? 0 : newEvents.Count) + " oldData.Length==" + ((oldEvents == null) ? 0 : oldEvents.Count)); } bool isGenerateSynthetic = _parent.StatementResultService.IsMakeSynthetic; bool isGenerateNatural = _parent.StatementResultService.IsMakeNatural; UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessJoinResult(newEvents, oldEvents, isGenerateSynthetic); if (!CheckAfterCondition(newOldEvents, _parent.StatementContext)) { return; } if (_parent.IsDistinct && newOldEvents != null) { newOldEvents.First = EventBeanUtility.GetDistinctByProp(newOldEvents.First, _parent.EventBeanReader); newOldEvents.Second = EventBeanUtility.GetDistinctByProp(newOldEvents.Second, _parent.EventBeanReader); } if ((!isGenerateSynthetic) && (!isGenerateNatural)) { if (AuditPath.IsAuditEnabled) { OutputStrategyUtil.IndicateEarlyReturn(_parent.StatementContext, newOldEvents); } return; } if (newOldEvents == null) { return; } // Child view can be null in replay from named window if (ChildView != null) { PostProcess(false, newOldEvents, ChildView); } }
/// <summary>This process (Update) method is for participation in a join. </summary> /// <param name="newEvents">new events</param> /// <param name="oldEvents">old events</param> /// <param name="exprEvaluatorContext"></param> public override void Process(ISet <MultiKey <EventBean> > newEvents, ISet <MultiKey <EventBean> > oldEvents, ExprEvaluatorContext exprEvaluatorContext) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QOutputProcessNonBufferedJoin(newEvents, oldEvents); } bool isGenerateSynthetic = _parent.StatementResultService.IsMakeSynthetic; bool isGenerateNatural = _parent.StatementResultService.IsMakeNatural; UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessJoinResult(newEvents, oldEvents, isGenerateSynthetic); if ((!isGenerateSynthetic) && (!isGenerateNatural)) { if (AuditPath.IsAuditEnabled) { OutputStrategyUtil.IndicateEarlyReturn(_parent.StatementContext, newOldEvents); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputProcessNonBufferedJoin(); } return; } if (newOldEvents == null) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputProcessNonBufferedJoin(); } return; } // Child view can be null in replay from named window if (ChildView != null) { PostProcess(false, newOldEvents, ChildView); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputProcessNonBufferedJoin(); } }
public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_SELECT, triggerEvents, matchingEvents); } EventBean[] newData; // clear state from prior results _resultSetProcessor.Clear(); // build join result // use linked hash set to retain order of join results for last/first/window to work most intuitively ISet <MultiKey <EventBean> > newEvents = NamedWindowOnSelectView.BuildJoinResult(triggerEvents, matchingEvents); // process matches UniformPair <EventBean[]> pair = _resultSetProcessor.ProcessJoinResult(newEvents, Collections.GetEmptySet <MultiKey <EventBean> >(), false); newData = (pair != null ? pair.First : null); if (_parent.IsDistinct) { newData = EventBeanUtility.GetDistinctByProp(newData, _parent.EventBeanReader); } if (_parent.InternalEventRouter != null) { if (newData != null) { for (int i = 0; i < newData.Length; i++) { if (_audit) { AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, newData[i]); } _parent.InternalEventRouter.Route(newData[i], _parent.StatementHandle, _parent.InternalEventRouteDest, ExprEvaluatorContext, false); } } } // The on-select listeners receive the events selected if ((newData != null) && (newData.Length > 0)) { // And post only if we have listeners/subscribers that need the data if (_parent.StatementResultService.IsMakeNatural || _parent.StatementResultService.IsMakeSynthetic) { UpdateChildren(newData, null); } } // clear state from prior results _resultSetProcessor.Clear(); // Events to delete are indicated via old data if (_deleteAndSelect) { foreach (EventBean @event in matchingEvents) { TableStateInstance.DeleteEvent(@event); } } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AInfraOnAction(); } }
public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_SELECT, triggerEvents, matchingEvents); } EventBean[] newData; // clear state from prior results _resultSetProcessor.Clear(); // build join result // use linked hash set to retain order of join results for last/first/window to work most intuitively var newEvents = BuildJoinResult(triggerEvents, matchingEvents); // process matches var pair = _resultSetProcessor.ProcessJoinResult(newEvents, _oldEvents, false); newData = (pair != null ? pair.First : null); if (_parent.IsDistinct) { newData = EventBeanUtility.GetDistinctByProp(newData, _parent.EventBeanReader); } if (_tableStateInstanceInsertInto != null) { if (newData != null) { foreach (var aNewData in newData) { if (_audit) { AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, aNewData); } _tableStateInstanceInsertInto.AddEventUnadorned(aNewData); } } } else if (_parent.InternalEventRouter != null) { if (newData != null) { foreach (var aNewData in newData) { if (_audit) { AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, aNewData); } _parent.InternalEventRouter.Route(aNewData, _parent.StatementHandle, _parent.InternalEventRouteDest, ExprEvaluatorContext, _parent.IsAddToFront); } } } // The on-select listeners receive the events selected if ((newData != null) && (newData.Length > 0)) { // And post only if we have listeners/subscribers that need the data if (_parent.StatementResultService.IsMakeNatural || _parent.StatementResultService.IsMakeSynthetic) { UpdateChildren(newData, null); } } _lastResult = newData; // clear state from prior results _resultSetProcessor.Clear(); // Events to delete are indicated via old data if (_isDelete) { RootView.Update(null, matchingEvents); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AInfraOnAction(); } }
public override void Process(ISet <MultiKey <EventBean> > newEvents, ISet <MultiKey <EventBean> > oldEvents, ExprEvaluatorContext exprEvaluatorContext) { UniformPair <EventBean[]> pair = ResultSetProcessor.ProcessJoinResult(newEvents, oldEvents, false); _callback.OutputViaCallback(pair.First); }
public EPPreparedQueryResult Execute( FAFQueryMethodSelect select, ContextPartitionSelector[] contextPartitionSelectors, FAFQueryMethodAssignerSetter assignerSetter, ContextManagementService contextManagementService) { int numStreams = select.Processors.Length; ICollection<EventBean>[] snapshots = new ICollection<EventBean>[numStreams]; AgentInstanceContext agentInstanceContext = null; Viewable[] viewablePerStream = new Viewable[numStreams]; for (int i = 0; i < numStreams; i++) { FireAndForgetProcessor processor = select.Processors[i]; FireAndForgetInstance processorInstance = processor.ProcessorInstanceNoContext; snapshots[i] = Snapshot( select.ConsumerFilters[i], processorInstance, select.QueryGraph, select.Annotations); agentInstanceContext = processorInstance.AgentInstanceContext; viewablePerStream[i] = processorInstance.TailViewInstance; } // get RSP ResultSetProcessor resultSetProcessor = ProcessorWithAssign( select.ResultSetProcessorFactoryProvider, agentInstanceContext, assignerSetter, select.TableAccesses, select.Subselects); // determine join JoinSetComposerDesc joinSetComposerDesc = select.JoinSetComposerPrototype.Create( viewablePerStream, true, agentInstanceContext, false); JoinSetComposer joinComposer = joinSetComposerDesc.JoinSetComposer; EventBean[][] oldDataPerStream = new EventBean[numStreams][]; EventBean[][] newDataPerStream = new EventBean[numStreams][]; for (int i = 0; i < numStreams; i++) { newDataPerStream[i] = snapshots[i].ToArray(); } UniformPair<ISet<MultiKeyArrayOfKeys<EventBean>>> result = joinComposer.Join( newDataPerStream, oldDataPerStream, agentInstanceContext); if (joinSetComposerDesc.PostJoinFilterEvaluator != null) { JoinSetComposerUtil.Filter( joinSetComposerDesc.PostJoinFilterEvaluator, result.First, true, agentInstanceContext); } UniformPair<EventBean[]> results = resultSetProcessor.ProcessJoinResult(result.First, null, true); EventBean[] distinct = EventBeanUtility.GetDistinctByProp(results.First, select.DistinctKeyGetter); return new EPPreparedQueryResult(resultSetProcessor.ResultEventType, distinct); }