Search in sources :

Example 1 with AggregateWindowProcessor

use of org.wso2.siddhi.core.query.processor.stream.window.AggregateWindowProcessor in project siddhi by wso2.

the class AggregateWindowProcessor method cloneProcessor.

@Override
public Processor cloneProcessor(String key) {
    try {
        AggregateWindowProcessor streamProcessor = new AggregateWindowProcessor(aggregationRuntime, within, per);
        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 : VariableExpressionExecutor(org.wso2.siddhi.core.executor.VariableExpressionExecutor) ExpressionExecutor(org.wso2.siddhi.core.executor.ExpressionExecutor) SiddhiAppRuntimeException(org.wso2.siddhi.core.exception.SiddhiAppRuntimeException) SiddhiAppRuntimeException(org.wso2.siddhi.core.exception.SiddhiAppRuntimeException)

Example 2 with AggregateWindowProcessor

use of org.wso2.siddhi.core.query.processor.stream.window.AggregateWindowProcessor in project siddhi by wso2.

the class JoinInputStreamParser method setStreamRuntimeProcessorChain.

private static void setStreamRuntimeProcessorChain(MetaStreamEvent metaStreamEvent, SingleStreamRuntime streamRuntime, String inputStreamId, Map<String, Table> tableMap, Map<String, Window> windowMap, Map<String, AggregationRuntime> aggregationMap, List<VariableExpressionExecutor> variableExpressionExecutors, boolean outputExpectsExpiredEvents, String queryName, Within within, Expression per, SiddhiAppContext siddhiAppContext, InputStream inputStream) {
    switch(metaStreamEvent.getEventType()) {
        case TABLE:
            TableWindowProcessor tableWindowProcessor = new TableWindowProcessor(tableMap.get(inputStreamId));
            tableWindowProcessor.initProcessor(metaStreamEvent.getLastInputDefinition(), new ExpressionExecutor[0], null, siddhiAppContext, outputExpectsExpiredEvents, queryName, inputStream);
            streamRuntime.setProcessorChain(tableWindowProcessor);
            break;
        case WINDOW:
            WindowWindowProcessor windowWindowProcessor = new WindowWindowProcessor(windowMap.get(inputStreamId));
            windowWindowProcessor.initProcessor(metaStreamEvent.getLastInputDefinition(), variableExpressionExecutors.toArray(new ExpressionExecutor[0]), null, siddhiAppContext, outputExpectsExpiredEvents, queryName, inputStream);
            streamRuntime.setProcessorChain(windowWindowProcessor);
            break;
        case AGGREGATE:
            AggregationRuntime aggregationRuntime = aggregationMap.get(inputStreamId);
            AggregateWindowProcessor aggregateWindowProcessor = new AggregateWindowProcessor(aggregationRuntime, within, per);
            aggregateWindowProcessor.initProcessor(metaStreamEvent.getLastInputDefinition(), variableExpressionExecutors.toArray(new ExpressionExecutor[0]), null, siddhiAppContext, outputExpectsExpiredEvents, queryName, inputStream);
            streamRuntime.setProcessorChain(aggregateWindowProcessor);
            break;
        case DEFAULT:
            break;
    }
}
Also used : AggregateWindowProcessor(org.wso2.siddhi.core.query.processor.stream.window.AggregateWindowProcessor) TableWindowProcessor(org.wso2.siddhi.core.query.processor.stream.window.TableWindowProcessor) VariableExpressionExecutor(org.wso2.siddhi.core.executor.VariableExpressionExecutor) ExpressionExecutor(org.wso2.siddhi.core.executor.ExpressionExecutor) ConstantExpressionExecutor(org.wso2.siddhi.core.executor.ConstantExpressionExecutor) WindowWindowProcessor(org.wso2.siddhi.core.query.processor.stream.window.WindowWindowProcessor) AggregationRuntime(org.wso2.siddhi.core.aggregation.AggregationRuntime)

Aggregations

ExpressionExecutor (org.wso2.siddhi.core.executor.ExpressionExecutor)2 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)2 AggregationRuntime (org.wso2.siddhi.core.aggregation.AggregationRuntime)1 SiddhiAppRuntimeException (org.wso2.siddhi.core.exception.SiddhiAppRuntimeException)1 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)1 AggregateWindowProcessor (org.wso2.siddhi.core.query.processor.stream.window.AggregateWindowProcessor)1 TableWindowProcessor (org.wso2.siddhi.core.query.processor.stream.window.TableWindowProcessor)1 WindowWindowProcessor (org.wso2.siddhi.core.query.processor.stream.window.WindowWindowProcessor)1