Java Code Examples for io.siddhi.core.config.SiddhiQueryContext#getName()

The following examples show how to use io.siddhi.core.config.SiddhiQueryContext#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionBatchWindowProcessor.java    From siddhi with Apache License 2.0 6 votes vote down vote up
private MetaStateEvent constructExpression(MetaStreamEvent metaStreamEvent,
                                           SiddhiQueryContext siddhiQueryContext) {
    Expression expression = SiddhiCompiler.parseExpression(expressionString);
    MetaStreamEvent metaStreamEventFirst = new MetaStreamEventWrapper(metaStreamEvent);
    metaStreamEventFirst.setInputReferenceId("first");
    MetaStreamEvent metaStreamEventLast = new MetaStreamEventWrapper(metaStreamEvent);
    metaStreamEventLast.setInputReferenceId("last");
    MetaStateEvent metaStateEvent = new MetaStateEvent(
            new MetaStreamEvent[]{metaStreamEvent, metaStreamEventFirst, metaStreamEventLast});
    variableExpressionExecutors = new ArrayList<>();
    SiddhiQueryContext exprQueryContext = new SiddhiOnDemandQueryContext(
            siddhiQueryContext.getSiddhiAppContext(), siddhiQueryContext.getName(),
            expressionString);
    expressionExecutor = ExpressionParser.parseExpression(expression, metaStateEvent,
            0, new HashMap<>(), variableExpressionExecutors, false,
            0, ProcessingMode.SLIDE, true, exprQueryContext);
    if (expressionExecutor.getReturnType() != Attribute.Type.BOOL) {
        throw new SiddhiAppRuntimeException("Expression ('" + expressionString + "') does not return Bool");
    }
    return metaStateEvent;
}
 
Example 2
Source File: ExpressionWindowProcessor.java    From siddhi with Apache License 2.0 6 votes vote down vote up
private MetaStateEvent constructExpression(MetaStreamEvent metaStreamEvent,
                                           SiddhiQueryContext siddhiQueryContext) {
    Expression expression = SiddhiCompiler.parseExpression(expressionString);
    MetaStreamEvent metaStreamEventFirst = new MetaStreamEventWrapper(metaStreamEvent);
    metaStreamEventFirst.setInputReferenceId("first");
    MetaStreamEvent metaStreamEventLast = new MetaStreamEventWrapper(metaStreamEvent);
    metaStreamEventLast.setInputReferenceId("last");
    MetaStateEvent metaStateEvent = new MetaStateEvent(
            new MetaStreamEvent[]{metaStreamEvent, metaStreamEventFirst, metaStreamEventLast});
    variableExpressionExecutors = new ArrayList<>();
    SiddhiQueryContext exprQueryContext = new SiddhiOnDemandQueryContext(
            siddhiQueryContext.getSiddhiAppContext(), siddhiQueryContext.getName(),
            expressionString);
    expressionExecutor = ExpressionParser.parseExpression(expression, metaStateEvent,
            0, new HashMap<>(), variableExpressionExecutors, false,
            0, ProcessingMode.SLIDE, true, exprQueryContext);
    if (expressionExecutor.getReturnType() != Attribute.Type.BOOL) {
        throw new SiddhiAppRuntimeException("Expression ('" + expressionString + "') does not return Bool");
    }
    return metaStateEvent;
}
 
Example 3
Source File: OutputParser.java    From siddhi with Apache License 2.0 6 votes vote down vote up
public static OutputCallback constructOutputCallback(OutputStream outStream, String key,
                                                     ConcurrentMap<String, StreamJunction> streamJunctionMap,
                                                     StreamDefinition outputStreamDefinition,
                                                     SiddhiQueryContext siddhiQueryContext) {
    String id = outStream.getId();
    //Construct CallBack
    if (outStream instanceof InsertIntoStream) {
        StreamJunction outputStreamJunction = streamJunctionMap.get(id + key);
        if (outputStreamJunction == null) {
            outputStreamJunction = new StreamJunction(outputStreamDefinition,
                    siddhiQueryContext.getSiddhiAppContext().getExecutorService(),
                    siddhiQueryContext.getSiddhiAppContext().getBufferSize(), null,
                    siddhiQueryContext.getSiddhiAppContext());
            streamJunctionMap.putIfAbsent(id + key, outputStreamJunction);
        }
        InsertIntoStreamCallback insertIntoStreamCallback = new InsertIntoStreamCallback(outputStreamDefinition,
                siddhiQueryContext.getName());
        insertIntoStreamCallback.init(streamJunctionMap.get(id + key));
        return insertIntoStreamCallback;

    } else {
        throw new SiddhiAppCreationException(outStream.getClass().getName() + " not supported",
                outStream.getQueryContextStartIndex(), outStream.getQueryContextEndIndex());
    }
}
 
Example 4
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 6 votes vote down vote up
private static OnDemandQueryRuntime constructOnDemandQueryRuntime(
        Window window, OnDemandQuery onDemandQuery,
        Map<String, Table> tableMap, Map<String, Window> windowMap,
        int metaPosition, Expression onCondition, MetaStreamEvent metaStreamEvent,
        List<VariableExpressionExecutor> variableExpressionExecutors, LockWrapper lockWrapper,
        SiddhiQueryContext siddhiQueryContext) {
    metaStreamEvent.setEventType(EventType.WINDOW);
    initMetaStreamEvent(metaStreamEvent, window.getWindowDefinition());
    MatchingMetaInfoHolder metaStreamInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent,
            window.getWindowDefinition());
    CompiledCondition compiledCondition = window.compileCondition(onCondition,
            generateMatchingMetaInfoHolder(metaStreamEvent, window.getWindowDefinition()),
            variableExpressionExecutors, tableMap, siddhiQueryContext);
    FindOnDemandQueryRuntime findOnDemandQueryRuntime = new FindOnDemandQueryRuntime(window, compiledCondition,
            siddhiQueryContext.getName(), metaStreamEvent);
    populateFindOnDemandQueryRuntime(findOnDemandQueryRuntime, metaStreamInfoHolder, onDemandQuery.getSelector(),
            variableExpressionExecutors, tableMap, windowMap, metaPosition,
            !onDemandQuery.getSelector().getGroupByList().isEmpty(), lockWrapper, siddhiQueryContext);
    return findOnDemandQueryRuntime;
}
 
Example 5
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 6 votes vote down vote up
private static QuerySelector getQuerySelector(MatchingMetaInfoHolder matchingMetaInfoHolder,
                                              List<VariableExpressionExecutor> variableExpressionExecutors,
                                              Map<String, Table> tableMap,
                                              Map<String, Window> windowMap, int metaPosition,
                                              OnDemandQuery onDemandQuery, LockWrapper lockWrapper,
                                              SiddhiQueryContext siddhiQueryContext) {
    QuerySelector querySelector = SelectorParser.parse(onDemandQuery.getSelector(), onDemandQuery.getOutputStream(),
            matchingMetaInfoHolder.getMetaStateEvent(), tableMap, variableExpressionExecutors, metaPosition,
            ProcessingMode.BATCH, false, siddhiQueryContext);

    PassThroughOutputRateLimiter rateLimiter = new PassThroughOutputRateLimiter(siddhiQueryContext.getName());
    rateLimiter.init(lockWrapper, !onDemandQuery.getSelector().getGroupByList().isEmpty(), siddhiQueryContext);
    OutputCallback outputCallback = OutputParser.constructOutputCallback(onDemandQuery.getOutputStream(),
            matchingMetaInfoHolder.getMetaStateEvent().getOutputStreamDefinition(), tableMap, windowMap,
            true, siddhiQueryContext);
    rateLimiter.setOutputCallback(outputCallback);
    querySelector.setNextProcessor(rateLimiter);

    QueryParserHelper.reduceMetaComplexEvent(matchingMetaInfoHolder.getMetaStateEvent());
    QueryParserHelper.updateVariablePosition(matchingMetaInfoHolder.getMetaStateEvent(),
            variableExpressionExecutors);
    querySelector.setEventPopulator(
            StateEventPopulatorFactory.constructEventPopulator(matchingMetaInfoHolder.getMetaStateEvent()));
    return querySelector;
}
 
Example 6
Source File: CronWindowProcessor.java    From siddhi with Apache License 2.0 5 votes vote down vote up
@Override
protected StateFactory<WindowState> init(ExpressionExecutor[] attributeExpressionExecutors,
                                         ConfigReader configReader,
                                         StreamEventClonerHolder streamEventClonerHolder,
                                         boolean outputExpectsExpiredEvents,
                                         boolean findToBeExecuted,
                                         SiddhiQueryContext siddhiQueryContext) {
    this.streamEventClonerHolder = streamEventClonerHolder;
    this.id = siddhiQueryContext.getName() + "_" + siddhiQueryContext.generateNewId();
    if (attributeExpressionExecutors != null) {
        cronString = (String) (((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue());
    }
    return () -> new WindowState(streamEventClonerHolder);
}
 
Example 7
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 5 votes vote down vote up
private static OnDemandQueryRuntime constructOnDemandQueryRuntime(AggregationRuntime aggregation,
                                                                  OnDemandQuery onDemandQuery,
                                                                  Map<String, Table> tableMap,
                                                                  Map<String, Window> windowMap,
                                                                  Within within, Expression per,
                                                                  Expression onCondition,
                                                                  MetaStreamEvent metaStreamEvent,
                                                                  List<VariableExpressionExecutor>
                                                                          variableExpressionExecutors,
                                                                  LockWrapper lockWrapper,
                                                                  SiddhiQueryContext siddhiQueryContext) {
    int metaPosition;
    metaStreamEvent.setEventType(EventType.AGGREGATE);
    initMetaStreamEvent(metaStreamEvent, aggregation.getAggregationDefinition());
    MatchingMetaInfoHolder metaStreamInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent,
            aggregation.getAggregationDefinition());
    CompiledCondition compiledCondition = aggregation.compileExpression(onCondition, within, per,
            onDemandQuery.getSelector().getGroupByList(), metaStreamInfoHolder, variableExpressionExecutors,
            tableMap, siddhiQueryContext);
    ((IncrementalAggregateCompileCondition) compiledCondition).init();
    metaStreamInfoHolder = ((IncrementalAggregateCompileCondition) compiledCondition).
            getAlteredMatchingMetaInfoHolder();
    FindOnDemandQueryRuntime findOnDemandQueryRuntime = new FindOnDemandQueryRuntime(aggregation, compiledCondition,
            siddhiQueryContext.getName(), metaStreamEvent, siddhiQueryContext);
    metaPosition = 1;
    populateFindOnDemandQueryRuntime(findOnDemandQueryRuntime, metaStreamInfoHolder,
            onDemandQuery.getSelector(), variableExpressionExecutors, tableMap, windowMap,
            metaPosition, !onDemandQuery.getSelector().getGroupByList().isEmpty(), lockWrapper, siddhiQueryContext);
    ComplexEventPopulater complexEventPopulater = StreamEventPopulaterFactory.constructEventPopulator(
            metaStreamInfoHolder.getMetaStateEvent().getMetaStreamEvent(0), 0,
            ((IncrementalAggregateCompileCondition) compiledCondition).getAdditionalAttributes());
    ((IncrementalAggregateCompileCondition) compiledCondition)
            .setComplexEventPopulater(complexEventPopulater);
    return findOnDemandQueryRuntime;
}
 
Example 8
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 5 votes vote down vote up
private static void populateFindOnDemandQueryRuntime(FindOnDemandQueryRuntime findOnDemandQueryRuntime,
                                                     MatchingMetaInfoHolder metaStreamInfoHolder, Selector selector,
                                                     List<VariableExpressionExecutor> variableExpressionExecutors,
                                                     Map<String, Table> tableMap, Map<String, Window> windowMap,
                                                     int metaPosition, boolean groupBy, LockWrapper lockWrapper,
                                                     SiddhiQueryContext siddhiQueryContext) {
    ReturnStream returnStream = new ReturnStream(OutputStream.OutputEventType.CURRENT_EVENTS);
    QuerySelector querySelector = SelectorParser.parse(selector, returnStream,
            metaStreamInfoHolder.getMetaStateEvent(), tableMap, variableExpressionExecutors,
            metaPosition, ProcessingMode.BATCH, false, siddhiQueryContext);
    PassThroughOutputRateLimiter rateLimiter = new PassThroughOutputRateLimiter(siddhiQueryContext.getName());
    rateLimiter.init(lockWrapper, groupBy, siddhiQueryContext);
    OutputCallback outputCallback = OutputParser.constructOutputCallback(returnStream,
            metaStreamInfoHolder.getMetaStateEvent().getOutputStreamDefinition(), tableMap, windowMap,
            true, siddhiQueryContext);
    rateLimiter.setOutputCallback(outputCallback);
    querySelector.setNextProcessor(rateLimiter);

    QueryParserHelper.reduceMetaComplexEvent(metaStreamInfoHolder.getMetaStateEvent());
    QueryParserHelper.updateVariablePosition(metaStreamInfoHolder.getMetaStateEvent(), variableExpressionExecutors);
    querySelector.setEventPopulator(
            StateEventPopulatorFactory.constructEventPopulator(metaStreamInfoHolder.getMetaStateEvent()));
    findOnDemandQueryRuntime.setStateEventFactory(new StateEventFactory(metaStreamInfoHolder.getMetaStateEvent()));
    findOnDemandQueryRuntime.setSelector(querySelector);
    findOnDemandQueryRuntime.setOutputAttributes(metaStreamInfoHolder.getMetaStateEvent().
            getOutputStreamDefinition().getAttributeList());
}
 
Example 9
Source File: OperatorParser.java    From siddhi with Apache License 2.0 5 votes vote down vote up
public static Operator constructOperatorForCache(Object storeEvents, Expression expression,
                                                 MatchingMetaInfoHolder matchingMetaInfoHolder,
                                                 List<VariableExpressionExecutor> variableExpressionExecutors,
                                                 Map<String, Table> tableMap, SiddhiQueryContext siddhiQueryContext,
                                                 boolean updateCachePolicyAttribute, CacheTable cacheTable) {
    if (storeEvents instanceof IndexedEventHolder && updateCachePolicyAttribute) {
        CollectionExpression collectionExpression = CollectionExpressionParser.parseCollectionExpression(
                expression, matchingMetaInfoHolder, (IndexedEventHolder) storeEvents);
        CollectionExecutor collectionExecutor = CollectionExpressionParser.buildCollectionExecutor(
                collectionExpression, matchingMetaInfoHolder, variableExpressionExecutors, tableMap,
                true, ProcessingMode.BATCH, false, siddhiQueryContext, true, cacheTable);
        if (collectionExpression instanceof CompareCollectionExpression &&
                ((CompareCollectionExpression) collectionExpression).getOperator() == Compare.Operator.EQUAL &&
                (collectionExpression.getCollectionScope() == INDEXED_RESULT_SET ||
                        collectionExpression.getCollectionScope() == PRIMARY_KEY_RESULT_SET) &&
                ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders() != null &&
                ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders().length == 1 &&
                ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders()[0].getPrimaryKeyAttribute().
                        equals(((AttributeCollectionExpression)
                                ((CompareCollectionExpression) collectionExpression)
                                        .getAttributeCollectionExpression()).getAttribute())) {

            return new OverwriteTableIndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(),
                    cacheTable);
        } else if (collectionExpression instanceof AndMultiPrimaryKeyCollectionExpression &&
                collectionExpression.getCollectionScope() == PRIMARY_KEY_RESULT_SET) {
            return new OverwriteTableIndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(),
                    cacheTable);
        } else {
            return new IndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(), cacheTable);
        }
    }
    return constructOperator(storeEvents, expression, matchingMetaInfoHolder, variableExpressionExecutors,
            tableMap, siddhiQueryContext);
}
 
Example 10
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 4 votes vote down vote up
private static OnDemandQueryRuntime constructOptimizedOnDemandQueryRuntime(Table table,
                                                                               OnDemandQuery onDemandQuery,
                                                                               Map<String, Table> tableMap,
                                                                               int metaPosition, Expression onCondition,
                                                                               MetaStreamEvent metaStreamEvent,
                                                                               List<VariableExpressionExecutor>
                                                                                       variableExpressionExecutors,
                                                                               SiddhiQueryContext siddhiQueryContext) {
        MatchingMetaInfoHolder matchingMetaInfoHolder;

        initMetaStreamEvent(metaStreamEvent, table.getTableDefinition());
        matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, table.getTableDefinition());
        CompiledCondition compiledCondition = table.compileCondition(onCondition, matchingMetaInfoHolder,
                variableExpressionExecutors, tableMap, siddhiQueryContext);
        List<Attribute> expectedOutputAttributes = buildExpectedOutputAttributes(onDemandQuery,
                tableMap, metaPosition, matchingMetaInfoHolder, siddhiQueryContext);

//        MatchingMetaInfoHolder matchingMetaInfoHolderForSelection = generateMatchingMetaInfoHolder(
//                metaStreamEvent, generateTableDefinitionFromOnDemandQuery(onDemandQuery, expectedOutputAttributes),
//                table.getTableDefinition());
        CompiledSelection compiledSelection = ((QueryableProcessor) table).compileSelection(
                onDemandQuery.getSelector(), expectedOutputAttributes, matchingMetaInfoHolder,
                variableExpressionExecutors, tableMap, siddhiQueryContext);
        OnDemandQueryRuntime onDemandQueryRuntime =
                new SelectOnDemandQueryRuntime((QueryableProcessor) table, compiledCondition,
                        compiledSelection, expectedOutputAttributes, siddhiQueryContext.getName());
        try {
            AbstractQueryableRecordTable.CompiledSelectionWithCache compiledSelectionWithCache =
                    (AbstractQueryableRecordTable.CompiledSelectionWithCache) compiledSelection;
            onDemandQueryRuntime.setSelector(compiledSelectionWithCache.getQuerySelector());
            onDemandQueryRuntime.setMetaStreamEvent(metaStreamEvent);
            onDemandQueryRuntime.setStateEventFactory(new StateEventFactory(
                    matchingMetaInfoHolder.getMetaStateEvent()));
        } catch (ClassCastException ignored) {

        }

        QueryParserHelper.reduceMetaComplexEvent(matchingMetaInfoHolder.getMetaStateEvent());
        QueryParserHelper.updateVariablePosition(matchingMetaInfoHolder.getMetaStateEvent(),
                variableExpressionExecutors);
        return onDemandQueryRuntime;
    }
 
Example 11
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 4 votes vote down vote up
private static OnDemandQueryRuntime constructRegularOnDemandQueryRuntime(Table table, OnDemandQuery onDemandQuery,
                                                                         Map<String, Table> tableMap,
                                                                         Map<String, Window> windowMap,
                                                                         int metaPosition, Expression onCondition,
                                                                         MetaStreamEvent metaStreamEvent,
                                                                         List<VariableExpressionExecutor>
                                                                                 variableExpressionExecutors,
                                                                         LockWrapper lockWrapper,
                                                                         SiddhiQueryContext siddhiQueryContext) {
    MatchingMetaInfoHolder matchingMetaInfoHolder;
    AbstractDefinition inputDefinition;
    QuerySelector querySelector;

    switch (onDemandQuery.getType()) {
        case FIND:
            initMetaStreamEvent(metaStreamEvent, table.getTableDefinition());
            matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent,
                    table.getTableDefinition());
            CompiledCondition compiledCondition = table.compileCondition(onCondition, matchingMetaInfoHolder,
                    variableExpressionExecutors, tableMap, siddhiQueryContext);

            FindOnDemandQueryRuntime findOnDemandQueryRuntime = new FindOnDemandQueryRuntime(table, compiledCondition,
                    siddhiQueryContext.getName(), metaStreamEvent);
            populateFindOnDemandQueryRuntime(findOnDemandQueryRuntime, matchingMetaInfoHolder,
                    onDemandQuery.getSelector(), variableExpressionExecutors,
                    tableMap, windowMap, metaPosition, !onDemandQuery.getSelector().getGroupByList().isEmpty(),
                    lockWrapper, siddhiQueryContext);
            return findOnDemandQueryRuntime;
        case INSERT:
            initMetaStreamEvent(metaStreamEvent, getInputDefinition(onDemandQuery, table));
            matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent,
                    table.getTableDefinition());
            querySelector = getQuerySelector(matchingMetaInfoHolder, variableExpressionExecutors,
                    tableMap, windowMap, metaPosition, onDemandQuery, lockWrapper, siddhiQueryContext);

            InsertOnDemandQueryRuntime insertOnDemandQueryRuntime =
                    new InsertOnDemandQueryRuntime(siddhiQueryContext.getName(), metaStreamEvent);
            insertOnDemandQueryRuntime.setStateEventFactory(
                    new StateEventFactory(matchingMetaInfoHolder.getMetaStateEvent()));
            insertOnDemandQueryRuntime.setSelector(querySelector);
            insertOnDemandQueryRuntime.setOutputAttributes(matchingMetaInfoHolder.getMetaStateEvent()
                    .getOutputStreamDefinition().getAttributeList());
            return insertOnDemandQueryRuntime;
        case DELETE:
            inputDefinition = getInputDefinition(onDemandQuery, table);
            initMetaStreamEvent(metaStreamEvent, inputDefinition);
            matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent,
                    inputDefinition, table.getTableDefinition());
            querySelector = getQuerySelector(matchingMetaInfoHolder, variableExpressionExecutors,
                    tableMap, windowMap, metaPosition, onDemandQuery, lockWrapper, siddhiQueryContext);

            DeleteOnDemandQueryRuntime deleteOnDemandQueryRuntime =
                    new DeleteOnDemandQueryRuntime(siddhiQueryContext.getName(), metaStreamEvent);
            deleteOnDemandQueryRuntime.setStateEventFactory(
                    new StateEventFactory(matchingMetaInfoHolder.getMetaStateEvent()));
            deleteOnDemandQueryRuntime.setSelector(querySelector);
            deleteOnDemandQueryRuntime.setOutputAttributes(matchingMetaInfoHolder.getMetaStateEvent()
                    .getOutputStreamDefinition().getAttributeList());
            return deleteOnDemandQueryRuntime;
        case UPDATE:
            inputDefinition = getInputDefinition(onDemandQuery, table);
            initMetaStreamEvent(metaStreamEvent, inputDefinition);
            matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, inputDefinition,
                    table.getTableDefinition());
            querySelector = getQuerySelector(matchingMetaInfoHolder, variableExpressionExecutors,
                    tableMap, windowMap, metaPosition, onDemandQuery, lockWrapper, siddhiQueryContext);

            UpdateOnDemandQueryRuntime updateOnDemandQueryRuntime =
                    new UpdateOnDemandQueryRuntime(siddhiQueryContext.getName(), metaStreamEvent);
            updateOnDemandQueryRuntime.setStateEventFactory(
                    new StateEventFactory(matchingMetaInfoHolder.getMetaStateEvent()));
            updateOnDemandQueryRuntime.setSelector(querySelector);
            updateOnDemandQueryRuntime.setOutputAttributes(matchingMetaInfoHolder.getMetaStateEvent()
                    .getOutputStreamDefinition().getAttributeList());
            return updateOnDemandQueryRuntime;
        case UPDATE_OR_INSERT:
            inputDefinition = getInputDefinition(onDemandQuery, table);
            initMetaStreamEvent(metaStreamEvent, inputDefinition);
            matchingMetaInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, inputDefinition,
                    table.getTableDefinition());
            querySelector = getQuerySelector(matchingMetaInfoHolder, variableExpressionExecutors,
                    tableMap, windowMap, metaPosition, onDemandQuery, lockWrapper, siddhiQueryContext);

            UpdateOrInsertOnDemandQueryRuntime updateOrInsertIntoOnDemandQueryRuntime =
                    new UpdateOrInsertOnDemandQueryRuntime(siddhiQueryContext.getName(), metaStreamEvent);
            updateOrInsertIntoOnDemandQueryRuntime.setStateEventFactory(
                    new StateEventFactory(matchingMetaInfoHolder.getMetaStateEvent()));
            updateOrInsertIntoOnDemandQueryRuntime.setSelector(querySelector);
            updateOrInsertIntoOnDemandQueryRuntime.setOutputAttributes(matchingMetaInfoHolder.getMetaStateEvent()
                    .getOutputStreamDefinition().getAttributeList());
            return updateOrInsertIntoOnDemandQueryRuntime;
        default:
            return null;
    }
}