apoc icon indicating copy to clipboard operation
apoc copied to clipboard

combo of apoc.periodic.iterate/apoc.refactor.mergeNodes runs forever

Open neo-technology-build-agent opened this issue 2 years ago • 1 comments

Issue by sarmbruster Friday Feb 14, 2020 at 17:07 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1408


to reproduce: run Neo4j 4.0.0 + APOC 4.0.0.2 and setup a test dataset:

unwind range(1,1000) as x
create (p:Person{name:"person_" + x}) -[:OWNS]->(o:Org{name: "org_" + x, id:x})

This statement will never terminate:

call apoc.periodic.iterate(
"match (o:Org) with collect(o) as orgs
unwind range(0,99) as batch
return orgs[batch*10..batch*10+10]  as nodes
",
"CALL apoc.refactor.mergeNodes(nodes, { properties: {name: 'combine', `.*` : 'discard'}, mergeRels: true}) YIELD node RETURN node.name",
{batchSize:1})