Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Cartesian product in OPTIONAL MATCH #2489

Closed
ddaa2000 opened this issue Jul 22, 2022 · 1 comment
Closed

Wrong Cartesian product in OPTIONAL MATCH #2489

ddaa2000 opened this issue Jul 22, 2022 · 1 comment

Comments

@ddaa2000
Copy link

RedisGraph 2.8.15

After using following statements to create two nodes:
CREATE (n1)
CREATE (n2)

Then execute the following query:
MATCH (n1), (n2) OPTIONAL MATCH (n1), (n3) RETURN 0

I got 4 lines of result. However, in neo4j I got 8. And I think 2 x 2 x 2 should be the right answer. Is this a bug or it is caused by the different cypher standard betwen these two databases ?

@LiorKogan
Copy link
Member

Duplicate of #2205

Neo4j:

CREATE (n1)
CREATE (n2)
MATCH (n1), (n2) OPTIONAL MATCH (n1), (n3) RETURN [id(n1),id(n2),id(n3)]

[0,0,0]
[0,1,0]
[0,0,1]
[0,1,1]
[1,0,0]
[1,1,0]
[1,0,1]
[1,1,1]

RedisGraph:

GRAPH.DELETE g
GRAPH.QUERY g "CREATE (n1)"
GRAPH.QUERY g "CREATE (n2)"
GRAPH.QUERY g "MATCH (n1), (n2) OPTIONAL MATCH (n1), (n3) RETURN [id(n1),id(n2),id(n3)]"

[0, 0, 0]
[1, 0, 0]
[0, 1, 0]
[1, 1, 0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants