Limitation of IN Operator items in drl, INoperator doesn't support huge list

19 views Asked by At

I am trying to write a rule with huge list of items (more than 10,000) and it fails eventually. $list1 : MyColl.ItemsC(item in ("1","2","3","4","5","6", .........) from $MyColl.Items)

I would like to understand what is the limitation here, and is there any way to handle such a huge list with IN operator.

I am tyring to find out the limitation here, so that i can inform the user to define the rule accordingly. Also, looking for an alternate approach to write rule, to support huge list of items with IN operator.

1

There are 1 answers

0
Roddy of the Frozen Peas On

Save your huge list of items to a variable and invert the operation. The counter parts to in and not in are contains and not contains.

Alternatively you can always fall back on using the .contains($item) on the collection itself after you've got your values saved to a variable. Performance will, of course, require you to avoid eval and do this in DRL, plus the actual performance of the underlying operation which depends on the chosen data types.

Also if these strings are all integers you may want to consider that you're using the wrong data type in the first place, but depending on your actual values it may be possible to do range comparisons instead.