Search in sources :

Example 6 with CompiledCondition

use of org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition in project ballerina by ballerina-lang.

the class StoreQueryParser method constructStoreQueryRuntime.

private static StoreQueryRuntime constructStoreQueryRuntime(Window window, StoreQuery storeQuery, SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap, String queryName, int metaPosition, Expression onCondition, MetaStreamEvent metaStreamEvent, List<VariableExpressionExecutor> variableExpressionExecutors) {
    metaStreamEvent.setEventType(EventType.WINDOW);
    initMetaStreamEvent(metaStreamEvent, window.getWindowDefinition());
    MatchingMetaInfoHolder metaStreamInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, window.getWindowDefinition());
    CompiledCondition compiledCondition = window.compileCondition(onCondition, generateMatchingMetaInfoHolder(metaStreamEvent, window.getWindowDefinition()), siddhiAppContext, variableExpressionExecutors, tableMap, queryName);
    FindStoreQueryRuntime findStoreQueryRuntime = new FindStoreQueryRuntime(window, compiledCondition, queryName, metaStreamEvent);
    populateFindStoreQueryRuntime(findStoreQueryRuntime, metaStreamInfoHolder, storeQuery.getSelector(), variableExpressionExecutors, siddhiAppContext, tableMap, queryName, metaPosition);
    return findStoreQueryRuntime;
}
Also used : CompiledCondition(org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition) MatchingMetaInfoHolder(org.ballerinalang.siddhi.core.util.collection.operator.MatchingMetaInfoHolder) FindStoreQueryRuntime(org.ballerinalang.siddhi.core.query.FindStoreQueryRuntime)

Example 7 with CompiledCondition

use of org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition in project ballerina by ballerina-lang.

the class StoreQueryParser method constructStoreQueryRuntime.

private static StoreQueryRuntime constructStoreQueryRuntime(AggregationRuntime aggregation, StoreQuery storeQuery, SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap, String queryName, Within within, Expression per, Expression onCondition, MetaStreamEvent metaStreamEvent, List<VariableExpressionExecutor> variableExpressionExecutors) {
    int metaPosition;
    metaStreamEvent.setEventType(EventType.AGGREGATE);
    initMetaStreamEvent(metaStreamEvent, aggregation.getAggregationDefinition());
    MatchingMetaInfoHolder metaStreamInfoHolder = generateMatchingMetaInfoHolder(metaStreamEvent, aggregation.getAggregationDefinition());
    CompiledCondition compiledCondition = aggregation.compileExpression(onCondition, within, per, metaStreamInfoHolder, variableExpressionExecutors, tableMap, queryName, siddhiAppContext);
    metaStreamInfoHolder = ((IncrementalAggregateCompileCondition) compiledCondition).getAlteredMatchingMetaInfoHolder();
    FindStoreQueryRuntime findStoreQueryRuntime = new FindStoreQueryRuntime(aggregation, compiledCondition, queryName, metaStreamEvent);
    metaPosition = 1;
    populateFindStoreQueryRuntime(findStoreQueryRuntime, metaStreamInfoHolder, storeQuery.getSelector(), variableExpressionExecutors, siddhiAppContext, tableMap, queryName, metaPosition);
    ComplexEventPopulater complexEventPopulater = StreamEventPopulaterFactory.constructEventPopulator(metaStreamInfoHolder.getMetaStateEvent().getMetaStreamEvent(0), 0, ((IncrementalAggregateCompileCondition) compiledCondition).getAdditionalAttributes());
    ((IncrementalAggregateCompileCondition) compiledCondition).setComplexEventPopulater(complexEventPopulater);
    return findStoreQueryRuntime;
}
Also used : CompiledCondition(org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition) MatchingMetaInfoHolder(org.ballerinalang.siddhi.core.util.collection.operator.MatchingMetaInfoHolder) IncrementalAggregateCompileCondition(org.ballerinalang.siddhi.core.util.collection.operator.IncrementalAggregateCompileCondition) FindStoreQueryRuntime(org.ballerinalang.siddhi.core.query.FindStoreQueryRuntime) ComplexEventPopulater(org.ballerinalang.siddhi.core.event.stream.populater.ComplexEventPopulater)

Example 8 with CompiledCondition

use of org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition in project ballerina by ballerina-lang.

the class AbstractRecordTable method compileCondition.

@Override
public CompiledCondition compileCondition(Expression condition, MatchingMetaInfoHolder matchingMetaInfoHolder, SiddhiAppContext siddhiAppContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, Table> tableMap, String queryName) {
    ExpressionBuilder expressionBuilder = new ExpressionBuilder(condition, matchingMetaInfoHolder, siddhiAppContext, variableExpressionExecutors, tableMap, queryName);
    CompiledCondition compileCondition = compileCondition(expressionBuilder);
    Map<String, ExpressionExecutor> expressionExecutorMap = expressionBuilder.getVariableExpressionExecutorMap();
    return new RecordStoreCompiledCondition(expressionExecutorMap, compileCondition);
}
Also used : CompiledCondition(org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition) ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor) VariableExpressionExecutor(org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor)

Aggregations

CompiledCondition (org.ballerinalang.siddhi.core.util.collection.operator.CompiledCondition)8 MatchingMetaInfoHolder (org.ballerinalang.siddhi.core.util.collection.operator.MatchingMetaInfoHolder)7 MetaStreamEvent (org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent)4 SiddhiAppCreationException (org.ballerinalang.siddhi.core.exception.SiddhiAppCreationException)4 VariableExpressionExecutor (org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor)4 Attribute (org.ballerinalang.siddhi.query.api.definition.Attribute)4 ExpressionExecutor (org.ballerinalang.siddhi.core.executor.ExpressionExecutor)3 FindStoreQueryRuntime (org.ballerinalang.siddhi.core.query.FindStoreQueryRuntime)3 Table (org.ballerinalang.siddhi.core.table.Table)3 MetaStateEvent (org.ballerinalang.siddhi.core.event.state.MetaStateEvent)2 AbstractDefinition (org.ballerinalang.siddhi.query.api.definition.AbstractDefinition)2 AttributeFunction (org.ballerinalang.siddhi.query.api.expression.AttributeFunction)2 Expression (org.ballerinalang.siddhi.query.api.expression.Expression)2 Variable (org.ballerinalang.siddhi.query.api.expression.Variable)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ComplexEventChunk (org.ballerinalang.siddhi.core.event.ComplexEventChunk)1 StateEvent (org.ballerinalang.siddhi.core.event.state.StateEvent)1 StateEventPool (org.ballerinalang.siddhi.core.event.state.StateEventPool)1