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;
}
Aggregations