Exemple #1
0
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)
        {
            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            if (_havingEval != null)
            {
                var pass = _havingEval.Evaluate(evaluateParams);
                if ((pass == null) || (false.Equals(pass)))
                {
                    return(null);
                }
            }
            var valueRight = SelectEval.Evaluate(evaluateParams);

            if (valueRight == null)
            {
                return(null);
            }
            return(Computer.Invoke(leftResult, valueRight));
        }
Exemple #2
0
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)

        {
            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            if (_havingEval != null)
            {
                var pass = _havingEval.Evaluate(evaluateParams);
                if ((pass == null) || (false.Equals(pass)))
                {
                    return(null);
                }
            }

            var rightResult = SelectEval.Evaluate(evaluateParams);

            if (rightResult == null)
            {
                return(null);
            }

            if (Coercer == null)
            {
                var eq = leftResult.Equals(rightResult);
                if ((IsNot && eq) || (!IsNot && !eq))
                {
                    return(false);
                }
            }
            else
            {
                var  left  = Coercer.Invoke(leftResult);
                var  right = Coercer.Invoke(rightResult);
                bool eq    = left.Equals(right);
                if ((IsNot && eq) || (!IsNot && !eq))
                {
                    return(false);
                }
            }
            return(true);
        }
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)
        {
            var hasNullRow     = false;
            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            foreach (EventBean theEvent in matchingEvents)
            {
                events[0] = theEvent;

                // Eval filter expression
                if (_filterEval != null)
                {
                    var pass = _filterEval.Evaluate(evaluateParams);
                    if ((pass == null) || (false.Equals(pass)))
                    {
                        continue;
                    }
                }
                if (leftResult == null)
                {
                    return(null);
                }

                Object rightResult;
                if (SelectEval != null)
                {
                    rightResult = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    rightResult = events[0].Underlying;
                }

                if (rightResult != null)
                {
                    if (Coercer == null)
                    {
                        bool eq = leftResult.Equals(rightResult);
                        if ((IsNot && eq) || (!IsNot && !eq))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        var left  = Coercer.Invoke(leftResult);
                        var right = Coercer.Invoke(rightResult);
                        var eq    = left.Equals(right);
                        if ((IsNot && eq) || (!IsNot && !eq))
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    hasNullRow = true;
                }
            }

            if (hasNullRow)
            {
                return(null);
            }
            return(true);
        }
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)
        {
            bool hasNonNullRow  = false;
            bool hasRows        = false;
            var  evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            foreach (EventBean subselectEvent in matchingEvents)
            {
                events[0] = subselectEvent;

                // Eval filter expression
                if (_filterEval != null)
                {
                    var pass = _filterEval.Evaluate(evaluateParams);
                    if ((pass == null) || (false.Equals(pass)))
                    {
                        continue;
                    }
                }
                hasRows = true;

                Object valueRight;
                if (SelectEval != null)
                {
                    valueRight = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    valueRight = events[0].Underlying;
                }

                if (valueRight != null)
                {
                    hasNonNullRow = true;
                }

                if ((leftResult != null) && (valueRight != null))
                {
                    if (Computer.Invoke(leftResult, valueRight))
                    {
                        return(true);
                    }
                }
            }

            if (!hasRows)
            {
                return(false);
            }
            if ((!hasNonNullRow) || (leftResult == null))
            {
                return(null);
            }
            return(false);
        }
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] eventsZeroOffset,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)
        {
            bool hasNullRow     = false;
            var  evaluateParams = new EvaluateParams(eventsZeroOffset, true, exprEvaluatorContext);

            foreach (EventBean subselectEvent in matchingEvents)
            {
                // Prepare filter expression event list
                eventsZeroOffset[0] = subselectEvent;

                // Eval filter expression
                var pass = _filterEval.Evaluate(evaluateParams);
                if ((pass == null) || (false.Equals(pass)))
                {
                    continue;
                }
                if (leftResult == null)
                {
                    return(null);
                }

                Object rightResult;
                if (SelectEval != null)
                {
                    rightResult = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    rightResult = eventsZeroOffset[0].Underlying;
                }

                if (rightResult == null)
                {
                    hasNullRow = true;
                }
                else
                {
                    if (Coercer == null)
                    {
                        if (leftResult.Equals(rightResult))
                        {
                            return(!IsNotIn);
                        }
                    }
                    else
                    {
                        var left  = Coercer.Invoke(leftResult);
                        var right = Coercer.Invoke(rightResult);
                        if (left.Equals(right))
                        {
                            return(!IsNotIn);
                        }
                    }
                }
            }

            if (hasNullRow)
            {
                return(null);
            }

            return(IsNotIn);
        }
Exemple #6
0
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationServiceAnyPartition)
        {
            var aggregationService =
                aggregationServiceAnyPartition.GetContextPartitionAggregationService(
                    exprEvaluatorContext.AgentInstanceId);
            var groupKeys  = aggregationService.GetGroupKeys(exprEvaluatorContext);
            var hasNullRow = false;

            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            foreach (var groupKey in groupKeys)
            {
                if (leftResult == null)
                {
                    return(null);
                }
                aggregationService.SetCurrentAccess(groupKey, exprEvaluatorContext.AgentInstanceId, null);

                if (_havingEval != null)
                {
                    var pass = _havingEval.Evaluate(evaluateParams);
                    if ((pass == null) || (false.Equals(pass)))
                    {
                        continue;
                    }
                }

                Object rightResult;
                if (SelectEval != null)
                {
                    rightResult = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    rightResult = events[0].Underlying;
                }

                if (rightResult != null)
                {
                    if (Coercer == null)
                    {
                        var eq = leftResult.Equals(rightResult);
                        if ((IsNot && !eq) || (!IsNot && eq))
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        var left  = Coercer.Invoke(leftResult);
                        var right = Coercer.Invoke(rightResult);
                        var eq    = left.Equals(right);
                        if ((IsNot && !eq) || (!IsNot && eq))
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    hasNullRow = true;
                }
            }

            if (hasNullRow)
            {
                return(null);
            }
            return(false);
        }
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationServiceAnyPartition)
        {
            AggregationService aggregationService =
                aggregationServiceAnyPartition.GetContextPartitionAggregationService(
                    exprEvaluatorContext.AgentInstanceId);
            ICollection <Object> groupKeys = aggregationService.GetGroupKeys(exprEvaluatorContext);
            bool hasRows    = false;
            bool hasNullRow = false;

            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            foreach (Object groupKey in groupKeys)
            {
                aggregationService.SetCurrentAccess(groupKey, exprEvaluatorContext.AgentInstanceId, null);
                if (_havingEval != null)
                {
                    var pass = _havingEval.Evaluate(evaluateParams);
                    if ((pass == null) || (false.Equals(pass)))
                    {
                        continue;
                    }
                }
                hasRows = true;

                Object valueRight;
                if (SelectEval != null)
                {
                    valueRight = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    valueRight = events[0].Underlying;
                }

                if (valueRight == null)
                {
                    hasNullRow = true;
                }
                else
                {
                    if (leftResult != null)
                    {
                        if (!Computer.Invoke(leftResult, valueRight))
                        {
                            return(false);
                        }
                    }
                }
            }

            if (!hasRows)
            {
                return(true);
            }
            if (leftResult == null)
            {
                return(null);
            }
            if (hasNullRow)
            {
                return(null);
            }
            return(true);
        }
        protected override Object EvaluateInternal(
            Object leftResult,
            EventBean[] events,
            bool isNewData,
            ICollection <EventBean> matchingEvents,
            ExprEvaluatorContext exprEvaluatorContext,
            AggregationService aggregationService)
        {
            if (leftResult == null)
            {
                return(null);
            }

            var evaluateParams = new EvaluateParams(events, true, exprEvaluatorContext);

            // Evaluate each select until we have a match
            bool hasNullRow = false;

            foreach (EventBean theEvent in matchingEvents)
            {
                events[0] = theEvent;

                Object rightResult;
                if (SelectEval != null)
                {
                    rightResult = SelectEval.Evaluate(evaluateParams);
                }
                else
                {
                    rightResult = events[0].Underlying;
                }

                if (rightResult != null)
                {
                    if (Coercer == null)
                    {
                        if (leftResult.Equals(rightResult))
                        {
                            return(!IsNotIn);
                        }
                    }
                    else
                    {
                        var left  = Coercer.Invoke(leftResult);
                        var right = Coercer.Invoke(rightResult);
                        if (left.Equals(right))
                        {
                            return(!IsNotIn);
                        }
                    }
                }
                else
                {
                    hasNullRow = true;
                }
            }

            if (hasNullRow)
            {
                return(null);
            }
            return(IsNotIn);
        }