dilip sundar
dilip sundar

Reputation: 91

The tutorials given in the wso2 stream processor do not work as expected, particularly Making Real Time Predictions

I'm trying to replicate the "Making Real Time Predictions" tutorial given in the wso2 stream processor documentation, which predicts whether the shipment will meet the requirement given the temperature and density

I'm using the pre-trained PMML file (Sweet.pmml) given in the documentation.

@App:name('SugerSyrupPredictionApp')

@source(type='http', receiver.url='http://0.0.0.0:5006/SugarSyrupEP', @map(type = 'json'))
define stream SugarSyrupDataStream (temperature double, density double);

@sink(type='log', prefix='Predicted next sugar syrup shipment:')
define stream PredictedSugarSyrupDataStream (nextTemperature double, nextDensity double, decision bool);

from SugarSyrupDataStream#pmml:predict("/home/user/Sweet.pmml", temperature, density)
select *
insert into PredictedSugarSyrupDataStream;

This is the error Siddhi shows even though the code is as per the documentation.

Different definition same as output 'define stream PredictedSugarSyrupDataStream' (temperature double, density double, ...) already exist as '@sink(type="log", prefix="Predicted next sugar syrup shipment:") define stream PredictedSugarSyrupStream (nextTemperature double, ..., decision bool)'

Incidentally there is a sample example on the welcome-page tab (PmmlModelProcessor) which runs fine using the same syntax.

Upvotes: 1

Views: 202

Answers (1)

ikken
ikken

Reputation: 563

It appears Siddhi is confused when 2 streams have same signature; number and type of parameters.

I got around this issue by adding "as" keyword to explicitly map the selected columns to the target stream. In your case, it should be something like the following:

select attr1 as nextTemperature, attr2 as nextDensity double, attr3 as decision bool
insert into PredictedSugarSyrupDataStream;

Upvotes: 0

Related Questions