Package com.espertech.esper.epl.virtualdw

Examples of com.espertech.esper.epl.virtualdw.VirtualDWView


            newConsumers.remove(handleRemoved);
            consumersInContext = newConsumers;
        }

        // indicate to virtual data window that a consumer was added
        VirtualDWView virtualDWView = rootViewInstance.getVirtualDataWindow();
        if (virtualDWView != null && handleRemoved != null) {
            virtualDWView.getVirtualDataWindow().handleEvent(new VirtualDataWindowEventConsumerRemove(tailView.getEventType().getName(), namedWindowConsumerView, handleRemoved.getStatementHandle().getStatementName(), handleRemoved.getAgentInstanceId()));
        }
    }
View Full Code Here


            indexesPerStream[streamNo] = new LinkedHashMap<String, EventTable>();

            for (Map.Entry<String, QueryPlanIndexItem> entry : items.entrySet()) {
                EventTable index;
                if (streamJoinAnalysisResult.getViewExternal()[streamNo] != null) {
                    VirtualDWView view = streamJoinAnalysisResult.getViewExternal()[streamNo].getView(agentInstanceContext);
                    index = view.getJoinIndexTable(items.get(entry.getKey()));
                }
                else {
                    index = EventTableUtil.buildIndex(streamNo, items.get(entry.getKey()), streamTypes[streamNo], false, entry.getValue().isUnique(), null);
                }
                indexesPerStream[streamNo].put(entry.getKey(), index);
View Full Code Here

     * @return events
     */
    public Collection<EventBean> snapshot(FilterSpecCompiled optionalFilter, Annotation[] annotations) {

        // Determine virtual data window
        VirtualDWView virtualDataWindow = null;
        if (isVirtualDataWindow()) {
            virtualDataWindow = getVirtualDataWindow();
        }

        if (optionalFilter == null || optionalFilter.getParameters().length == 0) {
            if (virtualDataWindow != null) {
                Pair<IndexMultiKey,EventTable> pair = virtualDataWindow.getFireAndForgetDesc(Collections.<String>emptySet(), Collections.<String>emptySet());
                return virtualDataWindow.getFireAndForgetData(pair.getSecond(), new Object[0], new RangeIndexLookupValue[0], annotations);
            }
            return null;
        }

        // Determine what straight-equals keys and which ranges are available.
        // Widening/Coercion is part of filter spec compile.
        Set<String> keysAvailable = new HashSet<String>();
        Set<String> rangesAvailable = new HashSet<String>();
        for (FilterSpecParam param : optionalFilter.getParameters()) {
            if (!(param instanceof FilterSpecParamConstant ||
                  param instanceof FilterSpecParamRange ||
                  param instanceof FilterSpecParamIn)) {
                continue;
            }
            if (param.getFilterOperator() == FilterOperator.EQUAL ||
                param.getFilterOperator() == FilterOperator.IS ||
                param.getFilterOperator() == FilterOperator.IN_LIST_OF_VALUES) {
                keysAvailable.add(param.getLookupable().getExpression());
            }
            else if (param.getFilterOperator().isRangeOperator() ||
                     param.getFilterOperator().isInvertedRangeOperator() ||
                     param.getFilterOperator().isComparisonOperator()) {
                rangesAvailable.add(param.getLookupable().getExpression());
            }
            else if (param.getFilterOperator().isRangeOperator()) {
                rangesAvailable.add(param.getLookupable().getExpression());
            }
        }

        // Find an index that matches the needs
        Pair<IndexMultiKey, EventTableAndNamePair> tablePair;
        if (virtualDataWindow != null) {
            Pair<IndexMultiKey, EventTable> tablePairNoName = virtualDataWindow.getFireAndForgetDesc(keysAvailable, rangesAvailable);
            tablePair = new Pair<IndexMultiKey, EventTableAndNamePair>(tablePairNoName.getFirst(), new EventTableAndNamePair(tablePairNoName.getSecond(), null));
        }
        else {
            IndexHint indexHint = IndexHint.getIndexHint(annotations);
            tablePair = indexRepository.findTable(keysAvailable, rangesAvailable, indexHint);
View Full Code Here

        }

        // Get or create the table for this index (exact match or property names, type of index and coercion type is expected)
        Pair<IndexMultiKey, EventTableAndNamePair> tableDesc;
        if (isVirtualDataWindow()) {
            VirtualDWView viewExternal = getVirtualDataWindow();
            Pair<IndexMultiKey,EventTable> tableVW = viewExternal.getSubordinateQueryDesc(false, hashedProps, btreeProps);
            tableDesc = new Pair<IndexMultiKey, EventTableAndNamePair>(tableVW.getFirst(), new EventTableAndNamePair(tableVW.getSecond(), null));
        }
        else {
            if (hashedProps.isEmpty() && btreeProps.isEmpty()) {
                return null;
View Full Code Here

            rangeKeyCoercionTypes = indexKeyInfo.getOrderedRangeCoercionTypes();
        }

        SubordTableLookupStrategy lookupStrategy;
        if (isVirtualDataWindow()) {
            VirtualDWView viewExternal = getVirtualDataWindow();
            lookupStrategy = viewExternal.getSubordinateLookupStrategy(accessedByAIContext.getStatementName(),
                    accessedByAIContext.getStatementId(), accessedByAIContext.getStatementContext().getAnnotations(),
                    outerStreamTypes, hashKeys, hashKeyCoercionTypes, rangeKeys, rangeKeyCoercionTypes, isNWOnTrigger,
                    tables[0].getEventTable(), joinDesc, forceTableScan);
        }
        else {
View Full Code Here

     * @return events
     */
    public Collection<EventBean> snapshot(FilterSpecCompiled optionalFilter, Annotation[] annotations) {

        // Determine virtual data window
        VirtualDWView virtualDataWindow = null;
        if (isVirtualDataWindow()) {
            virtualDataWindow = getVirtualDataWindow();
        }

        if (optionalFilter == null || optionalFilter.getParameters().length == 0) {
            if (virtualDataWindow != null) {
                Pair<IndexMultiKey,EventTable> pair = virtualDataWindow.getFireAndForgetDesc(Collections.<String>emptySet(), Collections.<String>emptySet());
                return virtualDataWindow.getFireAndForgetData(pair.getSecond(), new Object[0], new RangeIndexLookupValue[0], annotations);
            }
            return null;
        }

        // Determine what straight-equals keys and which ranges are available.
        // Widening/Coercion is part of filter spec compile.
        Set<String> keysAvailable = new HashSet<String>();
        Set<String> rangesAvailable = new HashSet<String>();
        for (FilterSpecParam param : optionalFilter.getParameters()) {
            if (!(param instanceof FilterSpecParamConstant ||
                  param instanceof FilterSpecParamRange ||
                  param instanceof FilterSpecParamIn)) {
                continue;
            }
            if (param.getFilterOperator() == FilterOperator.EQUAL ||
                param.getFilterOperator() == FilterOperator.IS ||
                param.getFilterOperator() == FilterOperator.IN_LIST_OF_VALUES) {
                keysAvailable.add(param.getLookupable().getExpression());
            }
            else if (param.getFilterOperator().isRangeOperator() ||
                     param.getFilterOperator().isInvertedRangeOperator() ||
                     param.getFilterOperator().isComparisonOperator()) {
                rangesAvailable.add(param.getLookupable().getExpression());
            }
            else if (param.getFilterOperator().isRangeOperator()) {
                rangesAvailable.add(param.getLookupable().getExpression());
            }
        }

        // Find an index that matches the needs
        Pair<IndexMultiKey, EventTableAndNamePair> tablePair;
        if (virtualDataWindow != null) {
            Pair<IndexMultiKey, EventTable> tablePairNoName = virtualDataWindow.getFireAndForgetDesc(keysAvailable, rangesAvailable);
            tablePair = new Pair<IndexMultiKey, EventTableAndNamePair>(tablePairNoName.getFirst(), new EventTableAndNamePair(tablePairNoName.getSecond(), null));
        }
        else {
            IndexHint indexHint = IndexHint.getIndexHint(annotations);
            tablePair = indexRepository.findTable(keysAvailable, rangesAvailable, explicitIndexes, indexHint);
View Full Code Here

        }

        // Get or Create the table for this index (exact match or property names, type of index and coercion type is expected)
        Pair<IndexMultiKey, EventTableAndNamePair> tableDesc;
        if (isVirtualDataWindow()) {
            VirtualDWView viewExternal = getVirtualDataWindow();
            Pair<IndexMultiKey,EventTable> tableVW = viewExternal.getSubordinateQueryDesc(false, hashedProps, btreeProps);
            tableDesc = new Pair<IndexMultiKey, EventTableAndNamePair>(tableVW.getFirst(), new EventTableAndNamePair(tableVW.getSecond(), null));
        }
        else {
            if (joinDesc.getHashProps().isEmpty() && joinDesc.getRangeProps().isEmpty()) {
                return null;
View Full Code Here

        List<SubordPropRangeKey> rangeKeys = indexKeyInfo.getOrderedRangeDesc();
        CoercionDesc rangeKeyCoercionTypes = indexKeyInfo.getOrderedRangeCoercionTypes();

        SubordTableLookupStrategy lookupStrategy;
        if (isVirtualDataWindow()) {
            VirtualDWView viewExternal = getVirtualDataWindow();
            lookupStrategy = viewExternal.getSubordinateLookupStrategy(accessedByStatementName, accessedByStatementId, accessedByStmtAnnotations, outerStreamTypes,
                    hashKeys, hashKeyCoercionTypes, rangeKeys, rangeKeyCoercionTypes, isNWOnTrigger, eventTable, joinDesc, forceTableScan);
        }
        else {
            if (forceTableScan) {
                lookupStrategy = null;
View Full Code Here

        }
        final NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(getDefaultAgentInstanceContext(statementContext));

        EPStatementStopMethod stopMethod;
        if (processor.isVirtualDataWindow()) {
            final VirtualDWView virtualDWView = processorInstance.getRootViewInstance().getVirtualDataWindow();
            virtualDWView.handleStartIndex(spec);
            stopMethod = new EPStatementStopMethod() {
                public void stop() {
                    virtualDWView.handleStopIndex(spec);
                }
            };
        }
        else {
            processorInstance.getRootViewInstance().addExplicitIndex(spec.isUnique(), spec.getWindowName(), spec.getIndexName(), spec.getColumns());
View Full Code Here

            // If this is a virtual data window implementation, bind it to the context for easy lookup
            StopCallback envStopCallback = null;
            if (finalView instanceof VirtualDWView) {
                final String objectName = "/virtualdw/" + windowName;
                final VirtualDWView virtualDWView = (VirtualDWView) finalView;
                try {
                    services.getEngineEnvContext().bind(objectName, virtualDWView.getVirtualDataWindow());
                }
                catch (NamingException e) {
                    throw new ViewProcessingException("Invalid name for adding to context:" + e.getMessage(), e);
                }
                envStopCallback = new StopCallback() {
                    public void stop() {
                        try {
                            virtualDWView.destroy();
                            services.getEngineEnvContext().unbind(objectName);
                        } catch (NamingException e) {}
                    }
                };
            }
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.virtualdw.VirtualDWView

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.