Пример #1
0
        /// <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);
            }
        }
Пример #2
0
        /// <summary>
        ///     The update method is called if the view does not participate in a join.
        /// </summary>
        /// <param name="newData">new events</param>
        /// <param name="oldData">old events</param>
        public override void Update(
            EventBean[] newData,
            EventBean[] oldData)
        {
            var statementResultService = _agentInstanceContext.StatementResultService;
            var isGenerateSynthetic = statementResultService.IsMakeSynthetic;
            var isGenerateNatural = statementResultService.IsMakeNatural;

            var newOldEvents = _resultSetProcessor.ProcessViewResult(newData, oldData, isGenerateSynthetic);

            if (!isGenerateSynthetic && !isGenerateNatural) {
                if (AuditPath.isAuditEnabled) {
                    OutputStrategyUtil.IndicateEarlyReturn(_agentInstanceContext.StatementContext, newOldEvents);
                }

                return;
            }

            var forceOutput = false;
            if (newData == null &&
                oldData == null &&
                (newOldEvents == null || newOldEvents.First == null && newOldEvents.Second == null)) {
                forceOutput = true;
            }

            // Child view can be null in replay from named window
            if (child != null) {
                PostProcess(forceOutput, newOldEvents, child);
            }
        }
Пример #3
0
        /// <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)
        {
            if (ExecutionPathDebugLog.IsDebugEnabled && log.IsDebugEnabled) {
                log.Debug(
                    ".process Received update, " +
                    "  newData.length==" +
                    (newEvents == null ? 0 : newEvents.Count) +
                    "  oldData.length==" +
                    (oldEvents == null ? 0 : oldEvents.Count));
            }

            var statementResultService = _agentInstanceContext.StatementResultService;
            var isGenerateSynthetic = statementResultService.IsMakeSynthetic;
            var isGenerateNatural = statementResultService.IsMakeNatural;

            var newOldEvents = _resultSetProcessor.ProcessJoinResult(newEvents, oldEvents, isGenerateSynthetic);

            if (!CheckAfterCondition(newOldEvents, _agentInstanceContext.StatementContext)) {
                return;
            }

            if (_parent.IsDistinct && newOldEvents != null) {
                newOldEvents.First = EventBeanUtility.GetDistinctByProp(newOldEvents.First, _parent.DistinctKeyGetter);
                newOldEvents.Second = EventBeanUtility.GetDistinctByProp(newOldEvents.Second, _parent.DistinctKeyGetter);
            }

            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);
            }
        }
        /// <summary>
        ///     Called once the output condition has been met.
        ///     Invokes the result set processor.
        ///     Used for join event data.
        /// </summary>
        /// <param name="doOutput">
        ///     true if the batched events should actually be output as well as processed, false if they should
        ///     just be processed
        /// </param>
        /// <param name="forceUpdate">true if output should be made even when no updating events have arrived</param>
        protected void ContinueOutputProcessingJoin(
            bool doOutput,
            bool forceUpdate)
        {
            _agentInstanceContext.InstrumentationProvider.QOutputRateConditionOutputNow();

            var statementResultService = _agentInstanceContext.StatementResultService;
            var isGenerateSynthetic = statementResultService.IsMakeSynthetic;
            var isGenerateNatural = statementResultService.IsMakeNatural;

            // Process the events and get the result
            var newOldEvents = _resultSetProcessor.ProcessOutputLimitedJoin(
                OptionalDeltaSet.JoinEventsSet,
                isGenerateSynthetic);

            if (_parent.IsDistinct && newOldEvents != null) {
                newOldEvents.First = EventBeanUtility.GetDistinctByProp(newOldEvents.First, _parent.DistinctKeyGetter);
                newOldEvents.Second = EventBeanUtility.GetDistinctByProp(newOldEvents.Second, _parent.DistinctKeyGetter);
            }

            if (!isGenerateSynthetic && !isGenerateNatural) {
                if (AuditPath.isAuditEnabled) {
                    OutputStrategyUtil.IndicateEarlyReturn(_agentInstanceContext.StatementContext, newOldEvents);
                }

                ResetEventBatches();
                _agentInstanceContext.InstrumentationProvider.AOutputRateConditionOutputNow(false);
                return;
            }

            if (doOutput) {
                Output(forceUpdate, newOldEvents);
            }

            ResetEventBatches();

            _agentInstanceContext.InstrumentationProvider.AOutputRateConditionOutputNow(true);
        }
        /// <summary>
        ///     The update method is called if the view does not participate in a join.
        /// </summary>
        /// <param name="newData">new events</param>
        /// <param name="oldData">old events</param>
        public override void Update(
            EventBean[] newData,
            EventBean[] oldData)
        {
            if (ExecutionPathDebugLog.IsDebugEnabled && Log.IsDebugEnabled) {
                Log.Debug(
                    ".update Received update, " +
                    "  newData.length==" +
                    (newData == null ? 0 : newData.Length) +
                    "  oldData.length==" +
                    (oldData == null ? 0 : oldData.Length));
            }

            if (!CheckAfterCondition(newData, _agentInstanceContext.StatementContext)) {
                return;
            }

            if (!_witnessedFirstHelper.WitnessedFirst) {
                var statementResultService = _agentInstanceContext.StatementResultService;
                var isGenerateSynthetic = statementResultService.IsMakeSynthetic;

                // Process the events and get the result
                _viewEventsList.Add(new UniformPair<EventBean[]>(newData, oldData));
                var newOldEvents =
                    _resultSetProcessor.ProcessOutputLimitedView(_viewEventsList, isGenerateSynthetic);
                _viewEventsList.Clear();

                if (!HasRelevantResults(newOldEvents)) {
                    return;
                }

                _witnessedFirstHelper.WitnessedFirst = true;

                if (_parent.IsDistinct) {
                    newOldEvents.First = EventBeanUtility.GetDistinctByProp(
                        newOldEvents.First,
                        _parent.DistinctKeyGetter);
                    newOldEvents.Second = EventBeanUtility.GetDistinctByProp(
                        newOldEvents.Second,
                        _parent.DistinctKeyGetter);
                }

                var isGenerateNatural = statementResultService.IsMakeNatural;
                if (!isGenerateSynthetic && !isGenerateNatural) {
                    if (AuditPath.isAuditEnabled) {
                        OutputStrategyUtil.IndicateEarlyReturn(_agentInstanceContext.StatementContext, newOldEvents);
                    }

                    return;
                }

                Output(true, newOldEvents);
            }
            else {
                _viewEventsList.Add(new UniformPair<EventBean[]>(newData, oldData));
                _resultSetProcessor.ProcessOutputLimitedView(_viewEventsList, false);
                _viewEventsList.Clear();
            }

            var newDataLength = 0;
            var oldDataLength = 0;
            if (newData != null) {
                newDataLength = newData.Length;
            }

            if (oldData != null) {
                oldDataLength = oldData.Length;
            }

            _outputCondition.UpdateOutputCondition(newDataLength, oldDataLength);
        }
        /// <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)
        {
            if (ExecutionPathDebugLog.IsDebugEnabled && Log.IsDebugEnabled) {
                Log.Debug(
                    ".process Received update, " +
                    "  newData.length==" +
                    (newEvents == null ? 0 : newEvents.Count) +
                    "  oldData.length==" +
                    (oldEvents == null ? 0 : oldEvents.Count));
            }

            if (!CheckAfterCondition(newEvents, _agentInstanceContext.StatementContext)) {
                return;
            }

            // add the incoming events to the event batches
            if (!_witnessedFirstHelper.WitnessedFirst) {
                var statementResultService = _agentInstanceContext.StatementResultService;

                AddToChangeSet(_joinEventsSet, newEvents, oldEvents);
                var isGenerateSynthetic = statementResultService.IsMakeSynthetic;
                var newOldEvents = _resultSetProcessor
                    .ProcessOutputLimitedJoin(_joinEventsSet, isGenerateSynthetic);
                _joinEventsSet.Clear();

                if (!HasRelevantResults(newOldEvents)) {
                    return;
                }

                _witnessedFirstHelper.WitnessedFirst = true;

                if (_parent.IsDistinct) {
                    newOldEvents.First = EventBeanUtility.GetDistinctByProp(
                        newOldEvents.First,
                        _parent.DistinctKeyGetter);
                    newOldEvents.Second = EventBeanUtility.GetDistinctByProp(
                        newOldEvents.Second,
                        _parent.DistinctKeyGetter);
                }

                var isGenerateNatural = statementResultService.IsMakeNatural;
                if (!isGenerateSynthetic && !isGenerateNatural) {
                    if (AuditPath.isAuditEnabled) {
                        OutputStrategyUtil.IndicateEarlyReturn(_agentInstanceContext.StatementContext, newOldEvents);
                    }

                    return;
                }

                Output(true, newOldEvents);
            }
            else {
                AddToChangeSet(_joinEventsSet, newEvents, oldEvents);

                // Process the events and get the result
                _resultSetProcessor.ProcessOutputLimitedJoin(_joinEventsSet, false);
                _joinEventsSet.Clear();
            }

            var newEventsSize = 0;
            if (newEvents != null) {
                newEventsSize = newEvents.Count;
            }

            var oldEventsSize = 0;
            if (oldEvents != null) {
                oldEventsSize = oldEvents.Count;
            }

            _outputCondition.UpdateOutputCondition(newEventsSize, oldEventsSize);
        }