use of org.ballerinalang.siddhi.core.exception.StoreQueryRuntimeException in project ballerina by ballerina-lang.
the class FindStoreQueryRuntime method execute.
@Override
public Event[] execute() {
try {
StateEvent stateEvent = new StateEvent(1, 0);
StreamEvent streamEvents = null;
switch(eventType) {
case TABLE:
streamEvents = table.find(stateEvent, compiledCondition);
break;
case WINDOW:
streamEvents = window.find(stateEvent, compiledCondition);
break;
case AGGREGATE:
stateEvent = new StateEvent(2, 0);
StreamEvent streamEvent = new StreamEvent(0, 2, 0);
stateEvent.addEvent(0, streamEvent);
streamEvents = aggregation.find(stateEvent, compiledCondition);
break;
case DEFAULT:
break;
}
if (streamEvents == null) {
return null;
} else {
if (selector != null) {
return executeSelector(streamEvents, eventType);
} else {
List<Event> events = new ArrayList<Event>();
while (streamEvents != null) {
events.add(new Event(streamEvents.getTimestamp(), streamEvents.getOutputData()));
streamEvents = streamEvents.getNext();
}
return events.toArray(new Event[0]);
}
}
} catch (Throwable t) {
throw new StoreQueryRuntimeException("Error executing '" + queryName + "', " + t.getMessage(), t);
}
}
use of org.ballerinalang.siddhi.core.exception.StoreQueryRuntimeException in project ballerina by ballerina-lang.
the class SelectStoreQueryRuntime method execute.
public Event[] execute() {
try {
StateEvent stateEvent = new StateEvent(1, 0);
StreamEvent streamEvents = queryableProcessor.query(stateEvent, compiledCondition, compiledSelection);
if (streamEvents == null) {
return null;
} else {
List<Event> events = new ArrayList<Event>();
while (streamEvents != null) {
events.add(new Event(streamEvents.getTimestamp(), streamEvents.getOutputData()));
streamEvents = streamEvents.getNext();
}
return events.toArray(new Event[0]);
}
} catch (Throwable t) {
throw new StoreQueryRuntimeException("Error executing '" + queryName + "', " + t.getMessage(), t);
}
}
Aggregations