Search in sources :

Example 1 with SelectOnDemandQueryRuntime

use of io.siddhi.core.query.SelectOnDemandQueryRuntime in project siddhi by wso2.

the class OnDemandQueryParser method constructOptimizedOnDemandQueryRuntime.

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;
}
Also used : Attribute(io.siddhi.query.api.definition.Attribute) SelectOnDemandQueryRuntime(io.siddhi.core.query.SelectOnDemandQueryRuntime) AbstractQueryableRecordTable(io.siddhi.core.table.record.AbstractQueryableRecordTable) CompiledCondition(io.siddhi.core.util.collection.operator.CompiledCondition) MatchingMetaInfoHolder(io.siddhi.core.util.collection.operator.MatchingMetaInfoHolder) CompiledSelection(io.siddhi.core.util.collection.operator.CompiledSelection) FindOnDemandQueryRuntime(io.siddhi.core.query.FindOnDemandQueryRuntime) OnDemandQueryRuntime(io.siddhi.core.query.OnDemandQueryRuntime) UpdateOnDemandQueryRuntime(io.siddhi.core.query.UpdateOnDemandQueryRuntime) UpdateOrInsertOnDemandQueryRuntime(io.siddhi.core.query.UpdateOrInsertOnDemandQueryRuntime) InsertOnDemandQueryRuntime(io.siddhi.core.query.InsertOnDemandQueryRuntime) DeleteOnDemandQueryRuntime(io.siddhi.core.query.DeleteOnDemandQueryRuntime) SelectOnDemandQueryRuntime(io.siddhi.core.query.SelectOnDemandQueryRuntime) StateEventFactory(io.siddhi.core.event.state.StateEventFactory) QueryableProcessor(io.siddhi.core.query.processor.stream.window.QueryableProcessor)

Aggregations

StateEventFactory (io.siddhi.core.event.state.StateEventFactory)1 DeleteOnDemandQueryRuntime (io.siddhi.core.query.DeleteOnDemandQueryRuntime)1 FindOnDemandQueryRuntime (io.siddhi.core.query.FindOnDemandQueryRuntime)1 InsertOnDemandQueryRuntime (io.siddhi.core.query.InsertOnDemandQueryRuntime)1 OnDemandQueryRuntime (io.siddhi.core.query.OnDemandQueryRuntime)1 SelectOnDemandQueryRuntime (io.siddhi.core.query.SelectOnDemandQueryRuntime)1 UpdateOnDemandQueryRuntime (io.siddhi.core.query.UpdateOnDemandQueryRuntime)1 UpdateOrInsertOnDemandQueryRuntime (io.siddhi.core.query.UpdateOrInsertOnDemandQueryRuntime)1 QueryableProcessor (io.siddhi.core.query.processor.stream.window.QueryableProcessor)1 AbstractQueryableRecordTable (io.siddhi.core.table.record.AbstractQueryableRecordTable)1 CompiledCondition (io.siddhi.core.util.collection.operator.CompiledCondition)1 CompiledSelection (io.siddhi.core.util.collection.operator.CompiledSelection)1 MatchingMetaInfoHolder (io.siddhi.core.util.collection.operator.MatchingMetaInfoHolder)1 Attribute (io.siddhi.query.api.definition.Attribute)1