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

ClassCastException using accumulate max in executable model

    Details

      Description

      A rule containing the following accumulate constraint:

        $max1 : Number() from accumulate(
          StockTick($time : getTimeFieldAsDate());
          max($time.getTime()))
      

      is successfully compiled using the executable model, but fails at runtime:

      java.lang.RuntimeException: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Long
      	at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:105)
      	at org.drools.core.phreak.PhreakAccumulateNode.addMatch(PhreakAccumulateNode.java:750)
      	at org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:168)
      	at org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:89)
      	at org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:581)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:552)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:379)
      	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:339)
      	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:175)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:133)
      	at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:213)
      	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88)
      	at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:34)
      	at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
      	at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1062)
      	at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1009)
      	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1001)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1330)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1321)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1305)
      	at org.drools.modelcompiler.CompilerTest.testAccumulateWithMax(CompilerTest.java:2006)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  volothamp Luca Molteni
                  Reporter:
                  mputz Martin Weiler
                  Tester:
                  Tibor Zimanyi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: