I want to write an esper epl expression which filter the events based on the return value returned by my user-defined function, my user defined must take two event objects at a time. so I wrote a query like this.
select window(*), 'CANDLE NAME' as candleType
from CandleStickEvent(myFunction(*) = 'true').win:length(2)
Though this worked it passes only one CandleStickEvent object at a time, but I want to pass the both the objects in the window.
To achieve this I tried following queries as well. But nothing did work.
"select window(*), 'CANDLE NAME' as candleType "
"from CandleStickEvent(myFunction(window(*)) = 'true').win:length(2) "
This gives this error message,
The 'window' aggregation function requires that the aggregated events provide a remove stream; Please define a data window onto the stream or use 'firstever', 'lastever' or 'nth' instead
I tries following query also,
"select window(*), 'CANDLE NAME' as candleType "
"from CandleStickEvent.win:length(2) "
"output when myFunction(*) = 'true'"
It doesn't give any error but my function is never triggered.
Can anybody help me to find a way to fulfill this requirement.
Thank you.
In SQL the having-clause is used for filtering against aggregations and EPL is sql-standard conforming. Try "... having somefunc(window(*))"