Package com.espertech.esper.epl.named

Examples of com.espertech.esper.epl.named.NamedWindowProcessorInstance


                Pair<ResultSetProcessor, AggregationService> pair = EPStatementStartMethodHelperUtil.startResultSetAndAggregation(resultSetProcessorPrototype, agentInstanceContext);
                aggregationService = pair.getSecond();

                // get named window processor instance
                NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(onTriggerWindowDesc.getWindowName());
                NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);

                // obtain on-expr view
                NamedWindowOnExprBaseView onExprBaseView = processorInstance.getRootViewInstance().addOnExpr(onExprFactory, agentInstanceContext, validatedJoin, activatorResultEventType, pair.getFirst());
                onExprView = onExprBaseView;
                stopCallbacks.add(onExprBaseView);
            }
            // variable assignments
            else if (statementSpec.getOnTriggerDesc() instanceof OnTriggerSetDesc)
View Full Code Here


        if (numStreams > 1)
        {
            StreamJoinAnalysisResult streamJoinAnalysisResult = new StreamJoinAnalysisResult(numStreams);
            Arrays.fill(streamJoinAnalysisResult.getNamedWindow(), true);
            for (int i = 0; i < numStreams; i++) {
                NamedWindowProcessorInstance processorInstance = processors[i].getProcessorInstance(agentInstanceContext);
                if (processors[i].isVirtualDataWindow()) {
                    streamJoinAnalysisResult.getViewExternal()[i] = processorInstance.getRootViewInstance().getVirtualDataWindow();
                }
            }

            boolean hasAggregations = !resultSetProcessorPrototype.getAggregationServiceFactoryDesc().getExpressions().isEmpty();
            joinSetComposerPrototype = JoinSetComposerPrototypeFactory.makeComposerPrototype(null, null,
View Full Code Here

            agentInstanceIds = contextManager.getAgentInstanceIds(contextPartitionSelectors[0]);
        }

        // collect events and agent instances
        for (int agentInstanceId : agentInstanceIds) {
            NamedWindowProcessorInstance processorInstance = processors[0].getProcessorInstance(agentInstanceId);
            if (processorInstance != null) {
                Collection<EventBean> coll = processorInstance.getTailViewInstance().snapshot(filters[0], statementSpec.getAnnotations());
                contextPartitionResults.add(new ContextPartitionResult(coll, processorInstance.getTailViewInstance().getAgentInstanceContext()));
            }
        }

        // process context partitions
        ArrayDeque<EventBean[]> events = new ArrayDeque<EventBean[]>();
View Full Code Here

        final StreamSpecCompiled streamSpec = statementSpec.getStreamSpecs().get(streamNum);
        NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
        NamedWindowProcessor namedWindowProcessor = processors[streamNum];

        // handle the case of a single or matching agent instance
        NamedWindowProcessorInstance processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceContext);
        if (processorInstance != null) {
            return getStreamSnapshotInstance(streamNum, namedSpec, processorInstance);
        }

        // context partition runtime query
        Collection<Integer> contextPartitions;
        if (contextPartitionSelector == null || contextPartitionSelector instanceof ContextPartitionSelectorAll) {
            contextPartitions = namedWindowProcessor.getProcessorInstancesAll();
        }
        else {
            ContextManager contextManager = services.getContextManagementService().getContextManager(namedWindowProcessor.getContextName());
            contextPartitions = contextManager.getAgentInstanceIds(contextPartitionSelector);
        }

        // collect events
        ArrayDeque<EventBean> events = new ArrayDeque<EventBean>();
        for (int agentInstanceId : contextPartitions) {
            processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceId);
            if (processorInstance != null) {
                Collection<EventBean> coll = processorInstance.getTailViewInstance().snapshot(filters[streamNum], statementSpec.getAnnotations());
                events.addAll(coll);
            }
        }
        return events;
    }
View Full Code Here

        else
        {
            Viewable[] viewablePerStream = new Viewable[numStreams];
            for (int i = 0; i < numStreams; i++)
            {
                NamedWindowProcessorInstance instance = processors[i].getProcessorInstance(agentInstanceContext);
                if (instance == null) {
                    throw new UnsupportedOperationException("Joins against named windows that are under context are not supported");
                }
                viewablePerStream[i] = instance.getTailViewInstance();
            }

            JoinSetComposerDesc joinSetComposerDesc = joinSetComposerPrototype.create(viewablePerStream);
            JoinSetComposer joinComposer = joinSetComposerDesc.getJoinSetComposer();
            JoinSetFilter joinFilter;
View Full Code Here

            if (streamSpec instanceof NamedWindowConsumerStreamSpec)
            {
                NamedWindowConsumerStreamSpec nwSpec = (NamedWindowConsumerStreamSpec) streamSpec;
                analysisResult.setNamedWindow(i);
                NamedWindowProcessor processor = namedWindowService.getProcessor(nwSpec.getWindowName());
                NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(defaultAgentInstanceContext);
                if (processor.isVirtualDataWindow()) {
                    analysisResult.getViewExternal()[i] = processorInstance.getRootViewInstance().getVirtualDataWindow();
                }
            }
        }
        if ((unidirectionalStreamNumber != -1) && (analysisResult.getHasChildViews()[unidirectionalStreamNumber]))
        {
View Full Code Here

                        if (queryPlanLogging && queryPlanLog.isInfoEnabled()) {
                            queryPlanLog.info("prefering shared index");
                        }
                        boolean fullTableScan = HintEnum.SET_NOINDEX.getHint(annotations) != null;
                        SubordPropPlan joinedPropPlan = QueryPlanIndexBuilder.getJoinProps(filterExpr, outerEventTypes.length, subselectTypeService.getEventTypes());
                        NamedWindowProcessorInstance processorInstanceSubq = processor.getProcessorInstance(null);
                        SubordTableLookupStrategy namedWindowSubqueryLookup = processorInstanceSubq.getRootViewInstance().getAddSubqueryLookupStrategy(statementContext.getStatementName(), statementContext.getStatementId(), statementContext.getAnnotations(), outerEventTypesSelect, joinedPropPlan, fullTableScan);
                        stopCallbacks.add(new NamedWindowSubqueryStopCallback(processorInstanceSubq, namedWindowSubqueryLookup));
                        SubSelectStrategyFactory factory = new SubSelectStrategyFactoryNamedWinIndexShare(namedWindowSubqueryLookup, filterExprEval, aggregationServiceFactoryDesc);
                        SubSelectStrategyFactoryDesc factoryDesc = new SubSelectStrategyFactoryDesc(subSelectActivation, factory, aggregationServiceFactoryDesc, priorNodes, previousNodes);
                        collection.add(subselect, factoryDesc);
                        continue;
View Full Code Here

            throw new EPException("Context for named window is '" + processor.getContextName() + "' and query specifies context '" + statementSpec.getOptionalContextName() + "'");
        }

        // handle non-specified context
        if (statementSpec.getOptionalContextName() == null) {
            NamedWindowProcessorInstance processorInstance = processor.getProcessorInstanceNoContext();
            if (processorInstance != null) {
                EventBean[] rows = executor.execute(processorInstance);
                if (rows.length > 0) {
                    dispatch();
                }
                return new EPPreparedQueryResult(processor.getNamedWindowType(), rows);
            }
        }

        // context partition runtime query
        Collection<Integer> agentInstanceIds = EPPreparedExecuteMethodHelper.getAgentInstanceIds(processor, optionalSingleSelector, services.getContextManagementService(), processor.getContextName());

        // collect events and agent instances
        if (agentInstanceIds.isEmpty()) {
            return new EPPreparedQueryResult(processor.getNamedWindowType(), CollectionUtil.EVENTBEANARRAY_EMPTY);
        }

        if (agentInstanceIds.size() == 1) {
            int agentInstanceId = agentInstanceIds.iterator().next();
            NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceId);
            EventBean[] rows = executor.execute(processorInstance);
            if (rows.length > 0) {
                dispatch();
            }
            return new EPPreparedQueryResult(processor.getNamedWindowType(), rows);
        }

        ArrayDeque<EventBean> allRows = new ArrayDeque<EventBean>();
        for (int agentInstanceId : agentInstanceIds) {
            NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceId);
            if (processorInstance != null) {
                EventBean[] rows = executor.execute(processorInstance);
                allRows.addAll(Arrays.asList(rows));
            }
        }
View Full Code Here

        if (numStreams > 1)
        {
            StreamJoinAnalysisResult streamJoinAnalysisResult = new StreamJoinAnalysisResult(numStreams);
            Arrays.fill(streamJoinAnalysisResult.getNamedWindow(), true);
            for (int i = 0; i < numStreams; i++) {
                final NamedWindowProcessorInstance processorInstance = processors[i].getProcessorInstance(agentInstanceContext);
                if (processors[i].isVirtualDataWindow()) {
                    streamJoinAnalysisResult.getViewExternal()[i] = new VirtualDWViewProviderForAgentInstance() {
                        public VirtualDWView getView(AgentInstanceContext agentInstanceContext) {
                            return processorInstance.getRootViewInstance().getVirtualDataWindow();
                        }
                    };
                }
                String[][] uniqueIndexes = processors[i].getUniqueIndexes(processorInstance);
                streamJoinAnalysisResult.getUniqueKeys()[i] = uniqueIndexes;
View Full Code Here

        // context partition runtime query
        Collection<Integer> agentInstanceIds = EPPreparedExecuteMethodHelper.getAgentInstanceIds(processors[0], singleSelector, services.getContextManagementService(), statementSpec.getOptionalContextName());

        // collect events and agent instances
        for (int agentInstanceId : agentInstanceIds) {
            NamedWindowProcessorInstance processorInstance = processors[0].getProcessorInstance(agentInstanceId);
            if (processorInstance != null) {
                Collection<EventBean> coll = processorInstance.getTailViewInstance().snapshot(filters[0], statementSpec.getAnnotations());
                contextPartitionResults.add(new ContextPartitionResult(coll, processorInstance.getTailViewInstance().getAgentInstanceContext()));
            }
        }

        // process context partitions
        ArrayDeque<EventBean[]> events = new ArrayDeque<EventBean[]>();
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.named.NamedWindowProcessorInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.