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

Rule compilation fails with date constraints on nested fact types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.32.0.Final, 7.33.0.Final
    • core engine
    • None
    • 2020 Week 07-09 (from Feb 10)
    • Hide

      run:

      mvn clean test
      

      on attached reproducer.

      Show
      run: mvn clean test on attached reproducer.
    • NEW
    • NEW

      As of Drools 7.32.0.Final, patterns containing constraints on nested dates won't compile.

      For instance, given the following drl:

      declare Fact
          n : Nested
      end
      declare Nested
          d : java.util.Date
      end
      
      rule "with nested date"
           when
            Fact(n!.d >= "01-Jan-2020", n!.d <= "10-Jan-2020")
           then
           end    
      

      we get the following error:

      Message [id=1, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
         text=Unable to Analyse Expression n.d >= "01-Jan-2020":
      [Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
      [Near : {... n.d >= "01-Jan-2020" ....}]
                          ^]
      Message [id=2, kieBase=forall-date-constraint, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0
         text=Unable to Analyse Expression n.d <= "10-Jan-2020":
      [Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
      [Near : {... n.d <= "10-Jan-2020" ....}]
                          ^]
      

      We don't reproduce with Drools <= 7.31.0.Final

              mfusco@redhat.com Mario Fusco
              mcasalino Matteo Casalino (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: