tkobayas commented on issue #6812:
URL: https://github.com/apache/incubator-kie/issues/6812#issuecomment-5186989097
@vaibhav-logik
Nested ORs can create huge permutations in KieBase building. In this case,
The exists() has 6 AND groups: 3 groups with 5 OR alternatives + 3 groups with
4 OR alternatives. It results in 5 * 5 * 5 * 4 * 4 * 4 = 8,000 permutations.
Then it creates a linear chain of 8,000 NotNodes, which will trigger
StackOverflowError/OutOfMemoryError.
I recommend to rewrite the rule. `exists(A && B)` is semantically equivalent
to `exists(A) && exists(B)`. So the rule can be split into separate exists()
conditions:
```
exists(
PicklistField(getName()=="field2" && getStringValue() != "X")
|| PicklistField(getName()=="field3" && getStringValue() != "X")
|| PicklistField(getName()=="field4" && getStringValue() != "X")
|| PicklistField(getName()=="field5" && getStringValue() != "X")
|| PicklistField(getName()=="field6" && getStringValue() != "X")
)
exists(
PicklistField(getName()=="field2" && getStringValue() != "X")
|| PicklistField(getName()=="field3" && getStringValue() != "X")
|| PicklistField(getName()=="field4" && getStringValue() != "X")
|| PicklistField(getName()=="field5" && getStringValue() != "X")
|| PicklistField(getName()=="field6" && getStringValue() != "X")
)
... repeat for each group
```
It would significantly reduce the use of stack/heap. Please try.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]