-
Bug
-
Resolution: Done
-
Major
-
7.9.1.GA, 7.10.0.GA
-
This issue was reported on RHDM 7.9.1.
It is also reproducible on 7.10.0.
-
2
-
False
-
False
-
-
-
-
-
-
CR1
-
+
-
Undefined
-
-
-
2021 Week 10-12 (from Mar 8), 2021 Week 13-15 (from Mar 29)
When you use accumulate and no fact matches, the behaviors are different depending on accumulate functions:
rule "accumualte_rule_min" when accumulate( target : Target( target.getText() == "XXX" ), $min : min( target.getNumber1() ) ) then System.out.println("***** accumualte_rule_min: $min = " + $min); end
min() : IntegerMinAccumulateFunction -> returns null if no fact matches
max() : IntegerMaxAccumulateFunction -> returns null if no fact matches
ave() : AverageAccumulateFunction -> returns null if no fact matches
-> If the result is null, the rule won't fire.
count() : CountAccumulateFunction -> returns 0 if no fact matches
sum() : IntegerSumAccumulateFunction -> returns 0 if no fact matches
-> result is not null. So the rule is fired.
min(), max() : When you have multiple functions in accumulate, MultiAccumulate is used. This returns Object[] which contains multiple results. In this case, result = Object[2] which is [null, null].
-> In this case, the result is not null. So the rule is fired with these "null" results.
This JIRA is to make it consistent.
- incorporates
-
DROOLS-6064 Inconsistent behavior when accumulate function returns null
- Closed