Esempio n. 1
0
        /// <summary>
        /// Called once the output condition has been met.
        /// Invokes the result set processor.
        /// Used for non-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 ContinueOutputProcessingView(bool doOutput, bool forceUpdate)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QOutputRateConditionOutputNow();
            }

            if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled))
            {
                Log.Debug(".continueOutputProcessingView");
            }

            bool isGenerateSynthetic = _parent.StatementResultService.IsMakeSynthetic;
            bool isGenerateNatural   = _parent.StatementResultService.IsMakeNatural;

            // Process the events and get the result
            UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessOutputLimitedView(
                _deltaSet.ViewEventsSet, isGenerateSynthetic, _parent.OutputLimitLimitType);

            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);
                }
                ResetEventBatches();
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AOutputRateConditionOutputNow(false);
                }
                return;
            }

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

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AOutputRateConditionOutputNow(true);
            }
        }
Esempio n. 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)
        {
            if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled))
            {
                Log.Debug(".Update Received Update, " +
                          "  newData.Length==" + ((newData == null) ? 0 : newData.Length) +
                          "  oldData.Length==" + ((oldData == null) ? 0 : oldData.Length));
            }

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

            if (!_witnessedFirst)
            {
                var isGenerateSynthetic = _parent.StatementResultService.IsMakeSynthetic;

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

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

                _witnessedFirst = true;

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

                var isGenerateNatural = _parent.StatementResultService.IsMakeNatural;
                if ((!isGenerateSynthetic) && (!isGenerateNatural))
                {
                    if (AuditPath.IsAuditEnabled)
                    {
                        OutputStrategyUtil.IndicateEarlyReturn(_parent.StatementContext, newOldEvents);
                    }
                    return;
                }

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

            int newDataLength = 0;
            int oldDataLength = 0;

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

            _outputCondition.UpdateOutputCondition(newDataLength, oldDataLength);
        }