Search code examples
wso2complex-event-processingsiddhiwso2-cep

WSO2 CEP - SIDDHI max function in time window returns null


I have a query that captures the max value of a field in a stream:

from stream1#window.time(1 min)
select max(value1) as max_value1 
insert all events into newstream;

Although, after this window I start to get null values in the max_value1.

I do the same for the avg but I always get 0 once all the events expire from the 1 minute time window.


Solution

  • Thanks for letting us know the inconsistent behavior, based on SQL it should return null. We have made fixes such that avg(), min(), max(), and sum() to return null when no events in the table[1].

    Do use default() or ifThenElse() with "is null" to convert null to extected default value if needed.

    [1]https://github.com/wso2/siddhi/pull/344