wso2siddhiwso2-cep

wso2cep: ERROR - 'distance' is neither a function extension nor an aggregated attribute extension in execution plan "ExecutionPlan"


I am using WSO2 CEP 4.2.0 version and I am writing an execution plan for checking when coordinates from different sensors do not vary by more than 4 meters, through Siddhi query. But getting an error: 'distance' is neither a function extension nor an aggregated attribute extension in execution plan "ExecutionPlan".

I have installed the GPL - Siddhi Geo Extension, but I do not know why there is that error. Please help me in solving this error.

My execution plan is below:

/* Enter a unique ExecutionPlan */
@Plan:name('ExecutionPlan')

/* Enter a unique description for ExecutionPlan */
-- @Plan:description('ExecutionPlan')

/* define streams/tables and write queries here ... */

@Import('SR_ProcessedStream:1.0.0')
define stream srprocessedstream (meta_resultTime long, meta_procedure string, correlation_latitude double, correlation_longitude double);

@Import('MPD_ProcessedStream:1.0.0')
define stream mpdprocessedstream (meta_resultTime long, meta_procedure string, correlation_latitude double, correlation_longitude double);

@Import('GBSS_ProcessedStream:1.0.0')
define stream gbssprocessedstream (meta_resultTime long, meta_procedure string, correlation_latitude double, correlation_longitude double);

@Export('measuredStream:1.0.0')
define stream measuredStream (meta_procedure1 string, meta_procedure2 string);

define table sensorTable(meta_procedure string, correlation_latitude double, correlation_longitude double);

from gbssprocessedstream
select meta_procedure, correlation_latitude, correlation_longitude
insert into sensorTable;

from mpdprocessedstream
select meta_procedure, correlation_latitude, correlation_longitude
insert into sensorTable;

from srprocessedstream
select meta_procedure, correlation_latitude, correlation_longitude
insert into sensorTable;

from gbssprocessedstream join sensorTable
 on sensorTable.meta_procedure != gbssprocessedstream.meta_procedure and 4 > geo : distance (sensorTable.correlation_latitude, sensorTable.correlation_longitude, meta_procedure1.correlation_latitude, meta_procedure1.correlation_longitude)
 select sensorTable.meta_procedure as meta_procedure1, gbssprocessedstream.meta_procedure as meta_procedure2
 insert into measuredStream;

Thanks in advance!


Solution

  • The problem lies that the already compiled p2-repo that is provided by the official installation instructions are not the most up to date and are missing the distance function below is an image with the related jar file

    geo jar

    In order to use this function you need to build the p2-repo and install it and it should work! Once you compile all three projects you should see the p2-repo within directory wso2-gpl/carbon-event-processing-extensions/repository/target

    Hope it helps!