siddhi-io / siddhi

Stream Processing and Complex Event Processing Engine
http://siddhi.io
Apache License 2.0
1.52k stars 527 forks source link

Pattern stream with logical condition "and" does not work correctly #1793

Open Allan-QLB opened 1 year ago

Allan-QLB commented 1 year ago

Description:

@App:name('axx')
define stream RegulatorStateChangeStream(id string, deviceID long,
roomNo int, tempSet double, action string);
define stream RoomKeyStream(id string, deviceID long, roomNo int,
    action string);

@sink(type='log')
define stream RegulatorActionStream(id1 string, id2 string, roomNo int, action string);

from every (e1=RegulatorStateChangeStream[ action == 'on'] and e2=RoomKeyStream[ action == 'removed' ])
select e1.id as id1, e2.id as id2, e1.roomNo,
    ifThenElse( e2 is null, 'none', 'stop' ) as action
insert into RegulatorActionStream;

if I send data as follow:

regulatorStateChangeStreamHandler.send(new Object[] {"a", 10L, 5, 30, "on"});
roomKeyStreamHandler.send(new Object[]{"b1",  10, 5, "removed"});

I will get one match, but If I reverse the order of sending data, I will not get any match

Affected Siddhi Version: 5.x.x OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues: