in Neo4j my Cypher query pulls data from most recently loaded object, not the one specified
1
vote
0
answers
29
views
I believe this code demonstrates a bug in this software. But given my lack of experience with Neo4j, maybe something is coded incorrectly.
I would like to know if the unexpected output is due to a bug.
Given 2 tiny **.csv** files, I load these data and when I query each loaded object the data seems ok.
Then when I query object **T7** it shows the data from object **T8**.
Thanks!
# Steps to reproduce the behaviour
## File t7.csv
col1
t7 1 row
## File t8.csv
col1
t8 2 rows
t8 2 rows
I then login with the following command:
$ bin/cypher-shell -u neo4j -p my password
I then run the following commands:
MATCH (T7)
OPTIONAL MATCH (T7)-[r]-()
WITH T7,r LIMIT 5000
DELETE T7,r
RETURN count(T7) as deletedNodesCount;
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///t7.csv" as line
CREATE (T7 {col1:line.col1});
MATCH T7 = (t7)
RETURN t7.col1;
The above commands load the data and return the values found as follows:
> +------------+
> | a.col1 |
> +------------+
> | "t7 1 row" |
> +------------+
I perform the same task for the T8 data:
MATCH (T8)
OPTIONAL MATCH (T8)-[r]-()
WITH T8,r LIMIT 5000
DELETE T8,r
RETURN count(T8) as deletedNodesCount;
LOAD CSV WITH HEADERS FROM "file:///t8.csv" as line
CREATE (T8 {col1:line.col1});
MATCH T8 = (t8)
RETURN t8.col1;
The above commands load the data and return the values found as follows:
> +-------------+
> | a.col1 |
> +-------------+
> | "t8 2 rows" |
> | "t8 2 rows" |
> +-------------+
Now if I run the following command, this gets data for most recent query, but not the correct node?
MATCH T7 = (t7)
RETURN t7.col1;
I expected this output:
> +------------+
> | a.col1 |
> +------------+
> | "t7 1 row" |
> +------------+
Instead I received the following output:
> +-------------+
> | a.col1 |
> +-------------+
> | "t8 2 rows" |
> | "t8 2 rows" |
> +-------------+
## Version information
### Neo4j
call dbms.components() yield name, versions, edition unwind versions as version return name, version, edition;
> +----------------------------------------+
> | name | version | edition |
> +----------------------------------------+
> | "Neo4j Kernel" | "3.5.1" | "community" |
> +----------------------------------------+
### OS
Mac OS 10.13.6
Asked by drum1440
(11 rep)
Dec 8, 2019, 08:07 PM
Last activity: Dec 11, 2019, 12:23 PM
Last activity: Dec 11, 2019, 12:23 PM