siddhi icon indicating copy to clipboard operation
siddhi copied to clipboard

stdDev() function returns incorrect result in conjunction to #window.length(N)

Open xtrmstep opened this issue 4 years ago • 6 comments

Description: In conjunction with #window.length(N) the function stdDev() returns non 0 value or NaN when should return 0.

Affected Siddhi Version: 5.1.2

OS, DB, other environment details and versions:
Ubuntu, Docker latest version.

Steps to reproduce: Using this code

@App:name("test")
define stream input (
    id string,
    value double
);
partition with (id of input)
begin
    from input#window.length(3)
    select
        id,
        stdDev(value) as std
    insert into tmp;
end;
from tmp#log()
select *
insert into muted;

In editor try to send the following sequence of events a, 1 a, 2 a, 3 a, 3 a, 3 a, 3

stdDev() returns 8.603189426505949E-9 when should 0. It should return 0 because the last three values are 3,3,3 the returning value is not constant, it obviously some accumulated rounding error.

xtrmstep avatar May 13 '20 13:05 xtrmstep

I have tested this on Streaming Integrator which is based on siddhi 5.1.12 and couldn't observe the above behavior.

AnuGayan avatar Jun 02 '20 08:06 AnuGayan

@AnuGayan which docker images would you recommend to check? I'm using siddhiio/siddhi-tooling:5.1.2 and for running of applications siddhiio/siddhi-runner-base-alpine:5.1.2

xtrmstep avatar Jun 02 '20 09:06 xtrmstep

I've got multiple errors in my applications related to this. And this case was reproducing pretty stable on tooling 5.1.2

xtrmstep avatar Jun 02 '20 09:06 xtrmstep

You can try this on Streaming Integrator docker image

AnuGayan avatar Jun 02 '20 09:06 AnuGayan

I'll check, ok. But shouldn't be a docker image for Enterprise Integrator? As far i I know this is the latest and most fresh version.

xtrmstep avatar Jun 02 '20 09:06 xtrmstep

Streaming Integrator 1.x.x is a part of Enterprise Integrator 7.x.x offering and SI is the one which is based on Siddhi.

AnuGayan avatar Jun 08 '20 17:06 AnuGayan