コード例 #1
0
 public StatementAgentInstanceFactorySelect(
     int numStreams,
     ViewableActivator[] eventStreamParentViewableActivators,
     StatementContext statementContext,
     StatementSpecCompiled statementSpec,
     EPServicesContext services,
     StreamTypeService typeService,
     ViewFactoryChain[] unmaterializedViewChain,
     ResultSetProcessorFactoryDesc resultSetProcessorFactoryDesc,
     StreamJoinAnalysisResult joinAnalysisResult,
     bool recoveringResilient,
     JoinSetComposerPrototype joinSetComposerPrototype,
     SubSelectStrategyCollection subSelectStrategyCollection,
     ViewResourceDelegateVerified viewResourceDelegate,
     OutputProcessViewFactory outputProcessViewFactory) :
     base(statementSpec.Annotations)
 {
     _numStreams = numStreams;
     _eventStreamParentViewableActivators = eventStreamParentViewableActivators;
     _statementContext              = statementContext;
     _statementSpec                 = statementSpec;
     _services                      = services;
     _typeService                   = typeService;
     _unmaterializedViewChain       = unmaterializedViewChain;
     _resultSetProcessorFactoryDesc = resultSetProcessorFactoryDesc;
     _joinAnalysisResult            = joinAnalysisResult;
     _joinSetComposerPrototype      = joinSetComposerPrototype;
     _subSelectStrategyCollection   = subSelectStrategyCollection;
     _viewResourceDelegate          = viewResourceDelegate;
     _outputProcessViewFactory      = outputProcessViewFactory;
 }
 public StatementAgentInstanceFactoryOnTriggerSetVariable(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, OnSetVariableViewFactory onSetVariableViewFactory, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory)
     : base(statementContext, statementSpec, services, activator, subSelectStrategyCollection)
 {
     _onSetVariableViewFactory          = onSetVariableViewFactory;
     _outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
     _outputProcessViewFactory          = outputProcessViewFactory;
 }
コード例 #3
0
        public StatementAgentInstanceFactoryOnTriggerTable(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, ExprNode validatedJoin, TableOnViewFactory onExprFactory, EventType activatorResultEventType, TableMetadata tableMetadata, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory)
            : base(statementContext, statementSpec, services, activator, subSelectStrategyCollection)
        {
            _resultSetProcessorPrototype = resultSetProcessorPrototype;
            _onExprFactory = onExprFactory;
            _outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
            _outputProcessViewFactory          = outputProcessViewFactory;

            var pair            = StatementAgentInstanceFactoryOnTriggerNamedWindow.GetIndexHintPair(statementContext, statementSpec);
            var indexHint       = pair.IndexHint;
            var excludePlanHint = pair.ExcludePlanHint;

            _queryPlanResult = SubordinateQueryPlanner.PlanOnExpression(
                validatedJoin, activatorResultEventType, indexHint, true, -1, excludePlanHint,
                false, tableMetadata.EventTableIndexMetadataRepo, tableMetadata.InternalEventType,
                tableMetadata.UniqueKeyProps, true, statementContext.StatementName, statementContext.StatementId, statementContext.Annotations);
            if (_queryPlanResult.IndexDescs != null)
            {
                for (var i = 0; i < _queryPlanResult.IndexDescs.Length; i++)
                {
                    tableMetadata.AddIndexReference(_queryPlanResult.IndexDescs[i].IndexName, statementContext.StatementName);
                }
            }
            SubordinateQueryPlannerUtil.QueryPlanLogOnExpr(tableMetadata.IsQueryPlanLogging, TableServiceImpl.QueryPlanLog,
                                                           _queryPlanResult, statementContext.Annotations);
        }
コード例 #4
0
 public StatementAgentInstanceFactoryCreateWindow(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, ViewFactoryChain unmaterializedViewChain, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory, bool recoveringStatement)
     : base(statementContext.Annotations)
 {
     _statementContext            = statementContext;
     _statementSpec               = statementSpec;
     _services                    = services;
     _activator                   = activator;
     _unmaterializedViewChain     = unmaterializedViewChain;
     _resultSetProcessorPrototype = resultSetProcessorPrototype;
     _outputProcessViewFactory    = outputProcessViewFactory;
     _isRecoveringStatement       = recoveringStatement;
 }
コード例 #5
0
        protected override StatementAgentInstanceFactoryResult NewContextInternal(AgentInstanceContext agentInstanceContext, bool isRecoveringResilient)
        {
            StopCallback stopCallback = new ProxyStopCallback(() => _services.VariableService.DeallocateVariableState(_variableMetaData.VariableName, agentInstanceContext.AgentInstanceId));

            _services.VariableService.AllocateVariableState(
                _variableMetaData.VariableName, agentInstanceContext.AgentInstanceId, _statementContext.StatementExtensionServicesContext, isRecoveringResilient);

            CreateVariableView createView = new CreateVariableView(
                _statementContext.StatementId,
                _services.EventAdapterService,
                _services.VariableService,
                _createDesc.VariableName,
                _statementContext.StatementResultService,
                agentInstanceContext.AgentInstanceId);

            _services.VariableService.RegisterCallback(_createDesc.VariableName, agentInstanceContext.AgentInstanceId, createView.Update);
            _statementContext.StatementStopService.StatementStopped += () => _services.VariableService.UnregisterCallback(_createDesc.VariableName, 0, createView.Update);

            // Create result set processor, use wildcard selection
            _statementSpec.SelectClauseSpec.SetSelectExprList(new SelectClauseElementWildcard());
            _statementSpec.SelectStreamDirEnum = SelectClauseStreamSelectorEnum.RSTREAM_ISTREAM_BOTH;
            var typeService = new StreamTypeServiceImpl(new EventType[] { createView.EventType }, new string[] { "create_variable" }, new bool[] { true }, _services.EngineURI, false);
            OutputProcessViewBase outputViewBase;

            try {
                ResultSetProcessorFactoryDesc resultSetProcessorPrototype = ResultSetProcessorFactoryFactory.GetProcessorPrototype(
                    _statementSpec, _statementContext, typeService, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, _services.ConfigSnapshot, _services.ResultSetProcessorHelperFactory, false, false);
                ResultSetProcessor resultSetProcessor = EPStatementStartMethodHelperAssignExpr.GetAssignResultSetProcessor(agentInstanceContext, resultSetProcessorPrototype, false, null, false);

                // Attach output view
                OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.Make(
                    _statementSpec,
                    _services.InternalEventRouter,
                    agentInstanceContext.StatementContext,
                    resultSetProcessor.ResultEventType, null,
                    _services.TableService,
                    resultSetProcessorPrototype.ResultSetProcessorFactory.ResultSetProcessorType,
                    _services.ResultSetProcessorHelperFactory,
                    _services.StatementVariableRefService);
                outputViewBase = outputViewFactory.MakeView(resultSetProcessor, agentInstanceContext);
                createView.AddView(outputViewBase);
            }
            catch (ExprValidationException ex)
            {
                throw new EPException("Unexpected exception in create-variable context allocation: " + ex.Message, ex);
            }

            return(new StatementAgentInstanceFactoryCreateVariableResult(outputViewBase, stopCallback, agentInstanceContext));
        }
        public StatementAgentInstanceFactoryOnTriggerNamedWindow(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, ExprNode validatedJoin, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, NamedWindowOnExprFactory onExprFactory, OutputProcessViewFactory outputProcessViewFactory, EventType activatorResultEventType, NamedWindowProcessor processor, IList <StopCallback> stopCallbacks)
            : base(statementContext, statementSpec, services, activator, subSelectStrategyCollection)
        {
            _resultSetProcessorPrototype       = resultSetProcessorPrototype;
            _outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
            _onExprFactory            = onExprFactory;
            _outputProcessViewFactory = outputProcessViewFactory;
            _processor = processor;

            IndexHintPair   pair            = GetIndexHintPair(statementContext, statementSpec);
            IndexHint       indexHint       = pair.IndexHint;
            ExcludePlanHint excludePlanHint = pair.ExcludePlanHint;

            _queryPlan = SubordinateQueryPlanner.PlanOnExpression(
                validatedJoin, activatorResultEventType, indexHint, processor.IsEnableSubqueryIndexShare, -1, excludePlanHint,
                processor.IsVirtualDataWindow, processor.EventTableIndexMetadataRepo, processor.NamedWindowType,
                processor.OptionalUniqueKeyProps, false, statementContext.StatementName, statementContext.StatementId, statementContext.Annotations);
            if (_queryPlan.IndexDescs != null)
            {
                SubordinateQueryPlannerUtil.AddIndexMetaAndRef(_queryPlan.IndexDescs, processor.EventTableIndexMetadataRepo, statementContext.StatementName);
                stopCallbacks.Add(new ProxyStopCallback(() =>
                {
                    for (int i = 0; i < _queryPlan.IndexDescs.Length; i++)
                    {
                        bool last = processor.EventTableIndexMetadataRepo.RemoveIndexReference(_queryPlan.IndexDescs[i].IndexMultiKey, statementContext.StatementName);
                        if (last)
                        {
                            processor.EventTableIndexMetadataRepo.RemoveIndex(_queryPlan.IndexDescs[i].IndexMultiKey);
                            processor.RemoveAllInstanceIndexes(_queryPlan.IndexDescs[i].IndexMultiKey);
                        }
                    }
                }));
            }
            SubordinateQueryPlannerUtil.QueryPlanLogOnExpr(processor.RootView.IsQueryPlanLogging, NamedWindowRootView.QueryPlanLog,
                                                           _queryPlan, statementContext.Annotations, statementContext.EngineImportService);
        }