Search in sources :

Example 26 with ExpressionExecutor

use of org.ballerinalang.siddhi.core.executor.ExpressionExecutor in project ballerina by ballerina-lang.

the class IncrementalDataAggregator method process.

private void process(StreamEvent streamEvent, BaseIncrementalValueStore baseIncrementalValueStore) {
    List<ExpressionExecutor> expressionExecutors = baseIncrementalValueStore.getExpressionExecutors();
    for (int i = 0; i < expressionExecutors.size(); i++) {
        // keeping timestamp value location as null
        ExpressionExecutor expressionExecutor = expressionExecutors.get(i);
        baseIncrementalValueStore.setValue(expressionExecutor.execute(streamEvent), i + 1);
    }
    baseIncrementalValueStore.setProcessed(true);
}
Also used : ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor)

Example 27 with ExpressionExecutor

use of org.ballerinalang.siddhi.core.executor.ExpressionExecutor in project ballerina by ballerina-lang.

the class IncrementalExecutor method process.

private void process(StreamEvent streamEvent, BaseIncrementalValueStore baseIncrementalValueStore) {
    List<ExpressionExecutor> expressionExecutors = baseIncrementalValueStore.getExpressionExecutors();
    for (int i = 0; i < expressionExecutors.size(); i++) {
        // keeping timestamp value location as null
        ExpressionExecutor expressionExecutor = expressionExecutors.get(i);
        baseIncrementalValueStore.setValue(expressionExecutor.execute(streamEvent), i + 1);
    }
    baseIncrementalValueStore.setProcessed(true);
}
Also used : ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor)

Example 28 with ExpressionExecutor

use of org.ballerinalang.siddhi.core.executor.ExpressionExecutor in project ballerina by ballerina-lang.

the class WindowWindowProcessor method cloneProcessor.

@Override
public Processor cloneProcessor(String key) {
    try {
        WindowWindowProcessor streamProcessor = new WindowWindowProcessor(window);
        streamProcessor.inputDefinition = inputDefinition;
        ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeExpressionLength];
        ExpressionExecutor[] attributeExpressionExecutors1 = this.attributeExpressionExecutors;
        for (int i = 0; i < attributeExpressionLength; i++) {
            innerExpressionExecutors[i] = attributeExpressionExecutors1[i].cloneExecutor(key);
        }
        streamProcessor.attributeExpressionExecutors = innerExpressionExecutors;
        streamProcessor.attributeExpressionLength = attributeExpressionLength;
        streamProcessor.additionalAttributes = additionalAttributes;
        streamProcessor.complexEventPopulater = complexEventPopulater;
        streamProcessor.init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext, outputExpectsExpiredEvents);
        streamProcessor.start();
        return streamProcessor;
    } catch (Exception e) {
        throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
    }
}
Also used : ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor) VariableExpressionExecutor(org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException)

Example 29 with ExpressionExecutor

use of org.ballerinalang.siddhi.core.executor.ExpressionExecutor in project ballerina by ballerina-lang.

the class AttributeAggregator method cloneAggregator.

public AttributeAggregator cloneAggregator(String key) {
    try {
        AttributeAggregator attributeAggregator = this.getClass().newInstance();
        ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeSize];
        for (int i = 0; i < attributeSize; i++) {
            innerExpressionExecutors[i] = attributeExpressionExecutors[i].cloneExecutor(key);
        }
        attributeAggregator.elementId = elementId + "-" + key;
        attributeAggregator.initAggregator(innerExpressionExecutors, siddhiAppContext, configReader);
        return attributeAggregator;
    } catch (Exception e) {
        throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
    }
}
Also used : ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException) SiddhiAppCreationException(org.ballerinalang.siddhi.core.exception.SiddhiAppCreationException) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException)

Example 30 with ExpressionExecutor

use of org.ballerinalang.siddhi.core.executor.ExpressionExecutor in project ballerina by ballerina-lang.

the class TableWindowProcessor method cloneProcessor.

@Override
public Processor cloneProcessor(String key) {
    try {
        TableWindowProcessor streamProcessor = new TableWindowProcessor(table);
        streamProcessor.inputDefinition = inputDefinition;
        ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeExpressionLength];
        ExpressionExecutor[] attributeExpressionExecutors1 = this.attributeExpressionExecutors;
        for (int i = 0; i < attributeExpressionLength; i++) {
            innerExpressionExecutors[i] = attributeExpressionExecutors1[i].cloneExecutor(key);
        }
        streamProcessor.attributeExpressionExecutors = innerExpressionExecutors;
        streamProcessor.attributeExpressionLength = attributeExpressionLength;
        streamProcessor.additionalAttributes = additionalAttributes;
        streamProcessor.complexEventPopulater = complexEventPopulater;
        streamProcessor.init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext, outputExpectsExpiredEvents);
        streamProcessor.start();
        return streamProcessor;
    } catch (Exception e) {
        throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
    }
}
Also used : ExpressionExecutor(org.ballerinalang.siddhi.core.executor.ExpressionExecutor) VariableExpressionExecutor(org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException) SiddhiAppRuntimeException(org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException)

Aggregations

ExpressionExecutor (org.ballerinalang.siddhi.core.executor.ExpressionExecutor)46 VariableExpressionExecutor (org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor)33 Attribute (org.ballerinalang.siddhi.query.api.definition.Attribute)15 ConstantExpressionExecutor (org.ballerinalang.siddhi.core.executor.ConstantExpressionExecutor)14 Map (java.util.Map)13 MetaStreamEvent (org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent)13 HashMap (java.util.HashMap)11 SiddhiAppCreationException (org.ballerinalang.siddhi.core.exception.SiddhiAppCreationException)11 ArrayList (java.util.ArrayList)10 ComplexEventChunk (org.ballerinalang.siddhi.core.event.ComplexEventChunk)10 StreamEvent (org.ballerinalang.siddhi.core.event.stream.StreamEvent)10 Variable (org.ballerinalang.siddhi.query.api.expression.Variable)8 StateEvent (org.ballerinalang.siddhi.core.event.state.StateEvent)7 SiddhiAppRuntimeException (org.ballerinalang.siddhi.core.exception.SiddhiAppRuntimeException)7 Expression (org.ballerinalang.siddhi.query.api.expression.Expression)7 AndConditionExpressionExecutor (org.ballerinalang.siddhi.core.executor.condition.AndConditionExpressionExecutor)5 AbstractDefinition (org.ballerinalang.siddhi.query.api.definition.AbstractDefinition)5 OutputAttribute (org.ballerinalang.siddhi.query.api.execution.query.selection.OutputAttribute)5 MetaStateEvent (org.ballerinalang.siddhi.core.event.state.MetaStateEvent)4 ConditionExpressionExecutor (org.ballerinalang.siddhi.core.executor.condition.ConditionExpressionExecutor)4