memgraph/mage

[BUG] Performance issues in the Python do.case and do.when implementations

Josipmrden opened this issue · 0 comments

Describe the bug
Since do.case and do.when are called upon each passing of the operator tree during query execution, the Python module is called a lot of times and therefore poses a certain performance degradation.

Moreover, nodes and relationships are can not be passed in this query.

To Reproduce
FOREACH (i in range(1, 10000) | CREATE (n))
MATCH (n) CALL do.case([ID(n) % 2 = 0], "SET n.prop = 1", ID(n) % 2 = 1, "SET n.prop = 0"], "SET n.prop = 2", {n: n}) YIELD * RETURN *

The query runs slow and does not operate on relationships

Expected behavior
The query should run fast.