You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SET n = <node> and SET n += <node> are silent no-ops: SetStep requires a java.util.Map RHS while MergeStep's copy handles a Document #6832
Cypher allows a node or relationship on the right-hand side of SET x = y and SET x += y (copy all properties from another entity). SetStep bails out unless the RHS is a java.util.Map, so both forms are silent no-ops. The duplicated logic in MergeStep handles the entity RHS correctly, which settles that it is meant to be supported.
Where (HEAD 9c9d024db)
engine/src/main/java/com/arcadedb/query/opencypher/executor/steps/SetStep.java:304-306 (applyReplaceMap) and :352-354 (applyMergeMap), identical in both:
finalObjectmapValue = precomputedValue;
if (!(mapValueinstanceofMap))
return;
The evaluated RHS for an entity is a Vertex/Document, not a Map, so the whole SET item is discarded with no write, no error, and no increment of propertiesSet.
engine/src/main/java/com/arcadedb/query/opencypher/executor/steps/MergeStep.java:1391-1395 - the same logic, done right:
(and :1423 for MERGE_MAP). So ON MATCH SET a = b copies properties while the plain SET a = b does nothing.
Repro
CREATE (:A{id:1}), (:B{id:2,name:'x',age:7});
MATCH (a:A{id:1}), (b:B{id:2}) SETa=bRETURNa
a comes back unchanged: no name, no age. SET a += b behaves the same. Query statistics report 0 properties set. Neo4j copies b's properties onto a.
This is a silent, data-loss-shaped failure: a clone/ETL query appears to succeed.
Suggested fix
In both applyReplaceMap and applyMergeMap, accept a Document RHS the way MergeStep.applySetClause already does (mapValue instanceof Document srcDoc -> srcDoc.propertiesAsMap()), and raise a TypeError for any other non-map, non-null RHS instead of returning silently. Better still, share one implementation between the two steps (see the companion issue about MergeStep re-implementing SET).
Scope / confidence
High. Verified that CypherASTBuilder (:721, :726) builds REPLACE_MAP/MERGE_MAP items from an arbitrary expression with no type restriction, that CypherSemanticValidator has no REPLACE_MAP/MERGE_MAP type check, and that ResultInternal.getProperty returns the Vertex record itself rather than a RID (ResultInternal.java:161 excludes Record from the RID conversion), so a Map can never arrive from a variable bound to a node. No opencypher test asserts either behaviour.
Activity
fix(#6832): close the map-shaped hole in the property-value type check
Merge pull request #6863 from ArcadeData/fix/6831-6832-cypher-set-uni…
fix(ArcadeData#6831,ArcadeData#6832): one implementation of the openC…