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

2.2 Cypher bug - identifiers unbound after UNWIND #4315

Closed
nicolewhite opened this issue Mar 29, 2015 · 1 comment
Closed

2.2 Cypher bug - identifiers unbound after UNWIND #4315

nicolewhite opened this issue Mar 29, 2015 · 1 comment

Comments

@nicolewhite
Copy link

I was having trouble with a 2.2 cypher query and I was able to reproduce it with the movie dataset:

MATCH (tom:Person {name:'Tom Hanks'})-[:ACTED_IN]->(m:Movie)
WITH tom, COLLECT(m) AS movies
UNWIND movies AS movie
MATCH (tom)-[:DIRECTED]->(movie)
RETURN tom.name, movie.title

In Neo4j 2.1.7, the results are as expected; I only get the movies that Tom Hanks has acted in and directed:

+-----------------------------------+
| tom.name    | movie.title         |
+-----------------------------------+
| "Tom Hanks" | "That Thing You Do" |
+-----------------------------------+

In Neo4j 2.2.0, however, the tom identifier becomes unbounded and it matches on any person who's directed the movies:

+---------------------------------------------------+
| tom.name               | movie.title              |
+---------------------------------------------------+
| "Mike Nichols"         | "Charlie Wilson's War"   |
| "Robert Zemeckis"      | "The Polar Express"      |
| "Penny Marshall"       | "A League of Their Own"  |
| "Robert Zemeckis"      | "Cast Away"              |
| "Ron Howard"           | "Apollo 13"              |
| "Frank Darabont"       | "The Green Mile"         |
| "Ron Howard"           | "The Da Vinci Code"      |
| "Andy Wachowski"       | "Cloud Atlas"            |
| "Lana Wachowski"       | "Cloud Atlas"            |
| "Tom Tykwer"           | "Cloud Atlas"            |
| "Tom Hanks"            | "That Thing You Do"      |
| "John Patrick Stanley" | "Joe Versus the Volcano" |
| "Nora Ephron"          | "Sleepless in Seattle"   |
| "Nora Ephron"          | "You've Got Mail"        |
+---------------------------------------------------+
@systay
Copy link
Contributor

systay commented Mar 31, 2015

Thanks for reporting it, @nicolewhite. Silly bugs.

FWIW - This query does the same thing but faster and more idiomatic:

MATCH (tom:Person {name:'Tom Hanks'})-[:ACTED_IN]->(movie:Movie)
WHERE (tom)-[:DIRECTED]->(movie)
RETURN tom.name, movie.title

You probably already knew that, just thought it was good for other readers to see. :)

davidegrohmann added a commit that referenced this issue Mar 31, 2015
Fixes #4315 - UNWIND not passing through identifiers
@systay systay closed this as completed in f71c213 Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants