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

Incorrect query result for MATCH/OPTIONAL MATCH combination #2942

Closed
sapalli2989 opened this issue Feb 25, 2024 · 2 comments · Fixed by #2977
Closed

Incorrect query result for MATCH/OPTIONAL MATCH combination #2942

sapalli2989 opened this issue Feb 25, 2024 · 2 comments · Fixed by #2977
Assignees

Comments

@sapalli2989
Copy link
Contributor

CREATE NODE TABLE V (id STRING, PRIMARY KEY(id));
CREATE NODE TABLE R (id STRING, PRIMARY KEY(id));
CREATE REL TABLE childof (FROM V TO V);
CREATE REL TABLE relatedto (FROM R TO V);

CREATE (v1:V {id:"v1"}),(v11:V {id:"v11"}),(v12:V {id:"v12"}),(v111:V {id:"v111"}),
(r1:R {id:"r1"}), (r12:R {id:"r12"}),
(v111)-[:childof]->(v11),(v11)-[:childof]->(v1),(v12)-[:childof]->(v1),
(r1)-[:relatedto]->(v1), (r12)-[:relatedto]->(v12);
MATCH (v1:V {id: "v1"})
WITH v1
MATCH (v:V)-[e:childof*]->(v1)
OPTIONAL MATCH (r)-[:relatedto]->(v)
RETURN r, v;

screenshot

What Kuzu returns:

---------------------------------------
| r | v                               |
---------------------------------------
|   | {_ID: 0:3, _LABEL: V, id: v111} |
---------------------------------------
|   | {_ID: 0:2, _LABEL: V, id: v12}  |
---------------------------------------
|   | {_ID: 0:1, _LABEL: V, id: v11}  |
---------------------------------------
(3 tuples)
(2 columns)

What Neo4j returns (and what is expected here):

╒════════════════╤═════════════════╕
│r               │v                │
╞════════════════╪═════════════════╡
│null            │(:V {id: "v11"}) │
├────────────────┼─────────────────┤
│null            │(:V {id: "v111"})│
├────────────────┼─────────────────┤
│(:R {id: "r12"})│(:V {id: "v12"}) │
└────────────────┴─────────────────┘

Why does Kuzu omit the existing optional match (:R {id: "r12"}) for v12 here?

@prrao87
Copy link
Member

prrao87 commented Feb 26, 2024

Hi @sapalli2989, we'll take a look at this as soon as possible.

@andyfengHKU
Copy link
Contributor

Hi @sapalli2989 , this issue should be solved in #2977 now.

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

Successfully merging a pull request may close this issue.

3 participants