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

Beta node indexes don't support type coercion

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core engine
    • Labels:
      None
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      When there is a type mismatch (e.g. String vs Integer) in a constraint, usually a type is coerced and a rule is fired.

      rule "R2"
          when
              $f : MyFactB( strData == 20 )
          then
              System.out.println( "R2 fired : $f = " + $f );
      end
      

      As far as I investigate, in case of AlphaNode, MVEL does the coercion. Also AlphaNode hashing does the coercion (https://github.com/kiegroup/drools/blob/7.5.0.Final/drools-core/src/main/java/org/drools/core/reteoo/CompositeObjectSinkAdapter.java#L748).

      However, in case of JoinNode, it doesn't coerce so doesn't fire.

      rule "R1"
          when
              MyFactA( $i : intData )
              $f : MyFactB( strData == $i )
          then
              System.out.println( "R1 fired : $f = " + $f );
      end
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mfusco Mario Fusco
                  Reporter:
                  mfusco Mario Fusco
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: