예제 #1
0
        /// <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)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QOutputRateConditionOutputNow();
            }

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

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

            // Process the events and get the result
            UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessOutputLimitedJoin(
                _deltaSet.JoinEventsSet, 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);
            }
        }
예제 #2
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">expression evaluation 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));
            }

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

            // add the incoming events to the event batches
            if (!_witnessedFirst)
            {
                AddToChangeSet(_joinEventsSet, newEvents, oldEvents);
                var isGenerateSynthetic = _parent.StatementResultService.IsMakeSynthetic;

                var newOldEvents = ResultSetProcessor.ProcessOutputLimitedJoin(_joinEventsSet, isGenerateSynthetic, OutputLimitLimitType.FIRST);
                _joinEventsSet.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);
                }

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

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

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

            int newEventsSize = 0;

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

            int oldEventsSize = 0;

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

            _outputCondition.UpdateOutputCondition(newEventsSize, oldEventsSize);
        }