Search in sources :

Example 1 with SelectStoreQueryRuntime

use of org.ballerinalang.siddhi.core.query.SelectStoreQueryRuntime in project ballerina by ballerina-lang.

the class StoreQueryParser method constructStoreQueryRuntime.

private static StoreQueryRuntime constructStoreQueryRuntime(Table table, StoreQuery storeQuery, SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap, String queryName, int metaPosition, Expression onCondition, MetaStreamEvent metaStreamEvent, List<VariableExpressionExecutor> variableExpressionExecutors) {
    metaStreamEvent.setEventType(EventType.TABLE);
    initMetaStreamEvent(metaStreamEvent, table.getTableDefinition());
    MatchingMetaInfoHolder metaStreamInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, table.getTableDefinition());
    CompiledCondition compiledCondition = table.compileCondition(onCondition, metaStreamInfoHolder, siddhiAppContext, variableExpressionExecutors, tableMap, queryName);
    if (table instanceof QueryableProcessor) {
        List<Attribute> expectedOutputAttributes = buildExpectedOutputAttributes(storeQuery, siddhiAppContext, tableMap, queryName, metaPosition, metaStreamInfoHolder);
        CompiledSelection compiledSelection = ((QueryableProcessor) table).compileSelection(storeQuery.getSelector(), expectedOutputAttributes, metaStreamInfoHolder, siddhiAppContext, variableExpressionExecutors, tableMap, queryName);
        SelectStoreQueryRuntime storeQueryRuntime = new SelectStoreQueryRuntime((QueryableProcessor) table, compiledCondition, compiledSelection, expectedOutputAttributes, queryName);
        QueryParserHelper.reduceMetaComplexEvent(metaStreamInfoHolder.getMetaStateEvent());
        QueryParserHelper.updateVariablePosition(metaStreamInfoHolder.getMetaStateEvent(), variableExpressionExecutors);
        return storeQueryRuntime;
    } else {
        FindStoreQueryRuntime storeQueryRuntime = new FindStoreQueryRuntime(table, compiledCondition, queryName, metaStreamEvent);
        populateFindStoreQueryRuntime(storeQueryRuntime, metaStreamInfoHolder, storeQuery.getSelector(), variableExpressionExecutors, siddhiAppContext, tableMap, queryName, metaPosition);
        return storeQueryRuntime;
    }
}
Also used : CompiledCondition(org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition) SelectStoreQueryRuntime(org.ballerinalang.siddhi.core.query.SelectStoreQueryRuntime) Attribute(org.ballerinalang.siddhi.query.api.definition.Attribute) MatchingMetaInfoHolder(org.ballerinalang.siddhi.core.util.collection.operator.MatchingMetaInfoHolder) CompiledSelection(org.ballerinalang.siddhi.core.util.collection.operator.CompiledSelection) FindStoreQueryRuntime(org.ballerinalang.siddhi.core.query.FindStoreQueryRuntime) QueryableProcessor(org.ballerinalang.siddhi.core.query.processor.stream.window.QueryableProcessor)

Aggregations

FindStoreQueryRuntime (org.ballerinalang.siddhi.core.query.FindStoreQueryRuntime)1 SelectStoreQueryRuntime (org.ballerinalang.siddhi.core.query.SelectStoreQueryRuntime)1 QueryableProcessor (org.ballerinalang.siddhi.core.query.processor.stream.window.QueryableProcessor)1 CompiledCondition (org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition)1 CompiledSelection (org.ballerinalang.siddhi.core.util.collection.operator.CompiledSelection)1 MatchingMetaInfoHolder (org.ballerinalang.siddhi.core.util.collection.operator.MatchingMetaInfoHolder)1 Attribute (org.ballerinalang.siddhi.query.api.definition.Attribute)1