Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1881

Inconsistent property reactivity with Join and From

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.13.0.GA
    • 7.6.0.GA
    • BRE
    • None
    • False
    • False
    • Release Notes
    • ER1
    • +
    • Workaround Exists
    • Hide

      Remove useless "from" :

          when
              $p2 : Person ( age < 2 )
      
      Show
      Remove useless "from" : when $p2 : Person ( age < 2 )
    • 2022 Week 05-07 (from Jan 31), 2022 Week 08-10 (from Feb 21)

      With an odd usage of "from" like this,

          when
              $p1 : Person ( )
              $p2 : Person ( age < 2 ) from $p1
      

      At modifyObject(), if LeftInputAdapterNode has JoinNode and FromNode as its sinks, when the first sink is a JoinNode, its mask doesn't intersect so doUpdateObject() is not called so the rule "R2" is not cancelled. If the first sink is a FromNode, its mask intersects so doUpdateObject() is called hence the rule "R2" is cancelled.

      https://github.com/kiegroup/drools/blob/7.65.0.Final/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java#L411-L422

      It may cause a random rule behaviour because the order of adding nodes depend on the order of enlisted rule assets and the assets is HashSet which has no order. (If it's single drl file like the unit test, we can expect that the nodes are added in the rule order in the file.)

      https://github.com/kiegroup/drools/blob/7.65.0.Final/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieProject.java#L222-L247

       

      Exists also a PR for a unit test: https://github.com/kiegroup/drools/pull/4194

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-dmammare Daniele Mammarella
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: