Search in sources :

Example 11 with ReturnStream

use of io.siddhi.query.api.execution.query.output.stream.ReturnStream in project siddhi by wso2.

the class TestStoreForCachePreLoading method compileSelection.

@Override
protected CompiledSelection compileSelection(List<SelectAttributeBuilder> selectAttributeBuilders, List<ExpressionBuilder> groupByExpressionBuilder, ExpressionBuilder havingExpressionBuilder, List<OrderByAttributeBuilder> orderByAttributeBuilders, Long limit, Long offset) {
    CompiledSelectionWithCache compiledSelectionWithCache;
    MetaStateEvent metaStateEvent = matchingMetaInfoHolderForTestOnDemandQuery.getMetaStateEvent().clone();
    ReturnStream returnStream = new ReturnStream(OutputStream.OutputEventType.CURRENT_EVENTS);
    int metaPosition = SiddhiConstants.UNKNOWN_STATE;
    List<VariableExpressionExecutor> variableExpressionExecutorsForQuerySelector = new ArrayList<>();
    if (metaStateEvent.getOutputDataAttributes().size() == 0) {
        for (Attribute outputAttribute : metaStateEvent.getMetaStreamEvents()[0].getOnAfterWindowData()) {
            metaStateEvent.getMetaStreamEvents()[0].addOutputData(outputAttribute);
        }
    }
    QuerySelector querySelector = SelectorParser.parse(selectorForTestOnDemandQuery, returnStream, metaStateEvent, tableMap, variableExpressionExecutorsForQuerySelector, metaPosition, ProcessingMode.BATCH, false, siddhiQueryContextForTestOnDemandQuery);
    QueryParserHelper.updateVariablePosition(metaStateEvent, variableExpressionExecutorsForQuerySelector);
    querySelector.setEventPopulator(StateEventPopulatorFactory.constructEventPopulator(metaStateEvent));
    compiledSelectionWithCache = new CompiledSelectionWithCache(null, querySelector, metaStateEvent, 0, null);
    return compiledSelectionWithCache;
}
Also used : Attribute(io.siddhi.query.api.definition.Attribute) VariableExpressionExecutor(io.siddhi.core.executor.VariableExpressionExecutor) ArrayList(java.util.ArrayList) QuerySelector(io.siddhi.core.query.selector.QuerySelector) ReturnStream(io.siddhi.query.api.execution.query.output.stream.ReturnStream) MetaStateEvent(io.siddhi.core.event.state.MetaStateEvent)

Aggregations

ReturnStream (io.siddhi.query.api.execution.query.output.stream.ReturnStream)11 MetaStateEvent (io.siddhi.core.event.state.MetaStateEvent)5 QuerySelector (io.siddhi.core.query.selector.QuerySelector)5 Attribute (io.siddhi.query.api.definition.Attribute)5 StateEventFactory (io.siddhi.core.event.state.StateEventFactory)4 MetaStreamEvent (io.siddhi.core.event.stream.MetaStreamEvent)4 SiddhiAppCreationException (io.siddhi.core.exception.SiddhiAppCreationException)4 VariableExpressionExecutor (io.siddhi.core.executor.VariableExpressionExecutor)4 ArrayList (java.util.ArrayList)4 CompiledCondition (io.siddhi.core.util.collection.operator.CompiledCondition)3 CompiledSelection (io.siddhi.core.util.collection.operator.CompiledSelection)3 TableDefinition (io.siddhi.query.api.definition.TableDefinition)3 OutputStream (io.siddhi.query.api.execution.query.output.stream.OutputStream)3 Example (io.siddhi.annotation.Example)2 Extension (io.siddhi.annotation.Extension)2 ComplexEvent (io.siddhi.core.event.ComplexEvent)2 ComplexEventChunk (io.siddhi.core.event.ComplexEventChunk)2 Event (io.siddhi.core.event.Event)2 StateEvent (io.siddhi.core.event.state.StateEvent)2 StateEventPopulatorFactory (io.siddhi.core.event.state.populater.StateEventPopulatorFactory)2