-
Bug
-
Resolution: Done
-
Major
-
6.2.0
-
None
Description of problem:
For String conditions, the allowed operators are:
==, !=, >, >=, <, <=, in, not in, == null, != null, matches, soundslike (and no operator)
StringConditionInspector only works with operators ==, !=, in - when a String condition uses any other operator, issues are not detected correctly. This also affects the issue descriptions.
Furthermore, conditions like:
'name == "a"' and 'name in ("a")'
'name != "a"' and 'name not in ("a")'
should be considered redundant,
'name != "a"' and 'name in ("a", "b")'
should not conflict (in one row/rule)
'name != "b"' should subsume 'name == "a"'
'name in ("b", "c")' should not subsume 'name != "a"'
For numeric conditions, the allowed operators also include: in, not in, == null, != null (and no operator) which are, again, not taken into account in ComparableConditionInspector. This again leads to incorrect detection of issues.
Also, there are issues when one condition has == or != operator and the other has <, >, <=, >=.
Furthermore, some edge cases are troublesome for <, >, <=, >=:
'age > 0' and 'age < 1'
'age > 0' and 'age <= 0'
should create a conflict within one row/rule
'age > -10' and 'age > 0'
should not create a conflict within one row/rule
'age == 0' should not subsume 'age != 1'
Temporal operators after, before and coincides are allowed for Date, but again ignored wrt analysis.
For integer conditions, the following case (and similar) should raise a redundancy warning:
'age > 0' and 'age >= 1'
For more detailed list of issue, please see tests in PR https://github.com/droolsjbpm/drools-wb/pull/64 and also note bug 1256732.