Projected edges are not reused in later traversals · Issue #945 · RedisGraph/RedisGraph · GitHub
Skip to content

Projected edges are not reused in later traversals #945

Description

@jeffreylovitz

Given the graph constructed by:
CREATE ({x:1})-[:R]->({x:2})-[:R]->({x:3})
The query
MATCH ()-[r]->() WITH r MATCH (a)-[r]->(b) RETURN a, b
Should return the endpoints of each of the two r edges one time. Instead, we generate the execution plan:

1) "Results"
2) "    Project"
3) "        Conditional Traverse | (a)-[r]->(b)"
4) "            All Node Scan | (a)"
5) "                Project"
6) "                    Conditional Traverse | (anon_0)-[r]->(anon_1)"
7) "                        All Node Scan | (anon_0)"

Wherein the scan at line 4 also acts as a Cartesian product, and the r traversed at 3 is not influenced by that at 6. Each pair of endpoints is returned twice.

One of the misbehaviors caused by this issue is a memory leak on WITH-projected edge lists. (This scenario happens to pass because the LIMIT 1 blocks the implicit Cartesian product, but is not actually supported.) In this case, the variable-length traversal believes it should populate the edge value rs, and in doing so overwrites the heap-allocated list actually held at rs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions