Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3521

accumulation function ignores conditions in 5.4.0.Final

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Hide

      1. download attached zip
      2. unzip to a target directory
      3. run mvn clean install in above target directory

      Show
      1. download attached zip 2. unzip to a target directory 3. run mvn clean install in above target directory

    Description

      given this drl:

      average.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

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            hatchetman82 Radai Rosenblatt (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty