/// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="eventAdapterService">is the event wrapper and type service</param>
 /// <param name="eventTypeIdGenerator">The event type id generator.</param>
 /// <param name="engineImportService">for imported aggregation functions and static functions</param>
 /// <param name="variableService">provides access to variable values</param>
 /// <param name="engineSettingsService">some engine settings are writable</param>
 /// <param name="valueAddEventService">Update event handling</param>
 /// <param name="metricReportingService">for metric reporting</param>
 /// <param name="statementEventTypeRef">statement to event type reference holding</param>
 /// <param name="statementVariableRef">statement to variable reference holding</param>
 /// <param name="plugInViews">The plug in views.</param>
 /// <param name="filterService">The filter service.</param>
 /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
 /// <param name="tableService">The table service.</param>
 public ConfigurationOperationsImpl(
     EventAdapterService eventAdapterService,
     EventTypeIdGenerator eventTypeIdGenerator,
     EngineImportService engineImportService,
     VariableService variableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     MetricReportingService metricReportingService,
     StatementEventTypeRef statementEventTypeRef,
     StatementVariableRef statementVariableRef,
     PluggableObjectCollection plugInViews,
     FilterService filterService,
     PatternSubexpressionPoolEngineSvc patternSubexpressionPoolSvc,
     MatchRecognizeStatePoolEngineSvc matchRecognizeStatePoolEngineSvc,
     TableService tableService)
 {
     _eventAdapterService              = eventAdapterService;
     _eventTypeIdGenerator             = eventTypeIdGenerator;
     _engineImportService              = engineImportService;
     _variableService                  = variableService;
     _engineSettingsService            = engineSettingsService;
     _valueAddEventService             = valueAddEventService;
     _metricReportingService           = metricReportingService;
     _statementEventTypeRef            = statementEventTypeRef;
     _statementVariableRef             = statementVariableRef;
     _plugInViews                      = plugInViews;
     _filterService                    = filterService;
     _patternSubexpressionPoolSvc      = patternSubexpressionPoolSvc;
     _matchRecognizeStatePoolEngineSvc = matchRecognizeStatePoolEngineSvc;
     _tableService                     = tableService;
 }
Esempio n. 2
0
 public StatementContextEngineServices(
     IContainer container,
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowMgmtService namedWindowMgmtService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory,
     ContextManagementService contextManagementService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     EventTableIndexService eventTableIndexService,
     PatternNodeFactory patternNodeFactory,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     TimeSourceService timeSourceService,
     EngineImportService engineImportService,
     AggregationFactoryFactory aggregationFactoryFactory,
     SchedulingService schedulingService,
     ExprDeclaredService exprDeclaredService)
 {
     Container                           = container;
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowMgmtService              = namedWindowMgmtService;
     VariableService                     = variableService;
     TableService                        = tableService;
     EngineSettingsService               = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
     ContextManagementService            = contextManagementService;
     ViewServicePreviousFactory          = viewServicePreviousFactory;
     EventTableIndexService              = eventTableIndexService;
     PatternNodeFactory                  = patternNodeFactory;
     FilterBooleanExpressionFactory      = filterBooleanExpressionFactory;
     TimeSourceService                   = timeSourceService;
     EngineImportService                 = engineImportService;
     AggregationFactoryFactory           = aggregationFactoryFactory;
     SchedulingService                   = schedulingService;
     ExprDeclaredService                 = exprDeclaredService;
 }
Esempio n. 3
0
 public StatementContextEngineServices(
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowService namedWindowService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory)
 {
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowService                  = namedWindowService;
     VariableService                     = variableService;
     TableService                        = tableService;
     _engineSettingsService              = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
 }
Esempio n. 4
0
        // Supplied after construction to avoid circular dependency

        /// <summary>
        /// Constructor - sets up new set of services.
        /// </summary>
        /// <param name="engineURI">is the engine URI</param>
        /// <param name="schedulingService">service to get time and schedule callbacks</param>
        /// <param name="eventAdapterService">service to resolve event types</param>
        /// <param name="engineImportService">is engine imported static func packages and aggregation functions</param>
        /// <param name="engineSettingsService">provides engine settings</param>
        /// <param name="databaseConfigService">service to resolve a database name to database connection factory and configs</param>
        /// <param name="plugInViews">resolves view namespace and name to view factory class</param>
        /// <param name="statementLockFactory">creates statement-level locks</param>
        /// <param name="eventProcessingRWLock">is the engine lock for statement management</param>
        /// <param name="extensionServicesContext">marker interface allows adding additional services</param>
        /// <param name="engineEnvContext">is engine environment/directory information for use with adapters and external env</param>
        /// <param name="statementContextFactory">is the factory to use to create statement context objects</param>
        /// <param name="plugInPatternObjects">resolves plug-in pattern objects</param>
        /// <param name="timerService">is the timer service</param>
        /// <param name="filterService">the filter service</param>
        /// <param name="streamFactoryService">is hooking up filters to streams</param>
        /// <param name="namedWindowMgmtService">The named window MGMT service.</param>
        /// <param name="namedWindowDispatchService">The named window dispatch service.</param>
        /// <param name="variableService">provides access to variable values</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="timeSourceService">time source provider class</param>
        /// <param name="valueAddEventService">handles Update events</param>
        /// <param name="metricsReportingService">for metric reporting</param>
        /// <param name="statementEventTypeRef">statement to event type reference holding</param>
        /// <param name="statementVariableRef">statement to variabke reference holding</param>
        /// <param name="configSnapshot">configuration snapshot</param>
        /// <param name="threadingServiceImpl">engine-level threading services</param>
        /// <param name="internalEventRouter">routing of events</param>
        /// <param name="statementIsolationService">maintains isolation information per statement</param>
        /// <param name="schedulingMgmtService">schedule management for statements</param>
        /// <param name="deploymentStateService">The deployment state service.</param>
        /// <param name="exceptionHandlingService">The exception handling service.</param>
        /// <param name="patternNodeFactory">The pattern node factory.</param>
        /// <param name="eventTypeIdGenerator">The event type id generator.</param>
        /// <param name="statementMetadataFactory">The statement metadata factory.</param>
        /// <param name="contextManagementService">The context management service.</param>
        /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
        /// <param name="matchRecognizeStatePoolEngineSvc">The match recognize state pool engine SVC.</param>
        /// <param name="dataFlowService">The data flow service.</param>
        /// <param name="exprDeclaredService">The expr declared service.</param>
        /// <param name="contextControllerFactoryFactorySvc">The context controller factory factory SVC.</param>
        /// <param name="contextManagerFactoryService">The context manager factory service.</param>
        /// <param name="epStatementFactory">The ep statement factory.</param>
        /// <param name="regexHandlerFactory">The regex handler factory.</param>
        /// <param name="viewableActivatorFactory">The viewable activator factory.</param>
        /// <param name="filterNonPropertyRegisteryService">The filter non property registery service.</param>
        /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
        /// <param name="viewServicePreviousFactory">The view service previous factory.</param>
        /// <param name="eventTableIndexService">The event table index service.</param>
        /// <param name="epRuntimeIsolatedFactory">The ep runtime isolated factory.</param>
        /// <param name="filterBooleanExpressionFactory">The filter boolean expression factory.</param>
        /// <param name="dataCacheFactory">The data cache factory.</param>
        /// <param name="multiMatchHandlerFactory">The multi match handler factory.</param>
        /// <param name="namedWindowConsumerMgmtService">The named window consumer MGMT service.</param>
        /// <param name="aggregationFactoryFactory"></param>
        /// <param name="scriptingService">The scripting service.</param>
        public EPServicesContext(
            string engineURI,
            SchedulingServiceSPI schedulingService,
            EventAdapterService eventAdapterService,
            EngineImportService engineImportService,
            EngineSettingsService engineSettingsService,
            DatabaseConfigService databaseConfigService,
            PluggableObjectCollection plugInViews,
            StatementLockFactory statementLockFactory,
            IReaderWriterLock eventProcessingRWLock,
            EngineLevelExtensionServicesContext extensionServicesContext,
            Directory engineEnvContext,
            StatementContextFactory statementContextFactory,
            PluggableObjectCollection plugInPatternObjects,
            TimerService timerService,
            FilterServiceSPI filterService,
            StreamFactoryService streamFactoryService,
            NamedWindowMgmtService namedWindowMgmtService,
            NamedWindowDispatchService namedWindowDispatchService,
            VariableService variableService,
            TableService tableService,
            TimeSourceService timeSourceService,
            ValueAddEventService valueAddEventService,
            MetricReportingServiceSPI metricsReportingService,
            StatementEventTypeRef statementEventTypeRef,
            StatementVariableRef statementVariableRef,
            ConfigurationInformation configSnapshot,
            ThreadingService threadingServiceImpl,
            InternalEventRouterImpl internalEventRouter,
            StatementIsolationService statementIsolationService,
            SchedulingMgmtService schedulingMgmtService,
            DeploymentStateService deploymentStateService,
            ExceptionHandlingService exceptionHandlingService,
            PatternNodeFactory patternNodeFactory,
            EventTypeIdGenerator eventTypeIdGenerator,
            StatementMetadataFactory statementMetadataFactory,
            ContextManagementService contextManagementService,
            PatternSubexpressionPoolEngineSvc patternSubexpressionPoolSvc,
            MatchRecognizeStatePoolEngineSvc matchRecognizeStatePoolEngineSvc,
            DataFlowService dataFlowService,
            ExprDeclaredService exprDeclaredService,
            ContextControllerFactoryFactorySvc contextControllerFactoryFactorySvc,
            ContextManagerFactoryService contextManagerFactoryService,
            EPStatementFactory epStatementFactory,
            RegexHandlerFactory regexHandlerFactory,
            ViewableActivatorFactory viewableActivatorFactory,
            FilterNonPropertyRegisteryService filterNonPropertyRegisteryService,
            ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
            ViewServicePreviousFactory viewServicePreviousFactory,
            EventTableIndexService eventTableIndexService,
            EPRuntimeIsolatedFactory epRuntimeIsolatedFactory,
            FilterBooleanExpressionFactory filterBooleanExpressionFactory,
            DataCacheFactory dataCacheFactory,
            MultiMatchHandlerFactory multiMatchHandlerFactory,
            NamedWindowConsumerMgmtService namedWindowConsumerMgmtService,
            AggregationFactoryFactory aggregationFactoryFactory,
            ScriptingService scriptingService)
        {
            EngineURI             = engineURI;
            SchedulingService     = schedulingService;
            EventAdapterService   = eventAdapterService;
            EngineImportService   = engineImportService;
            EngineSettingsService = engineSettingsService;
            DatabaseRefService    = databaseConfigService;
            FilterService         = filterService;
            TimerService          = timerService;
            DispatchService       = DispatchServiceProvider.NewService();
            ViewService           = ViewServiceProvider.NewService();
            StreamService         = streamFactoryService;
            PlugInViews           = plugInViews;
            StatementLockFactory  = statementLockFactory;
            EventProcessingRWLock = eventProcessingRWLock;
            EngineLevelExtensionServicesContext = extensionServicesContext;
            EngineEnvContext           = engineEnvContext;
            StatementContextFactory    = statementContextFactory;
            PlugInPatternObjects       = plugInPatternObjects;
            NamedWindowMgmtService     = namedWindowMgmtService;
            NamedWindowDispatchService = namedWindowDispatchService;
            VariableService            = variableService;
            TableService                     = tableService;
            TimeSource                       = timeSourceService;
            ValueAddEventService             = valueAddEventService;
            MetricsReportingService          = metricsReportingService;
            StatementEventTypeRefService     = statementEventTypeRef;
            ConfigSnapshot                   = configSnapshot;
            ThreadingService                 = threadingServiceImpl;
            InternalEventRouter              = internalEventRouter;
            StatementIsolationService        = statementIsolationService;
            SchedulingMgmtService            = schedulingMgmtService;
            StatementVariableRefService      = statementVariableRef;
            DeploymentStateService           = deploymentStateService;
            ExceptionHandlingService         = exceptionHandlingService;
            PatternNodeFactory               = patternNodeFactory;
            EventTypeIdGenerator             = eventTypeIdGenerator;
            StatementMetadataFactory         = statementMetadataFactory;
            ContextManagementService         = contextManagementService;
            PatternSubexpressionPoolSvc      = patternSubexpressionPoolSvc;
            MatchRecognizeStatePoolEngineSvc = matchRecognizeStatePoolEngineSvc;
            DataFlowService                  = dataFlowService;
            ExprDeclaredService              = exprDeclaredService;
            ExpressionResultCacheSharable    = new ExpressionResultCacheService(
                configSnapshot.EngineDefaults.ExecutionConfig.DeclaredExprValueCacheSize);
            ContextControllerFactoryFactorySvc = contextControllerFactoryFactorySvc;
            ContextManagerFactoryService       = contextManagerFactoryService;
            EpStatementFactory                = epStatementFactory;
            RegexHandlerFactory               = regexHandlerFactory;
            ViewableActivatorFactory          = viewableActivatorFactory;
            FilterNonPropertyRegisteryService = filterNonPropertyRegisteryService;
            ResultSetProcessorHelperFactory   = resultSetProcessorHelperFactory;
            ViewServicePreviousFactory        = viewServicePreviousFactory;
            EventTableIndexService            = eventTableIndexService;
            EpRuntimeIsolatedFactory          = epRuntimeIsolatedFactory;
            FilterBooleanExpressionFactory    = filterBooleanExpressionFactory;
            DataCacheFactory               = dataCacheFactory;
            MultiMatchHandlerFactory       = multiMatchHandlerFactory;
            NamedWindowConsumerMgmtService = namedWindowConsumerMgmtService;
            AggregationFactoryFactory      = aggregationFactoryFactory;
            ScriptingService               = scriptingService;
        }
Esempio n. 5
0
        /// <summary>
        /// Returns the processor to use for a given select-clause.
        /// </summary>
        /// <param name="assignedTypeNumberStack">The assigned type number stack.</param>
        /// <param name="selectionList">the list of select clause elements/items, which are expected to have been validated</param>
        /// <param name="isUsingWildcard">true if the wildcard (*) occurs in the select clause</param>
        /// <param name="insertIntoDesc">contains column names for the optional insert-into clause (if supplied)</param>
        /// <param name="optionalInsertIntoEventType">Type of the optional insert into event.</param>
        /// <param name="forClauseSpec">For clause spec.</param>
        /// <param name="typeService">serves stream type information</param>
        /// <param name="eventAdapterService">for generating wrapper instances for events</param>
        /// <param name="statementResultService">handles listeners/subscriptions awareness to reduce output result generation</param>
        /// <param name="valueAddEventService">service that handles update events and variant events</param>
        /// <param name="selectExprEventTypeRegistry">registry for event type to statements</param>
        /// <param name="engineImportService"></param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <param name="variableService">The variable service.</param>
        /// <param name="scriptingService">The scripting service.</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="timeProvider">The time provider.</param>
        /// <param name="engineURI">The engine URI.</param>
        /// <param name="statementId">The statement identifier.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="annotations">The annotations.</param>
        /// <param name="contextDescriptor">The context descriptor.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="selectExprProcessorCallback">The select expr processor callback.</param>
        /// <param name="namedWindowMgmtService">The named window service.</param>
        /// <param name="intoTableClause">The into table clause.</param>
        /// <param name="groupByRollupInfo"></param>
        /// <param name="statementExtensionSvcContext"></param>
        /// <returns>
        /// select-clause expression processor
        /// </returns>
        /// <exception cref="ExprValidationException">Expected any of the  + Arrays.ToString(ForClauseKeyword.Values()).ToLowerCase() +  for-clause keywords after reserved keyword 'for'
        /// or
        /// The for-clause with the  + ForClauseKeyword.GROUPED_DELIVERY.Name +  keyword requires one or more grouping expressions
        /// or
        /// The for-clause with the  + ForClauseKeyword.DISCRETE_DELIVERY.Name +  keyword does not allow grouping expressions
        /// or
        /// The for-clause with delivery keywords may only occur once in a statement
        /// or
        /// Expected any of the  + Arrays.ToString(ForClauseKeyword.Values()).ToLowerCase() +  for-clause keywords after reserved keyword 'for'</exception>
        /// <throws>ExprValidationException to indicate the select expression cannot be validated</throws>
        public static SelectExprProcessor GetProcessor(
            ICollection <int> assignedTypeNumberStack,
            SelectClauseElementCompiled[] selectionList,
            bool isUsingWildcard,
            InsertIntoDesc insertIntoDesc,
            EventType optionalInsertIntoEventType,
            ForClauseSpec forClauseSpec,
            StreamTypeService typeService,
            EventAdapterService eventAdapterService,
            StatementResultService statementResultService,
            ValueAddEventService valueAddEventService,
            SelectExprEventTypeRegistry selectExprEventTypeRegistry,
            EngineImportService engineImportService,
            ExprEvaluatorContext exprEvaluatorContext,
            VariableService variableService,
            ScriptingService scriptingService,
            TableService tableService,
            TimeProvider timeProvider,
            string engineURI,
            int statementId,
            string statementName,
            Attribute[] annotations,
            ContextDescriptor contextDescriptor,
            ConfigurationInformation configuration,
            SelectExprProcessorDeliveryCallback selectExprProcessorCallback,
            NamedWindowMgmtService namedWindowMgmtService,
            IntoTableSpec intoTableClause,
            GroupByRollupInfo groupByRollupInfo,
            StatementExtensionSvcContext statementExtensionSvcContext)
        {
            if (selectExprProcessorCallback != null)
            {
                var bindProcessor = new BindProcessor(selectionList, typeService.EventTypes, typeService.StreamNames, tableService);
                IDictionary <string, object> properties = new LinkedHashMap <string, object>();
                for (var i = 0; i < bindProcessor.ColumnNamesAssigned.Length; i++)
                {
                    properties.Put(bindProcessor.ColumnNamesAssigned[i], bindProcessor.ExpressionTypes[i]);
                }
                var eventType = eventAdapterService.CreateAnonymousObjectArrayType("Output_" + statementName, properties);
                return(new SelectExprProcessorWDeliveryCallback(eventType, bindProcessor, selectExprProcessorCallback));
            }

            var synthetic = GetProcessorInternal(
                assignedTypeNumberStack, selectionList, isUsingWildcard, insertIntoDesc, optionalInsertIntoEventType,
                typeService, eventAdapterService, valueAddEventService, selectExprEventTypeRegistry,
                engineImportService, statementId, statementName, annotations, configuration, namedWindowMgmtService, tableService,
                groupByRollupInfo);

            // Handle table as an optional service
            if (statementResultService != null)
            {
                // Handle for-clause delivery contract checking
                ExprNode[] groupedDeliveryExpr = null;
                var        forDelivery         = false;
                if (forClauseSpec != null)
                {
                    foreach (var item in forClauseSpec.Clauses)
                    {
                        if (item.Keyword == null)
                        {
                            throw new ExprValidationException("Expected any of the " + EnumHelper.GetValues <ForClauseKeyword>().Render().ToLower() + " for-clause keywords after reserved keyword 'for'");
                        }
                        try
                        {
                            ForClauseKeyword keyword = EnumHelper.Parse <ForClauseKeyword>(item.Keyword);
                            if ((keyword == ForClauseKeyword.GROUPED_DELIVERY) && (item.Expressions.IsEmpty()))
                            {
                                throw new ExprValidationException(
                                          "The for-clause with the " + ForClauseKeyword.GROUPED_DELIVERY.GetName() +
                                          " keyword requires one or more grouping expressions");
                            }
                            if ((keyword == ForClauseKeyword.DISCRETE_DELIVERY) && (!item.Expressions.IsEmpty()))
                            {
                                throw new ExprValidationException(
                                          "The for-clause with the " + ForClauseKeyword.DISCRETE_DELIVERY.GetName() +
                                          " keyword does not allow grouping expressions");
                            }
                            if (forDelivery)
                            {
                                throw new ExprValidationException(
                                          "The for-clause with delivery keywords may only occur once in a statement");
                            }
                        }
                        catch (ExprValidationException)
                        {
                            throw;
                        }
                        catch (EPException)
                        {
                            throw;
                        }
                        catch (Exception ex)
                        {
                            throw new ExprValidationException("Expected any of the " + EnumHelper.GetValues <ForClauseKeyword>().Render().ToLower() + " for-clause keywords after reserved keyword 'for'", ex);
                        }

                        StreamTypeService type = new StreamTypeServiceImpl(synthetic.ResultEventType, null, false, engineURI);
                        groupedDeliveryExpr = new ExprNode[item.Expressions.Count];
                        var validationContext = new ExprValidationContext(type, engineImportService, statementExtensionSvcContext, null, timeProvider, variableService, tableService, exprEvaluatorContext, eventAdapterService, statementName, statementId, annotations, null, scriptingService, false, false, true, false, intoTableClause == null ? null : intoTableClause.Name, false);  // no context descriptor available
                        for (var i = 0; i < item.Expressions.Count; i++)
                        {
                            groupedDeliveryExpr[i] = ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.FORCLAUSE, item.Expressions[i], validationContext);
                        }
                        forDelivery = true;
                    }
                }

                var bindProcessor = new BindProcessor(selectionList, typeService.EventTypes, typeService.StreamNames, tableService);
                statementResultService.SetSelectClause(bindProcessor.ExpressionTypes, bindProcessor.ColumnNamesAssigned, forDelivery, ExprNodeUtility.GetEvaluators(groupedDeliveryExpr), exprEvaluatorContext);
                return(new SelectExprResultProcessor(statementResultService, synthetic, bindProcessor));
            }

            return(synthetic);
        }
Esempio n. 6
0
        private static SelectExprProcessor GetProcessorInternal(
            ICollection <int> assignedTypeNumberStack,
            SelectClauseElementCompiled[] selectionList,
            bool isUsingWildcard,
            InsertIntoDesc insertIntoDesc,
            EventType optionalInsertIntoEventType,
            StreamTypeService typeService,
            EventAdapterService eventAdapterService,
            ValueAddEventService valueAddEventService,
            SelectExprEventTypeRegistry selectExprEventTypeRegistry,
            EngineImportService engineImportService,
            int statementId,
            string statementName,
            Attribute[] annotations,
            ConfigurationInformation configuration,
            NamedWindowMgmtService namedWindowMgmtService,
            TableService tableService,
            GroupByRollupInfo groupByRollupInfo)
        {
            // Wildcard not allowed when insert into specifies column order
            if (isUsingWildcard && insertIntoDesc != null && !insertIntoDesc.ColumnNames.IsEmpty())
            {
                throw new ExprValidationException("Wildcard not allowed when insert-into specifies column order");
            }

            // Determine wildcard processor (select *)
            if (IsWildcardsOnly(selectionList))
            {
                // For joins
                if (typeService.StreamNames.Length > 1)
                {
                    Log.Debug(".getProcessor Using SelectExprJoinWildcardProcessor");
                    return(SelectExprJoinWildcardProcessorFactory.Create(
                               assignedTypeNumberStack, statementId, statementName,
                               typeService.StreamNames, typeService.EventTypes,
                               eventAdapterService, insertIntoDesc, selectExprEventTypeRegistry, engineImportService,
                               annotations, configuration, tableService, typeService.EngineURIQualifier));
                }
                // Single-table selects with no insert-into
                // don't need extra processing
                else if (insertIntoDesc == null)
                {
                    Log.Debug(".getProcessor Using wildcard processor");
                    if (typeService.HasTableTypes)
                    {
                        var tableName = TableServiceUtil.GetTableNameFromEventType(typeService.EventTypes[0]);
                        return(new SelectExprWildcardTableProcessor(tableName, tableService));
                    }
                    return(new SelectExprWildcardProcessor(typeService.EventTypes[0]));
                }
            }

            // Verify the assigned or name used is unique
            if (insertIntoDesc == null)
            {
                VerifyNameUniqueness(selectionList);
            }

            // Construct processor
            var buckets = GetSelectExpressionBuckets(selectionList);

            var factory = new SelectExprProcessorHelper(
                assignedTypeNumberStack, buckets.Expressions, buckets.SelectedStreams, insertIntoDesc,
                optionalInsertIntoEventType, isUsingWildcard, typeService, eventAdapterService, valueAddEventService,
                selectExprEventTypeRegistry, engineImportService, statementId, statementName, annotations, configuration,
                namedWindowMgmtService, tableService, groupByRollupInfo);
            SelectExprProcessor processor = factory.Evaluator;

            // add reference to the type obtained
            var type = (EventTypeSPI)processor.ResultEventType;

            if (!typeService.IsOnDemandStreams && type.Metadata.TypeClass != TypeClass.ANONYMOUS)
            {
                selectExprEventTypeRegistry.Add(processor.ResultEventType);
            }
            return(processor);
        }