apache / incubator-kie-drools

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.
http://www.drools.org
5.76k stars 2.47k forks source link

Date Between Dates with globals Not Triggering for Executable Model #6010

Closed tkobayas closed 4 days ago

tkobayas commented 1 week ago

When using the Drools executable model (pre-compiled) to execute an expression of a Date being between two other Dates like DateHolder( date < $startDate && date > $endDate), the related rule does not fire when the date value is actually between the two Date constants. Note that $startDate and $endDate are globals.

Switching the order of the greater or less than statements does not fix the issue. Using inclusive between (<= and >=) does not solve the issue for date field values (non-inclusively) between the dates.

However if the expression is changed to "DateHolder( date < $startDate && > $endDate)" it does fire as expected.

I have not checked to see if this issue effects other data types like long or int.

Also when using the DRL files directly (= non-executable model) in the drools engine, this issue does not occur.

tkobayas commented 1 week ago

I have not checked to see if this issue effects other data types like long or int.

The issue is a problem in GlobalExtractor.equals, so it would affect any types when you use more than 2 globals of the same type in one constraint.