Skip to content

ArcadeDB 26.10.1: a no-op CALL (*) changes FOREACH write cardinality #8826

Closed

Description

@YGY-001

Environment

  • Image: arcadedata/arcadedb:latest
  • Server: 26.10.1-SNAPSHOT, build 8a3cec609442adfce8ce4c717e727c749a932c8b
  • Image ID: sha256:86dbf43722b06648d05217f90195a714dd2c2846e787eb1788b77615d9a12685
  • Each side was executed in a separate fresh container with the setup completed successfully.

Setup

CREATE (b:B {k: 'x'}),
       (a1:A {id: 1}),
       (a2:A {id: 2}),
       (c:C {id: 3}),
       (b)-[:R]->(a1),
       (b)-[:R]->(a2),
       (b)-[:S]->(c);

UNWIND range(1, 10) AS i
CREATE (:D {id: i}),
       (f:F {id: i})-[:T]->(e:E {id: i});

Control query

MATCH p0 = TRAIL (n0) <-[]- (n1:B {k: 'x'}) -[:S]-> (x:C),
      (n2:D), (n3:E) <-[:T]- (y:F)
WHERE n1.k =~ '.*'
FOREACH (i IN range(0, 9) | CREATE (:Z {k: i}))
WITH n0, n1, n2, n3, p0 LIMIT 1
RETURN n0, n1, n2, n3, p0;

Equivalent query with a no-op subquery boundary

MATCH p0 = TRAIL (n0) <-[]- (n1:B {k: 'x'}) -[:S]-> (x:C),
      (n2:D), (n3:E) <-[:T]- (y:F)
WHERE n1.k =~ '.*'
FOREACH (i IN range(0, 9) | CREATE (:Z {k: i}))
WITH n0, n1, n2, n3, p0 LIMIT 1
WITH n0, n1, n2, n3, p0
CALL (*) { RETURN 0 AS barrier }
WITH n0, n1, n2, n3, p0
RETURN n0, n1, n2, n3, p0;

Expected

The second query only inserts a result-independent subquery boundary. It must preserve the row stream and all graph side effects of the control query. Both executions should return one row and leave the same graph.

Actual

On two independent fresh-container repetitions:

  • Control query: one result row; final graph has 1034 vertices and 13 edges.
  • Equivalent query: one result row; final graph has 2034 vertices and 13 edges.

The extra 1000 Z vertices are created by the equivalent query even though the inserted subquery returns a constant and its binding is discarded.

Activity

  1. added this to the 26.10.1 milestone on Oct 1, 2026
  2. added
    in progress
    on Oct 1, 2026
  3. self-assigned this
    on Oct 1, 2026
  4. added a commit that references this issue on Oct 1, 2026
  5. lvca commented on Oct 1, 2026

    @lvca
    Member

    Confirmed and fixed in #8830 (milestone 26.10.1).

    A LIMIT placed after a write (here FOREACH) stopped reading rows early, so the write ran for only some of them. The no-op CALL just happened to force all rows to be read, which is why the two queries differed. The write now always runs for every row before LIMIT trims the result: the control query creates all 2000 Z vertices, same as the variant.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  6. removed
    in progress
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions