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

OlliSee o.roess at seeburger.de
Sat Feb 5 20:18:15 EST 2011


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.



More information about the rules-users mailing list