Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6821

Inconsistent propety reactivity with Join and From

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.66.0.Final
    • 7.65.0.Final
    • core engine
    • None
    • 2022 Week 05-07 (from Jan 31)
    • 3
    • Workaround Exists
    • Hide

      Remove useless "from" :

      e.g.

          when
              $p2 : Person ( age < 2 )
      
      Show
      Remove useless "from" : e.g. when $p2 : Person ( age < 2 )
    • NEW
    • NEW

      See reproducer unit test.

      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

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: