use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class TestStoreContainingInMemoryTable method objectListToComplexEventChunk.
private ComplexEventChunk<StreamEvent> objectListToComplexEventChunk(List<Object[]> records) {
ComplexEventChunk<StreamEvent> complexEventChunk = new ComplexEventChunk<>();
for (Object[] record : records) {
StreamEvent event = storeEventPool.newInstance();
event.setOutputData(record);
complexEventChunk.add(event);
}
return complexEventChunk;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class TestStoreForCacheMiss method objectListToComplexEventChunk.
private ComplexEventChunk<StreamEvent> objectListToComplexEventChunk(List<Object[]> records) {
ComplexEventChunk<StreamEvent> complexEventChunk = new ComplexEventChunk<>();
for (Object[] record : records) {
StreamEvent event = storeEventPool.newInstance();
event.setOutputData(record);
complexEventChunk.add(event);
}
return complexEventChunk;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class TestStoreForCacheMiss method convForDelete.
private ComplexEventChunk<StreamEvent> convForDelete(List<Map<String, Object>> deleteConditionParameterMaps) {
List<Object[]> objectList = new LinkedList<>();
for (Map<String, Object> parameterMap : deleteConditionParameterMaps) {
List<Object> outputData = new ArrayList<>();
List<Attribute> attributeList = inMemoryTable.getTableDefinition().getAttributeList();
for (int i = 0; i < attributeList.size(); i++) {
if (parameterMap.get(attributeList.get(i).getName()) != null) {
outputData.add(parameterMap.get(attributeList.get(i).getName()));
} else {
outputData.add(null);
}
}
objectList.add(outputData.toArray());
}
ComplexEventChunk<StreamEvent> complexEventChunk = new ComplexEventChunk<>();
for (Object[] record : objectList) {
StreamEvent event = new StreamEvent(0, 0, record.length);
// StateEvent stateEvent = new StateEvent(2, record.length);
event.setOutputData(record);
// stateEvent.addEvent(0, event);
complexEventChunk.add(event);
}
return complexEventChunk;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class TestStoreForCacheMiss method query.
@Override
protected RecordIterator<Object[]> query(Map<String, Object> parameterMap, CompiledCondition compiledCondition, CompiledSelection compiledSelection, Attribute[] outputAttributes) {
StreamEvent outEvent = inMemoryTable.find(compiledCondition, findMatchingEvent);
List<Object[]> objects = new LinkedList<>();
CompiledSelectionWithCache compiledSelectionWithCache = null;
if (outEvent != null) {
compiledSelectionWithCache = (CompiledSelectionWithCache) compiledSelection;
StateEventFactory stateEventFactory = new StateEventFactory(compiledSelectionWithCache.getMetaStateEvent());
Event[] cacheResultsAfterSelection = executeSelector(stateEventFactory, null, outEvent, compiledSelectionWithCache.getStoreEventIndex(), compiledSelectionWithCache.getQuerySelector());
if (compiledSelectionWithCache.getQuerySelector() != null & compiledSelectionWithCache.getQuerySelector().getAttributeProcessorList().size() != 0) {
compiledSelectionWithCache.getQuerySelector().process(generateResetComplexEventChunk(outEvent.getOutputData().length, stateEventFactory));
}
if (cacheResultsAfterSelection != null) {
for (Event event : cacheResultsAfterSelection) {
objects.add(event.getData());
}
}
}
return new TestStoreWithCacheIterator(objects.iterator());
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class TestStoreForCacheMiss method generateResetComplexEventChunk.
private ComplexEventChunk<ComplexEvent> generateResetComplexEventChunk(int outputDataSize, StateEventFactory stateEventFactory) {
StreamEvent streamEvent = new StreamEvent(outputDataSize, 0, outputDataSize);
streamEvent.setType(ComplexEvent.Type.RESET);
StateEvent stateEvent = stateEventFactory.newInstance();
stateEvent.addEvent(0, streamEvent);
stateEvent.setType(ComplexEvent.Type.RESET);
ComplexEventChunk<ComplexEvent> complexEventChunk = new ComplexEventChunk<>();
complexEventChunk.add(stateEvent);
return complexEventChunk;
}
Aggregations