Esempio n. 1
0
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            TypeInfo = EPTypeHelper.SingleValue(typeof(bool));
            if (inputEventType != null)
            {
                if (EnumMethodEnum == EnumMethodEnum.ALLOF)
                {
                    return(new EnumEvalAllOfEvents(first.BodyEvaluator, first.StreamCountIncoming));
                }
                return(new EnumEvalAnyOfEvents(first.BodyEvaluator, first.StreamCountIncoming));
            }

            if (EnumMethodEnum == EnumMethodEnum.ALLOF)
            {
                return(new EnumEvalAllOfScalar(
                           first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            return(new EnumEvalAnyOfScalar(
                       first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0]));
        }
Esempio n. 2
0
 public override AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService)
 {
     return(new AggSvcGroupByRefcountedNoAccessImpl(
                Evaluators, Aggregators, GroupKeyBinding, methodResolutionService));
 }
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            bool isDescending = EnumMethodEnum == EnumMethodEnum.ORDERBYDESC;

            if (bodiesAndParameters.IsEmpty())
            {
                base.TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType);
                return(new EnumEvalOrderByAscDescScalar(numStreamsIncoming, isDescending));
            }

            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            if (inputEventType == null)
            {
                base.TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType);
                return(new EnumEvalOrderByAscDescScalarLambda(
                           first.BodyEvaluator, first.StreamCountIncoming, isDescending,
                           (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            base.TypeInfo = EPTypeHelper.CollectionOfEvents(inputEventType);
            return(new EnumEvalOrderByAscDescEvents(first.BodyEvaluator, first.StreamCountIncoming, isDescending));
        }
Esempio n. 4
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            base.TypeInfo = EPTypeHelper.SingleValue(typeof(GroupMap));
            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            if (bodiesAndParameters.Count == 2)
            {
                var second = (ExprDotEvalParamLambda)bodiesAndParameters[1];
                if (inputEventType == null)
                {
                    return(new EnumEvalGroupByKeyValueSelectorScalarLambda(
                               first.BodyEvaluator, first.StreamCountIncoming, second.BodyEvaluator,
                               (ObjectArrayEventType)first.GoesToTypes[0]));
                }
                return(new EnumEvalGroupByKeyValueSelectorEvents(
                           first.BodyEvaluator, first.StreamCountIncoming, second.BodyEvaluator));
            }
            if (inputEventType == null)
            {
                return(new EnumEvalGroupByKeySelectorScalarLambda(
                           first.BodyEvaluator, first.StreamCountIncoming,
                           (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            return(new EnumEvalGroupByKeySelectorEvents(first.BodyEvaluator, first.StreamCountIncoming));
        }
Esempio n. 5
0
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            ExprEvaluator sizeEval = bodiesAndParameters[0].BodyEvaluator;

            if (inputEventType != null)
            {
                base.TypeInfo = EPTypeHelper.CollectionOfEvents(inputEventType);
            }
            else
            {
                base.TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType);
            }

            if (EnumMethodEnum == EnumMethodEnum.TAKE)
            {
                return(new EnumEvalTake(sizeEval, numStreamsIncoming));
            }
            else
            {
                return(new EnumEvalTakeLast(sizeEval, numStreamsIncoming));
            }
        }
Esempio n. 6
0
 public FilterSpecCompilerArgs(
     IDictionary<string, Pair<EventType, string>> taggedEventTypes,
     IDictionary<string, Pair<EventType, string>> arrayEventTypes,
     ExprEvaluatorContext exprEvaluatorContext,
     string statementName,
     string statementId,
     StreamTypeService streamTypeService,
     MethodResolutionService methodResolutionService,
     TimeProvider timeProvider,
     VariableService variableService,
     TableService tableService,
     EventAdapterService eventAdapterService,
     ScriptingService scriptingService,
     Attribute[] annotations,
     ContextDescriptor contextDescriptor,
     ConfigurationInformation configurationInformation)
 {
     TaggedEventTypes = taggedEventTypes;
     ArrayEventTypes = arrayEventTypes;
     ExprEvaluatorContext = exprEvaluatorContext;
     StatementName = statementName;
     StatementId = statementId;
     StreamTypeService = streamTypeService;
     MethodResolutionService = methodResolutionService;
     TimeProvider = timeProvider;
     VariableService = variableService;
     TableService = tableService;
     EventAdapterService = eventAdapterService;
     ScriptingService = scriptingService;
     Annotations = annotations;
     ContextDescriptor = contextDescriptor;
     ConfigurationInformation = configurationInformation;
 }
Esempio n. 7
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            ExprDotEvalParam initValueParam = bodiesAndParameters[0];
            ExprEvaluator    initValueEval  = initValueParam.BodyEvaluator;

            base.TypeInfo = EPTypeHelper.SingleValue(initValueEval.ReturnType.GetBoxedType());

            var resultAndAdd = (ExprDotEvalParamLambda)bodiesAndParameters[1];

            if (inputEventType != null)
            {
                return(new EnumEvalAggregateEvents(
                           initValueEval,
                           resultAndAdd.BodyEvaluator, resultAndAdd.StreamCountIncoming,
                           (ObjectArrayEventType)resultAndAdd.GoesToTypes[0]));
            }
            else
            {
                return(new EnumEvalAggregateScalar(
                           initValueEval,
                           resultAndAdd.BodyEvaluator, resultAndAdd.StreamCountIncoming,
                           (ObjectArrayEventType)resultAndAdd.GoesToTypes[0],
                           (ObjectArrayEventType)resultAndAdd.GoesToTypes[1]));
            }
        }
Esempio n. 8
0
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            var max = EnumMethodEnum == EnumMethodEnum.MAXBY;

            if (inputEventType == null)
            {
                base.TypeInfo = EPTypeHelper.SingleValue(collectionComponentType);
                return(new EnumEvalMinMaxByScalarLambda(
                           first.BodyEvaluator, first.StreamCountIncoming, max,
                           (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            base.TypeInfo = EPTypeHelper.SingleEvent(inputEventType);
            return(new EnumEvalMinMaxByEvents(first.BodyEvaluator, first.StreamCountIncoming, max));
        }
Esempio n. 9
0
        public ContextControllerHashedGetterSingleRow(
            string statementName,
            string functionName,
            Pair <Type, EngineImportSingleRowDesc> func,
            IList <ExprNode> parameters,
            int granularity,
            MethodResolutionService methodResolutionService,
            EventType eventType,
            EventAdapterService eventAdapterService,
            int statementId,
            TableService tableService)
        {
            ExprNodeUtilMethodDesc staticMethodDesc = ExprNodeUtility.ResolveMethodAllowWildcardAndStream(
                func.First.Name, null,
                func.Second.MethodName,
                parameters,
                methodResolutionService,
                eventAdapterService,
                statementId, true,
                eventType,
                new ExprNodeUtilResolveExceptionHandlerDefault(func.Second.MethodName, true),
                func.Second.MethodName,
                tableService);

            _statementName = statementName;
            _evaluators    = staticMethodDesc.ChildEvals;
            _granularity   = granularity;
            _fastMethod    = staticMethodDesc.FastMethod;
        }
Esempio n. 10
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            bool max = this.EnumMethodEnum == EnumMethodEnum.MAX;

            Type returnType;

            if (bodiesAndParameters.IsEmpty())
            {
                returnType    = collectionComponentType.GetBoxedType();
                base.TypeInfo = EPTypeHelper.SingleValue(returnType);
                return(new EnumEvalMinMaxScalar(numStreamsIncoming, max));
            }

            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            returnType    = first.BodyEvaluator.ReturnType.GetBoxedType();
            base.TypeInfo = EPTypeHelper.SingleValue(returnType);

            if (inputEventType == null)
            {
                return(new EnumEvalMinMaxScalarLambda(
                           first.BodyEvaluator, first.StreamCountIncoming, max,
                           (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            return(new EnumEvalMinMaxEvents(first.BodyEvaluator, first.StreamCountIncoming, max));
        }
Esempio n. 11
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="evaluators">evaluate the sub-expression within the aggregate function (ie. Sum(4*myNum))</param>
        /// <param name="prototypes">collect the aggregation state that evaluators evaluate to, act as prototypes for new aggregationsaggregation states for each group</param>
        /// <param name="groupKeyBinding">The group key binding.</param>
        /// <param name="methodResolutionService">factory for creating additional aggregation method instances per group key</param>
        /// <param name="accessors">accessor definitions</param>
        /// <param name="accessAggregations">access aggs</param>
        /// <param name="isJoin">true for join, false for single-stream</param>
        /// <param name="rollupLevelDesc">The rollup level desc.</param>
        /// <param name="topGroupAggregators">The top group aggregators.</param>
        /// <param name="topGroupStates">The top group states.</param>
        public AggSvcGroupByRefcountedWAccessRollupImpl(ExprEvaluator[] evaluators,
                                                        AggregationMethodFactory[] prototypes,
                                                        Object groupKeyBinding,
                                                        MethodResolutionService methodResolutionService,
                                                        AggregationAccessorSlotPair[] accessors,
                                                        AggregationStateFactory[] accessAggregations,
                                                        bool isJoin,
                                                        AggregationGroupByRollupDesc rollupLevelDesc,
                                                        AggregationMethod[] topGroupAggregators,
                                                        AggregationState[] topGroupStates)

            : base(evaluators, prototypes, groupKeyBinding)
        {
            _methodResolutionService = methodResolutionService;

            _aggregatorsPerGroup = new IDictionary <object, AggregationMethodPairRow> [rollupLevelDesc.NumLevelsAggregation];
            _removedKeys         = new List <object> [rollupLevelDesc.NumLevelsAggregation];
            for (var i = 0; i < rollupLevelDesc.NumLevelsAggregation; i++)
            {
                _aggregatorsPerGroup[i] = new Dictionary <Object, AggregationMethodPairRow>();
                _removedKeys[i]         = new List <Object>(2);
            }
            _accessors             = accessors;
            _accessAggregations    = accessAggregations;
            _isJoin                = isJoin;
            _rollupLevelDesc       = rollupLevelDesc;
            _aggregatorTopGroup    = new AggregationMethodPairRow(0, topGroupAggregators, topGroupStates);
            _methodParameterValues = new Object[evaluators.Length];
        }
Esempio n. 12
0
        // settable for view-sharing

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="stmtEngineServices">is the engine services for the statement</param>
        /// <param name="schedulingService">implementation for schedule registration</param>
        /// <param name="scheduleBucket">is for ordering scheduled callbacks within the view statements</param>
        /// <param name="epStatementHandle">is the statements-own handle for use in registering callbacks with services</param>
        /// <param name="viewResultionService">is a service for resolving view namespace and name to a view factory</param>
        /// <param name="patternResolutionService">is the service that resolves pattern objects for the statement</param>
        /// <param name="statementExtensionSvcContext">provide extension points for custom statement resources</param>
        /// <param name="statementStopService">for registering a callback invoked when a statement is stopped</param>
        /// <param name="methodResolutionService">is a service for resolving static methods and aggregation functions</param>
        /// <param name="patternContextFactory">is the pattern-level services and context information factory</param>
        /// <param name="filterService">is the filtering service</param>
        /// <param name="statementResultService">handles awareness of listeners/subscriptions for a statement customizing output produced</param>
        /// <param name="internalEventEngineRouteDest">routing destination</param>
        /// <param name="annotations">The annotations.</param>
        /// <param name="statementAgentInstanceRegistry">The statement agent instance registry.</param>
        /// <param name="defaultAgentInstanceLock">The default agent instance lock.</param>
        /// <param name="contextDescriptor">The context descriptor.</param>
        /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
        /// <param name="matchRecognizeStatePoolStmtSvc">The match recognize state pool statement SVC.</param>
        /// <param name="statelessSelect">if set to <c>true</c> [stateless select].</param>
        /// <param name="contextControllerFactoryService">The context controller factory service.</param>
        /// <param name="defaultAgentInstanceScriptContext">The default agent instance script context.</param>
        /// <param name="aggregationServiceFactoryService">The aggregation service factory service.</param>
        /// <param name="scriptingService">The scripting service.</param>
        /// <param name="writesToTables">if set to <c>true</c> [writes to tables].</param>
        /// <param name="statementUserObject">The statement user object.</param>
        /// <param name="statementSemiAnonymousTypeRegistry">The statement semi anonymous type registry.</param>
        /// <param name="priority">The priority.</param>
        public StatementContext(
            StatementContextEngineServices stmtEngineServices,
            SchedulingService schedulingService,
            ScheduleBucket scheduleBucket,
            EPStatementHandle epStatementHandle,
            ViewResolutionService viewResultionService,
            PatternObjectResolutionService patternResolutionService,
            StatementExtensionSvcContext statementExtensionSvcContext,
            StatementStopService statementStopService,
            MethodResolutionService methodResolutionService,
            PatternContextFactory patternContextFactory,
            FilterService filterService,
            StatementResultService statementResultService,
            InternalEventRouteDest internalEventEngineRouteDest,
            Attribute[] annotations,
            StatementAIResourceRegistry statementAgentInstanceRegistry,
            IReaderWriterLock defaultAgentInstanceLock,
            ContextDescriptor contextDescriptor,
            PatternSubexpressionPoolStmtSvc patternSubexpressionPoolSvc,
            MatchRecognizeStatePoolStmtSvc matchRecognizeStatePoolStmtSvc,
            bool statelessSelect,
            ContextControllerFactoryService contextControllerFactoryService,
            AgentInstanceScriptContext defaultAgentInstanceScriptContext,
            AggregationServiceFactoryService aggregationServiceFactoryService,
            ScriptingService scriptingService,
            bool writesToTables,
            object statementUserObject,
            StatementSemiAnonymousTypeRegistry statementSemiAnonymousTypeRegistry,
            int priority)
        {
            _stmtEngineServices               = stmtEngineServices;
            SchedulingService                 = schedulingService;
            ScheduleBucket                    = scheduleBucket;
            EpStatementHandle                 = epStatementHandle;
            ViewResolutionService             = viewResultionService;
            PatternResolutionService          = patternResolutionService;
            StatementExtensionServicesContext = statementExtensionSvcContext;
            StatementStopService              = statementStopService;
            MethodResolutionService           = methodResolutionService;
            PatternContextFactory             = patternContextFactory;
            FilterService                = filterService;
            _statementResultService      = statementResultService;
            InternalEventEngineRouteDest = internalEventEngineRouteDest;
            ScheduleAdjustmentService    = stmtEngineServices.ConfigSnapshot.EngineDefaults.ExecutionConfig.IsAllowIsolatedService ? new ScheduleAdjustmentService() : null;
            Annotations = annotations;
            StatementAgentInstanceRegistry = statementAgentInstanceRegistry;
            DefaultAgentInstanceLock       = defaultAgentInstanceLock;
            ContextDescriptor                 = contextDescriptor;
            PatternSubexpressionPoolSvc       = patternSubexpressionPoolSvc;
            MatchRecognizeStatePoolStmtSvc    = matchRecognizeStatePoolStmtSvc;
            IsStatelessSelect                 = statelessSelect;
            ContextControllerFactoryService   = contextControllerFactoryService;
            DefaultAgentInstanceScriptContext = defaultAgentInstanceScriptContext;
            AggregationServiceFactoryService  = aggregationServiceFactoryService;
            ScriptingService    = scriptingService;
            IsWritesToTables    = writesToTables;
            StatementUserObject = statementUserObject;
            StatementSemiAnonymousTypeRegistry = statementSemiAnonymousTypeRegistry;
            Priority = priority;
        }
Esempio n. 13
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            if (inputEventType != null)
            {
                TypeInfo = EPTypeHelper.CollectionOfEvents(inputEventType);
                if (first.GoesToNames.Count == 1)
                {
                    return(new EnumEvalWhereEvents(first.BodyEvaluator, first.StreamCountIncoming));
                }
                return(new EnumEvalWhereIndexEvents(
                           first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[1]));
            }

            TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType);
            if (first.GoesToNames.Count == 1)
            {
                return(new EnumEvalWhereScalar(
                           first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            return(new EnumEvalWhereScalarIndex(
                       first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0],
                       (ObjectArrayEventType)first.GoesToTypes[1]));
        }
 public override AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService)
 {
     return new AggSvcGroupByMixedAccessImpl(
         Evaluators, Aggregators, GroupKeyBinding, methodResolutionService, Accessors, AccessAggregations, IsJoin);
 }
Esempio n. 15
0
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            if (bodiesAndParameters.IsEmpty())
            {
                var aggMethodFactoryX = GetAggregatorFactory(collectionComponentType);
                TypeInfo = EPTypeHelper.SingleValue(aggMethodFactoryX.ValueType.GetBoxedType());
                return(new EnumEvalSumScalar(numStreamsIncoming, aggMethodFactoryX));
            }

            var first            = (ExprDotEvalParamLambda)bodiesAndParameters[0];
            var aggMethodFactory = GetAggregatorFactory(first.BodyEvaluator.ReturnType);
            var returnType       = aggMethodFactory.ValueType.GetBoxedType();

            TypeInfo = EPTypeHelper.SingleValue(returnType);
            if (inputEventType == null)
            {
                return(new EnumEvalSumScalarLambda(
                           first.BodyEvaluator, first.StreamCountIncoming, aggMethodFactory,
                           (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            return(new EnumEvalSumEvents(first.BodyEvaluator, first.StreamCountIncoming, aggMethodFactory));
        }
Esempio n. 16
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            base.TypeInfo = EPTypeHelper.SingleValue(typeof(Boolean));
            ExprEvaluator body = bodiesAndParameters[0].BodyEvaluator;

            return(new EnumEvalSequenceEqual(body, numStreamsIncoming));
        }
Esempio n. 17
0
 public override AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService,
     bool isSubquery,
     int?subqueryNumber)
 {
     return(new AggSvcGroupByNoAccessImpl(Evaluators, Aggregators, GroupKeyBinding, methodResolutionService));
 }
 public override AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService)
 {
     AggregationMethod[] aggregatorsAgentInstance = methodResolutionService.NewAggregators(
         base.Aggregators, agentInstanceContext.AgentInstanceId);
     return(new AggSvcGroupAllNoAccessImpl(Evaluators, aggregatorsAgentInstance, Aggregators));
 }
Esempio n. 19
0
 public AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService,
     bool isSubquery,
     int? subqueryNumber)
 {
     return new AggSvcGroupAllLocalGroupBy(methodResolutionService, IsJoin, _localGroupByPlan, _groupKeyBinding);
 }
Esempio n. 20
0
        public override EnumEval GetEnumEval(
            MethodResolutionService methodResolutionService,
            EventAdapterService eventAdapterService,
            StreamTypeService streamTypeService,
            String statementId,
            String enumMethodUsedName,
            IList <ExprDotEvalParam> bodiesAndParameters,
            EventType inputEventType,
            Type collectionComponentType,
            int numStreamsIncoming,
            bool disablePropertyExpressionEventCollCache)
        {
            if (bodiesAndParameters.IsEmpty())
            {
                if (inputEventType != null)
                {
                    base.TypeInfo = EPTypeHelper.SingleEvent(inputEventType);
                }
                else
                {
                    base.TypeInfo = EPTypeHelper.SingleValue(collectionComponentType);
                }
                if (EnumMethodEnum == EnumMethodEnum.FIRST)
                {
                    return(new EnumEvalFirstOfNoPredicate(numStreamsIncoming));
                }
                else
                {
                    return(new EnumEvalLastOfNoPredicate(numStreamsIncoming));
                }
            }

            var first = (ExprDotEvalParamLambda)bodiesAndParameters[0];

            if (inputEventType != null)
            {
                base.TypeInfo = EPTypeHelper.SingleEvent(inputEventType);
                if (EnumMethodEnum == EnumMethodEnum.FIRST)
                {
                    return(new EnumEvalFirstOfPredicateEvents(first.BodyEvaluator, first.StreamCountIncoming));
                }
                else
                {
                    return(new EnumEvalLastOfPredicateEvents(first.BodyEvaluator, first.StreamCountIncoming));
                }
            }
            base.TypeInfo = EPTypeHelper.SingleValue(collectionComponentType);
            if (EnumMethodEnum == EnumMethodEnum.FIRST)
            {
                return(new EnumEvalFirstOfPredicateScalar(
                           first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0]));
            }
            else
            {
                return(new EnumEvalLastOfPredicateScalar(
                           first.BodyEvaluator, first.StreamCountIncoming, (ObjectArrayEventType)first.GoesToTypes[0]));
            }
        }
Esempio n. 21
0
 public ExprDotMethodEvalDuck(String statementName, MethodResolutionService methodResolutionService, String methodName, Type[] parameterTypes, ExprEvaluator[] parameters)
 {
     _statementName           = statementName;
     _methodResolutionService = methodResolutionService;
     _methodName     = methodName;
     _parameterTypes = parameterTypes;
     _parameters     = parameters;
     _cache          = new Dictionary <Type, FastMethod>();
 }
Esempio n. 22
0
 public SortedAggregationStateFactoryFactory(MethodResolutionService methodResolutionService, ExprEvaluator[] evaluators, bool[] sortDescending, bool ever, int streamNum, ExprAggMultiFunctionSortedMinMaxByNode parent)
 {
     _methodResolutionService = methodResolutionService;
     _evaluators     = evaluators;
     _sortDescending = sortDescending;
     _ever           = ever;
     _streamNum      = streamNum;
     _parent         = parent;
 }
 public AggregationService MakeService(
     AgentInstanceContext agentInstanceContext,
     MethodResolutionService methodResolutionService,
     bool isSubquery,
     int?subqueryNumber)
 {
     return(new AggSvcGroupByAccessOnlyImpl(
                methodResolutionService, _groupKeyBinding, _accessors, _accessAggSpecs, _isJoin));
 }
Esempio n. 24
0
 public TableStateRowFactory(ObjectArrayEventType objectArrayEventType, MethodResolutionService methodResolutionService, AggregationMethodFactory[] methodFactories, AggregationStateFactory[] stateFactories, int[] groupKeyIndexes, EventAdapterService eventAdapterService)
 {
     _objectArrayEventType    = objectArrayEventType;
     _methodResolutionService = methodResolutionService;
     _methodFactories         = methodFactories;
     _stateFactories          = stateFactories;
     _groupKeyIndexes         = groupKeyIndexes;
     _eventAdapterService     = eventAdapterService;
 }
Esempio n. 25
0
        public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache)
        {
            ExprDotEvalParam first = bodiesAndParameters[0];

            ExprDotEnumerationSource enumSrc = ExprDotNodeUtility.GetEnumerationSource(
                first.Body, streamTypeService, eventAdapterService, statementId, true,
                disablePropertyExpressionEventCollCache);

            if (inputEventType != null)
            {
                base.TypeInfo = EPTypeHelper.CollectionOfEvents(inputEventType);
            }
            else
            {
                base.TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType);
            }

            if (enumSrc.Enumeration == null)
            {
                String message = "Enumeration method '" + enumMethodUsedName +
                                 "' requires an expression yielding an event-collection as input paramater";
                throw new ExprValidationException(message);
            }

            var setType = enumSrc.Enumeration.GetEventTypeCollection(eventAdapterService, statementId);

            if (!Equals(setType, inputEventType))
            {
                bool isSubtype = EventTypeUtility.IsTypeOrSubTypeOf(setType, inputEventType);
                if (!isSubtype)
                {
                    String message = "Enumeration method '" + enumMethodUsedName + "' expects event type '" +
                                     inputEventType.Name + "' but receives event type '" +
                                     enumSrc.Enumeration.GetEventTypeCollection(eventAdapterService, statementId).Name +
                                     "'";
                    throw new ExprValidationException(message);
                }
            }

            if (EnumMethodEnum == EnumMethodEnum.UNION)
            {
                return(new EnumEvalUnion(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null));
            }
            else if (EnumMethodEnum == EnumMethodEnum.INTERSECT)
            {
                return(new EnumEvalIntersect(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null));
            }
            else if (EnumMethodEnum == EnumMethodEnum.EXCEPT)
            {
                return(new EnumEvalExcept(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null));
            }
            else
            {
                throw new ArgumentException("Invalid enumeration method for this factory: " + EnumMethodEnum);
            }
        }
Esempio n. 26
0
        public AggregationMethod Make(MethodResolutionService methodResolutionService, int agentInstanceId, int groupId, int aggregationId)
        {
            AggregationMethod method = _aggregationFunctionFactory.NewAggregator();

            if (!_parent.IsDistinct)
            {
                return(method);
            }
            return(methodResolutionService.MakeDistinctAggregator(agentInstanceId, groupId, aggregationId, method, _aggregatedValueType, false));
        }
Esempio n. 27
0
        public AggregationMethod Make(MethodResolutionService methodResolutionService, int agentInstanceId, int groupId, int aggregationId)
        {
            AggregationMethod method = methodResolutionService.MakeNthAggregator(agentInstanceId, groupId, aggregationId, _childType, _size + 1);

            if (!_parent.IsDistinct)
            {
                return(method);
            }
            return(methodResolutionService.MakeDistinctAggregator(agentInstanceId, groupId, aggregationId, method, _childType, false));
        }
Esempio n. 28
0
        public AggregationMethod Make(MethodResolutionService methodResolutionService, int agentInstanceId, int groupId, int aggregationId)
        {
            AggregationMethod method = methodResolutionService.MakeAvedevAggregator(agentInstanceId, groupId, aggregationId, _parent.HasFilter);

            if (!_parent.IsDistinct)
            {
                return(method);
            }
            return(methodResolutionService.MakeDistinctAggregator(agentInstanceId, groupId, aggregationId, method, _aggregatedValueType, _parent.HasFilter));
        }
Esempio n. 29
0
        public AggregationMethod Make(MethodResolutionService methodResolutionService, int agentInstanceId, int groupId, int aggregationId)
        {
            var method = methodResolutionService.MakeMinMaxAggregator(agentInstanceId, groupId, aggregationId, _parent.MinMaxTypeEnum, _type, _hasDataWindows, _parent.HasFilter);

            if (!_parent.IsDistinct)
            {
                return(method);
            }
            return(methodResolutionService.MakeDistinctAggregator(agentInstanceId, groupId, aggregationId, method, _type, _parent.HasFilter));
        }
Esempio n. 30
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="evaluators">evaluate the sub-expression within the aggregate function (ie. Sum(4*myNum))</param>
 /// <param name="prototypes">collect the aggregation state that evaluators evaluate to, act as prototypes for new aggregationsaggregation states for each group</param>
 /// <param name="groupKeyBinding">The group key binding.</param>
 /// <param name="methodResolutionService">factory for creating additional aggregation method instances per group key</param>
 public AggSvcGroupByNoAccessImpl(
     ExprEvaluator[] evaluators,
     AggregationMethodFactory[] prototypes,
     Object groupKeyBinding,
     MethodResolutionService methodResolutionService)
     : base(evaluators, prototypes, groupKeyBinding)
 {
     _methodResolutionService = methodResolutionService;
     _aggregatorsPerGroup     = new Dictionary <Object, AggregationMethod[]>();
 }