wso2 / product-sp

An open source, cloud-native streaming data integration and analytics product optimized for agile digital businesses
https://wso2.com/analytics-and-stream-processing/
Apache License 2.0
120 stars 132 forks source link

Issue using the R extension in Siddhi WSO2 #1052

Closed rr123rr closed 4 years ago

rr123rr commented 5 years ago

Description: Im trying to make windows with a length batch of 100 rows each and to use some R functions to calculate some statistical data for each batch. In the below code I:

Affected Product Version: WSO2 Stream Processor 4.4.0

Code:


define stream HStream(mID, result String);

@sink(type='log', prefix='LOGGER')
define stream OutputStream(mID int, maxValue double, sdValue double);

@info(name = 'Query')
from HStream
select convert(mID, 'int') as mID, convert(str:replaceAll(result,',','.'), 'double') as result
insert into RStream;

@info(name = 'RStream')
from RStream#window.lengthBatch(100)#r:eval("c <- max(result); m <- sd(result);", "c double, m double ", result, result)
select mID, c as maxValue , m as sdValue
insert into OutputStream;