Red Hat Bugzilla – Bug 1032059
RETE-OO: Reversed live query results order compared to PHREAK
Last modified: 2013-11-19 09:53:39 EST
Created attachment 826055 [details]
Maven project with reproducer
Description of problem:
Live queries return results in different order with PHREAK and with RETE.
For instance, imagine you define a live query (KieSession.openLiveQuery()) which returns two rows, A and B. If you attach a ViewChangedEventListener to the query, the ViewChangedEventListener.rowInserted(Row) method gets called as follows:
I am not sure if this is by design or a bug, or just the order of query results is not guaranteed in general.
Could someone from engineering comment this?
Version-Release number of selected component (if applicable):
BRMS 6.0.0 ER4
Run LiveQueriesTest from the attached Maven project with setting drools engine to RETE:
mvn clean test -Dtest=LiveQueriesTest -Ddrools.ruleEngine=reteoo
The query results order is reversed when executed with PHREAK:
mvn clean test -Dtest=LiveQueriesTest -Ddrools.ruleEngine=phreak
There is no guarantee on the order the rows will be produced for a single rule. This is something that has and will change over time, as we optimise internal data structures. It's even changed between ReteOO versions.