[rules-users] Accumulating over a list of collected events (bug?)

Wolfgang Laun wolfgang.laun at gmail.com
Sun Feb 6 04:58:59 EST 2011


Entered JBRULES-2887.

But I find that there must be another pattern

   when
              SomePatternHereREquiredToCausetheNPE(...)
               $list : List() from collect ( A() over window:time(5s) )
               Number($avg : doubleValue) from accumulate( A($num : num)
from $list, average($num))
       then

-W

On 6 February 2011 09:34, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

> I cannot confirm/reproduce this with 5.1.1.
>
> Please provide version info and a complete example causing this error?
>
> -W
>
>
>
> On 6 February 2011 02:18, OlliSee <o.roess at seeburger.de> wrote:
>
>>
>> Hi folks, another bug discovered here?
>>
>> This rule yields a really nice exception
>>
>> rule "Test"
>>        when
>>                $list : List() from collect ( A() over window:time(5s) )
>>                Number($avg : doubleValue) from accumulate( A($num : num)
>> from $list, average($num))
>>        then
>>                ...
>> end
>>
>> whereas
>>             Number($avg : doubleValue) from accumulate( A($num : num) over
>> window:time(5s), average($num))
>> works fine.
>>
>> So it seems I can't accumulate over the list. But would be quite handy if
>> I
>> had more than one accumulation to do and didn't want to rewrite all the
>> constraints in each accumulation statement. I could just use the list, but
>> that results in the exception below.
>>
>>
>> Exception in thread "Thread-5" org.drools.RuntimeDroolsException:
>> Unexpected
>> exception executing action
>> org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction at 46fef3
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1473)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1159)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
>>        at
>>
>> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
>>        at
>> trafficsys.SessionInterface.insertAndFire(SessionInterface.java:144)
>>        at
>>
>> trafficsys.cep.SensorEventGenerator.generateEvents(SensorEventGenerator.java:80)
>>        at de.trafficsimulation.MicroStreet.update(MicroStreet.java:393)
>>        at de.trafficsimulation.SimCanvas.run(SimCanvas.java:401)
>>        at java.lang.Thread.run(Unknown Source)
>> Caused by: java.lang.NullPointerException
>>        at
>> org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
>>        at
>> org.drools.reteoo.AccumulateNode.splitList(AccumulateNode.java:920)
>>        at
>>
>> org.drools.reteoo.AccumulateNode.removePreviousMatchesForLeftTuple(AccumulateNode.java:874)
>>        at
>> org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:205)
>>        at
>>
>> org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:238)
>>        at
>>
>> org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTupleDestroyRightTuple(CompositeLeftTupleSinkAdapter.java:138)
>>        at
>> org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:212)
>>        at
>>
>> org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217)
>>        at
>>
>> org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:91)
>>        at
>>
>> org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:648)
>>        at
>>
>> org.drools.reteoo.AccumulateNode.removePreviousMatchesForRightTuple(AccumulateNode.java:903)
>>        at
>>
>> org.drools.reteoo.AccumulateNode.retractRightTuple(AccumulateNode.java:303)
>>        at
>> org.drools.rule.SlidingTimeWindow.expireTuples(SlidingTimeWindow.java:167)
>>        at
>>
>> org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction.execute(SlidingTimeWindow.java:329)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1471)
>>        ... 9 more
>>
>>
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Accumulating-over-a-list-of-collected-events-bug-tp2434809p2434809.html
>> Sent from the Drools - User mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110206/09bbb11a/attachment.html 


More information about the rules-users mailing list