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

exec-model : compilation error when bind var produced by accumulate is used in the condition of subsequent accumulate

XMLWordPrintable

    • 2021 Week 25-27 (from Jun 21)
    • 2
    • Hide

      run attached reproducer by the following steps.

      1. extract it and then go to 'reproducer_accumulate_bind_variables/kjarCreation
      2. build&install it
      $ mvn clean install

      Show
      run attached reproducer by the following steps. 1. extract it and then go to 'reproducer_accumulate_bind_variables/kjarCreation 2. build&install it $ mvn clean install
    • Hide

      rewrite rule without using accumulate.
      e.g.

      $maxFact : Fact(id == $id, $str1 : str1)
      not( Fact(id != $id, str1 > $str1) )
      
      Show
      rewrite rule without using accumulate. e.g. $maxFact : Fact(id == $id, $str1 : str1) not( Fact(id != $id, str1 > $str1) )
    • Undefined
    • NEW
    • NEW

      When bind variable produced by accumulate is used in the condition of subsequent accumulate like the following,

              accumulate( Fact(id == $id, $str1 : str1);
                      $count : count($str1),
                      $maxStr1 : max($str1);
                      $count > 1
              )
              accumulate( Fact(id == $id, str1 == $maxStr1, $str2 : str2);
                      $maxStr2 : max($str2)
              )
      

      compilation fails with the error like the following (the error is a bit different per version).

      //7.52.1-SNAPSHOT

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile-1) on project reproducer_accumulate_bind_variables: Compilation failure: Compilation failure: 
      [ERROR] /home/Case/02972411/work/reproducer_accumulate_bind_variables/kjarCreation/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules7f7bf65f8c4b470085e07368517e472dRuleMethods0.java:[76,164] cannot find symbol
      [ERROR]   symbol:   variable var_$maxStr1_2_sCoPe
      [ERROR]   location: class com.example.reproducer.Rules7f7bf65f8c4b470085e07368517e472dRuleMethods0
      [ERROR] /home/Case/02972411/work/reproducer_accumulate_bind_variables/kjarCreation/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules7f7bf65f8c4b470085e07368517e472dRuleMethods0.java:[157,163] cannot find symbol
      [ERROR]   symbol:   variable var_$maxBd1_2_sCoPe
      [ERROR]   location: class com.example.reproducer.Rules7f7bf65f8c4b470085e07368517e472dRuleMethods0
      [ERROR] -> [Help 1]
      

      //7.56.0-SNAPSHOT

      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.56.0-SNAPSHOT:generateModel (default-generateModel) on project reproducer_accumulate_bind_variables: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.56.0-SNAPSHOT:generateModel failed: [com/example/reproducer/Rules48f1460cfa884208bf0c1de4da5b3de6RuleMethods0.java (76:10411) : var_$maxStr1_2_sCoPe cannot be resolved to a variable, com/example/reproducer/Rules48f1460cfa884208bf0c1de4da5b3de6RuleMethods0.java (157:23528) : var_$maxBd1_2_sCoPe cannot be resolved to a variable] -> [Help 1]
      

      Build works with -DgenerateModel=NO.

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-hmiura Hiroko Miura
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: