accumulate sum() of BigDecimal values incorrectly returns a value of type Double.

Solution Unverified - Updated -

Issue

accumulate sum() of BigDecimal values incorrectly returns a value of type Double in MVEL dialect and non-executable model environment.
For example, when I run a rule which calculates sum of BigDecimal values in such environment using (*1) and (*2),

(*1) Example rule

    :
    :
dialect "mvel"

rule "Rule1"
    when
        $sum : BigDecimal() from accumulate( Charge( $amount : amount != null ), sum($amount) )
    then
        System.out.println("***** Action of Rule1: " + $sum + " (" + $sum.getClass().getName() + ")");
end

(*2) Java program which runs the rule (*1)

        :
        :
    for (int i = 1; i <= 10; i++) {
        Charge charge = new Charge(new BigDecimal(i));
        System.out.println("input: " + charge);
        kSession.insert(charge);
    }
    kSession.fireAllRules();
        :
        :

the resulting value will not be of type BigDecimal but be of type Double incorrectly like (*3) below.

(*3) Result

***** Action of Rule1: 55.0 (java.lang.Double)

Environment

  • Red Hat Decision Manager (RHDM)
    • 7.1.0 - 7.4.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content