cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

A bug has occurred in the morsel runtime: The target morsel cannot hold the data to copy.

Hi guys,

I'm getting this error on my neo4j-desktop 1.4.15 for neo4j version 4.4.5

A bug has occurred in the morsel runtime: The target morsel cannot hold the data to copy.

And this is the query i'm doing

 

CALL{
CALL { MATCH (qlwe:Fan)-[mmkt:BORN_ON_MONTH]->(xbqe:Month) WHERE xbqe.name = '01' RETURN COLLECT(apoc.map.merge({id: ID(qlwe)}, qlwe)) AS xodv}
CALL { MATCH (zdfy:Fan)-[bdkl:BORN_ON_DAY]->(krcq:Day) WHERE krcq.name = '20' RETURN COLLECT(apoc.map.merge({id: ID(zdfy)}, zdfy)) AS zqqz}
WITH apoc.coll.intersection(xodv,zqqz) AS bmxh
RETURN bmxh
}
CALL{
CALL { MATCH (zazq:Player)-[eize:BORN_ON_MONTH]->(xmwc:Month) WHERE xmwc.name = '01' RETURN COLLECT(apoc.map.merge({id: ID(zazq)}, zazq)) AS oemm}
CALL { MATCH (ceah:Player)-[yqgt:BORN_ON_DAY]->(ychy:Day) WHERE ychy.name = '20' RETURN COLLECT(apoc.map.merge({id: ID(ceah)}, ceah)) AS eqci}
WITH apoc.coll.intersection(eqci,oemm) AS cmrh
RETURN cmrh
}
WITH apoc.coll.union(jj,gg) AS xgst
UNWIND xgst as result
RETURN result
 
Please some help
4 REPLIES 4

'jj' and 'gg' are not defined.  Are these supposed to be 'bmxh' and 'cmrh'?  If so, I think this simplified query should result in the same result.  Maybe it avoids the error.

CALL { 
    MATCH (qlwe:Fan)-[mmkt:BORN_ON_MONTH]->(xbqe:Month) 
    WHERE xbqe.name = '01' 
    RETURN COLLECT(apoc.map.merge({id: ID(qlwe)}, qlwe)) AS xodv
}
CALL { 
    MATCH (zdfy:Fan)-[bdkl:BORN_ON_DAY]->(krcq:Day) 
    WHERE krcq.name = '20' 
    RETURN COLLECT(apoc.map.merge({id: ID(zdfy)}, zdfy)) AS zqqz
}
UNWIND apoc.coll.intersection(xodv,zqqz) AS result
RETURN result

UNION 

CALL { 
    MATCH (zazq:Player)-[eize:BORN_ON_MONTH]->(xmwc:Month) 
    WHERE xmwc.name = '01' 
    RETURN COLLECT(apoc.map.merge({id: ID(zazq)}, zazq)) AS oemm
}
CALL { 
    MATCH (ceah:Player)-[yqgt:BORN_ON_DAY]->(ychy:Day) 
    WHERE ychy.name = '20' 
    RETURN COLLECT(apoc.map.merge({id: ID(ceah)}, ceah)) AS eqci
}
UNWIND apoc.coll.intersection(eqci,oemm) AS result
RETURN result

 

Just a note on the apoc.merge.map usages. The function takes two maps as its parameters, but in all four uses the second parameter being passed is a node. I think the second parameter should be properties(node) instead, as properties will return a map of the node’s properties. 

You can also get the same result directly with map projection, eliminating the need for apoc.map.merge. Collect the following instead, where ‘x’ represents the node variable. This will create a map with all the node’s properties and its id. 

x{.*, id: id(x)} 

https://neo4j.com/docs/cypher-manual/current/syntax/maps/#cypher-map-projection

Just thinking, this should give you the same results and may be more efficient. It calculates the intersection of a list of nodes instead of a list of maps. 

CALL { 
    MATCH (qlwe:Fan)-[mmkt:BORN_ON_MONTH]->(xbqe:Month) 
    WHERE xbqe.name = '01' 
    RETURN COLLECT(qlwe) AS xodv
}
CALL { 
    MATCH (zdfy:Fan)-[bdkl:BORN_ON_DAY]->(krcq:Day) 
    WHERE krcq.name = '20' 
    RETURN COLLECT(zdfy) AS zqqz
}
UNWIND apoc.coll.intersection(xodv, zqqz) AS x
RETURN x{.*, id: id(x)} as result

UNION 

CALL { 
    MATCH (zazq:Player)-[eize:BORN_ON_MONTH]->(xmwc:Month) 
    WHERE xmwc.name = '01' 
    RETURN COLLECT(zazq) AS oemm
}
CALL { 
    MATCH (ceah:Player)-[yqgt:BORN_ON_DAY]->(ychy:Day) 
    WHERE ychy.name = '20' 
    RETURN COLLECT(ceah) AS eqci
}
UNWIND apoc.coll.intersection(eqci, oemm) AS x
RETURN x{.*, id: id(x)} as result

Sorry, last refactor.  It looks like the logic is finding the set of 'Fan' nodes that have both a specific relationship to a 'Month' node and a 'Day' node.  This is implemented by finding both set of 'Fan' nodes and calculating the intersection, which represents the set of nodes in both sets. This logic can be replaced by finding the set of 'Fan' nodes that have a path to both the specific 'Month' node and the specific 'Day' node. That is what the logic does in the below query.  

The same is true for the 'Player' nodes. 

MATCH (fan:Fan)
WHERE EXISTS {
    MATCH (fan)-[:BORN_ON_MONTH]->(xbqe:Month) 
    WHERE xbqe.name = '01' 
} 
AND EXISTS {
    MATCH (fan)-[:BORN_ON_DAY]->(krcq:Day) 
    WHERE krcq.name = '20' 
}
RETURN fan{.*, id: id(fan)} as result

UNION 

MATCH (player:Player)
WHERE EXISTS {
    MATCH (player)-[:BORN_ON_MONTH]->(xmwc:Month) 
    WHERE xmwc.name = '01' 
}
AND EXISTS {
    MATCH (player)-[:BORN_ON_DAY]->(ychy:Day) 
    WHERE ychy.name = '20' 
}
RETURN player{.*, id: id(player)} as result