Skip to content

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

Closed

Description

@ruispereira

Summary

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:

final Object mapValue = precomputedValue;
if (!(mapValue instanceof Map))
  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:

final Map<String, Object> map;
if (mapValue instanceof Map)
  map = (Map<String, Object>) mapValue;
else if (mapValue instanceof Document srcDoc)
  map = srcDoc.propertiesAsMap();
else

(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}) SET a = b RETURN a

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

  1. added this to the 26.9.1 milestone on Aug 27, 2026
  2. added
    in progress
    on Aug 28, 2026
  3. self-assigned this
    on Aug 28, 2026
  4. added 2 commits that reference this issue on Aug 28, 2026
  5. added a commit that references this issue on Aug 28, 2026
  6. removed
    in progress
    on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions