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

duplicate nodes in apoc.export.csv.graph from a apoc.create.graph #1436

Closed
jexp opened this issue Mar 5, 2020 · 1 comment · Fixed by #1507
Closed

duplicate nodes in apoc.export.csv.graph from a apoc.create.graph #1436

jexp opened this issue Mar 5, 2020 · 1 comment · Fixed by #1507

Comments

@jexp
Copy link
Member

jexp commented Mar 5, 2020

see discussion below

Cory Waddingham I have a customer who is running a query that’s returning more nodes than exist in his database. the query is:

MATCH path = (node)-[*1]->()
WITH collect(path) AS paths
CALL apoc.graph.fromPaths(paths, "mygraph", {})
YIELD graph AS g
CALL apoc.static.set("mygraph.cached", g)
YIELD value
RETURN value, g

says he gets 8 nodes, 4 relationships, and 23 properties, but he claims to only have 5 nodes, 4 relations, and 14 properties (not sure how he knows that, I’ve asked and am waiting a response). any thoughts on why there might be a mismatch? other than him being wrong about the number of nodes in his db?

Michael Hunger good question, I think so far we mostly exported from a real graph not a virtual one, that's why the APOC issue would make most senes
Cory Waddingham the query being used for the export originally was

CALL apoc.export.csv.graph(apoc.static.get("mygraph.cached"), null, {stream: true})
YIELD file, nodes, relationships, properties, data
RETURN file, nodes, relationships, properties, data

Cory Waddingham since this in Aura it has to be exported to a stream, saving to a file isn’t an option

Cory Waddingham this query seems to solve his issue

MATCH (n1)-[r]-()
WITH collect(distinct n1) as n1s, collect(r) as rs
CALL apoc.export.csv.data(n1s,rs,null,{stream: true})
YIELD file, nodes, relationships, properties, data
RETURN file, nodes, relationships, properties, data

Michael Hunger I don't know why he needs to store it
Cory Waddingham my guess is that’s the function he knows and has used before so it was the first one he went to :man-shrugging::skin-tone-3:
Michael Hunger I think it could be a missing/overlooked issue between the graph export and graph creation that didn't show up in the testing so far
Michael Hunger thanks a lot for the details, and the issue is only duplicate nodes in the output?
Cory Waddingham it could be yeah
Cory Waddingham yw, and yes, that’s correct
Michael Hunger ok
Cory Waddingham the dupes all have the same node ID, too, if that helps
Cory Waddingham so it should be possible to use that as a filter

@jexp
Copy link
Member Author

jexp commented Mar 5, 2020

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