Repeated self-referential property updates on the same node across row fanout may apply only the last row (original) (raw)

ArcadeDB version
Observed on Docker images:

Environment

Describe the bug
When the same node is hit on multiple rows in a single statement, a self-referential property update such as:

should accumulate once per row.

Neo4j does that.
ArcadeDB appears to apply only the last row's increment.

In the minimized repro below, the same Person row is revisited three times by UNWIND [1, 2, 3].
Neo4j persists the final age as 36.
ArcadeDB persists 33, which is consistent with only the last +3 being applied.

To avoid ambiguity about how mutating queries materialize values in their own RETURN, the repro checks the final persisted state with a separate read query.

To Reproduce

Setup:

CREATE (:Person {name:'Alice', age:30});

Mutation query:

MATCH (p:Person {name:'Alice'}) UNWIND [1, 2, 3] AS i SET p.age = p.age + i;

Check query:

MATCH (p:Person {name:'Alice'}) RETURN p.age AS age;

Expected behavior
The three updates should accumulate:

Observed Neo4j result:

Actual behavior
Observed ArcadeDB result on all tested versions:

So ArcadeDB is not accumulating all row hits.
It looks like only the last row update is persisted.

Control cases

A single-row self-referential update behaves normally:

MATCH (p:Person {name:'Alice'}) SET p.age = p.age + 3;

MATCH (p:Person {name:'Alice'}) RETURN p.age AS age;

Observed result on Neo4j and all tested ArcadeDB versions:

So ordinary self-referential SET is not broken in general.

If the repeated updates do not depend on the previous property value, ArcadeDB also behaves normally:

MATCH (p:Person {name:'Alice'}) UNWIND [1, 2, 3] AS i SET p.age = i;

MATCH (p:Person {name:'Alice'}) RETURN p.age AS age;

Observed result on Neo4j and all tested ArcadeDB versions:

This makes the boundary sharper:

The same family also appears when the increment is constant on each row:

MATCH (p:Person {name:'Alice'}) UNWIND [1, 2, 3] AS i SET p.age = p.age + 1;

MATCH (p:Person {name:'Alice'}) RETURN p.age AS age;

Observed results:

So this does not depend on the increment values being different per row.

Stronger reproducer

The issue is not limited to one property on one node.
It also shows up when two bound nodes are updated together across the same row fanout:

Setup:

CREATE (:Person {name:'Alice', age:30}), (:Company {name:'TechCorp', founded:2000});

Mutation query:

MATCH (p:Person {name:'Alice'}), (c:Company {name:'TechCorp'}) UNWIND [1, 2, 3] AS i SET p.age = p.age + i, c.founded = c.founded - i;

Check query:

MATCH (p:Person {name:'Alice'}), (c:Company {name:'TechCorp'}) RETURN p.age AS age, c.founded AS founded;

Observed results:

So the problem is not tied to one specific property or label.