Beispiel #1
0
 public override IEnumerator <EventBean> GetEnumerator()
 {
     return(OutputStrategyUtil.GetEnumerator(
                base.JoinExecutionStrategy,
                base.ResultSetProcessor,
                Parent,
                false));
 }
Beispiel #2
0
 private void Output(bool forceUpdate, UniformPair <EventBean[]> results)
 {
     // Child view can be null in replay from named window
     if (ChildView != null)
     {
         OutputStrategyUtil.Output(forceUpdate, results, ChildView);
     }
 }
Beispiel #3
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);
            }
        }
Beispiel #4
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));
            }

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

            UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessViewResult(newData, oldData, isGenerateSynthetic);

            if (!base.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;
            }

            bool 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 (ChildView != null)
            {
                PostProcess(forceOutput, newOldEvents, ChildView);
            }
        }
Beispiel #5
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 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);
            }
        }
Beispiel #6
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"></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();
            }
        }
Beispiel #7
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 (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QOutputProcessNonBuffered(newData, oldData);
            }

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

            UniformPair <EventBean[]> newOldEvents = ResultSetProcessor.ProcessViewResult(newData, oldData, isGenerateSynthetic);

            if ((!isGenerateSynthetic) && (!isGenerateNatural))
            {
                if (AuditPath.IsAuditEnabled)
                {
                    OutputStrategyUtil.IndicateEarlyReturn(_parent.StatementContext, newOldEvents);
                }
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AOutputProcessNonBuffered();
                }
                return;
            }

            bool forceOutput =
                (newData == null) &&
                (oldData == null) &&
                ((newOldEvents == null) || (newOldEvents.First == null && newOldEvents.Second == null));

            // Child view can be null in replay from named window
            if (ChildView != null)
            {
                PostProcess(forceOutput, newOldEvents, ChildView);
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AOutputProcessNonBuffered();
            }
        }
Beispiel #8
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);
        }
Beispiel #9
0
 public override IEnumerator <EventBean> GetEnumerator()
 {
     return(OutputStrategyUtil.GetEnumerator(JoinExecutionStrategy, ResultSetProcessor, Parent, _parent.IsDistinct));
 }
Beispiel #10
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);
        }
 protected virtual void PostProcess(bool force, UniformPair <EventBean[]> newOldEvents, UpdateDispatchView childView)
 {
     OutputStrategyUtil.Output(force, newOldEvents, childView);
 }