-
Bug
-
Resolution: Duplicate
-
Major
-
5.4.0.Final
-
None
given this drl:
package playground import playground.datamodel.EventObject declare EventObject @role( event ) end rule "new event under average" when $latestEvent : EventObject(level == "Full", status == "success", $size : size ) from entry-point "Event Stream" Number($averageSize : doubleValue, doubleValue > ($size)) from accumulate( EventObject(level=="Full", this before $latestEvent, status == "success", $bSize : size ) over window:time( 5d ) from entry-point "Event Stream" , average($bSize)) then System.err.println("new event under 5d average"); end
and the following sequence of 3 events:
{Full,success,100},
{Whatever,fail,0},
{Full,success,99}the 3rd event should trigger a firing. the complete breakdown of events should be as follows:
1. 1st event is inserted, average is 0 because there are no previous events - no firing.
2. 2nd event is inserted - does not match the conditions and therefore should not be accumulated.
3. 3rd event is inserted - accumulation should only consider the 1st event, hence the avg. is 100. the event value is 99, which is below the avg - rule should fire.
this works with drools 5.1.1 but fails in 5.4.0.Final - in 5.4 the 2nd event is acounted by the average function and so the rule does not fire.
attached is a complete maven project to recreate this bug - simply unzip and run "mvn clean install" to recreate.
also in the mvn project attached, simply change the drools.version property in the pom.xml from 5.4.0.Final to 5.1.1 (already in there, just commented out) to verify this works in 5.1.1