GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — reduce(...) over an inline aggregate expression may be evaluated incorrectly · Issue #4107 · ArcadeData/arcadedb

reduce(...) over an inline aggregate expression may be evaluated incorrectly #4107

New issue
Copy link
New issue
Copy link
Closed
Bug
Closed
reduce(...) over an inline aggregate expression may be evaluated incorrectly#4107
Bug
Copy link
Assignees
lvca
Labels
opencypher
Milestone
26.5.1

Description

@Silence6666668
Silence6666668
opened on May 6, 2026
Issue body actions

ArcadeDB version
Observed on Docker images:

  • arcadedata/arcadedb:26.4.1-SNAPSHOT
  • arcadedata/arcadedb:26.4.2

Environment

  • Host OS: Windows 10
  • Architecture: x86_64
  • Deployment: Docker
  • ArcadeDB endpoint: HTTP /api/v1/command/arcade
  • Request mode used for direct reproduction:
    • language: cypher
    • serializer: studio
  • Differential comparison target: Neo4j Docker neo4j:latest

Describe the bug
ArcadeDB may evaluate reduce(...) incorrectly when the list operand is produced by an aggregate expression inline in the same projection.

The problem is not reduce(...) by itself, and it is not the aggregate by itself. The boundary is much narrower:

  • WITH ... AS ages RETURN reduce(... IN ages ...) works
  • RETURN reduce(... IN collect(...) ...) does not
  • WITH ... AS age_sum RETURN reduce(... IN [age_sum] ...) works
  • RETURN reduce(... IN [sum(...)] ...) does not

So the issue appears to be specific to inline aggregate expressions nested directly inside the reduce(...) list operand.

To Reproduce

Setup:

CREATE (:Person {name:'Alice', age:30});
CREATE (:Person {name:'Bob', age:25});
CREATE (:Person {name:'Charlie', age:35});

Query:

MATCH (p:Person)
RETURN p.name AS name,
       reduce(total = 0, n IN collect(p.age) | total + n) AS total_age_sum
ORDER BY name;

Expected behavior
Each grouped row should reduce over its own one-element collected list:

Alice,   30
Bob,     25
Charlie, 35

Observed Neo4j result:

Alice,   30
Bob,     25
Charlie, 35

Actual behavior
Observed ArcadeDB 26.4.1-SNAPSHOT and 26.4.2 result:

Alice,   0
Bob,     0
Charlie, 0

So the inline collect(p.age) is not being fed into reduce(...) correctly.

Control case
If the aggregate result is materialized first and only then passed into reduce(...), ArcadeDB behaves normally:

MATCH (p:Person)
WITH p.name AS name, collect(p.age) AS ages
RETURN name,
       reduce(total = 0, n IN ages | total + n) AS total_age_sum
ORDER BY name;

Observed result on Neo4j and ArcadeDB 26.4.1-SNAPSHOT / 26.4.2:

Alice,   30
Bob,     25
Charlie, 35

This makes the boundary clear: reduce(...) itself works, and collect(...) itself works, but the inline aggregate expression inside reduce(...) does not.

Stronger reproducer
The same family also appears with other inline aggregate expressions, not just collect(...).

For example:

MATCH (p:Person)
RETURN p.name AS name,
       reduce(total = 0, n IN [sum(p.age)] | total + n) AS s
ORDER BY name;

Observed Neo4j result:

Alice,   30
Bob,     25
Charlie, 35

Observed ArcadeDB 26.4.1-SNAPSHOT / 26.4.2 result:

Alice,   30
Bob,     55
Charlie, 90

The same cumulative pattern also appears with count(*):

MATCH (p:Person)
RETURN p.name AS name,
       reduce(total = 0, n IN [count(*)] | total + n) AS s
ORDER BY name;

Observed Neo4j result:

Alice,   1
Bob,     1
Charlie, 1

Observed ArcadeDB 26.4.1-SNAPSHOT / 26.4.2 result:

Alice,   1
Bob,     2
Charlie, 3

So this is not limited to collect(...). More generally, inline aggregate expressions inside reduce(...) may be evaluated against the wrong state.

Additional failure mode
Without a grouping key, ArcadeDB can also silently lose the projected result column:

MATCH (p:Person)
RETURN reduce(total = 0, n IN collect(p.age) | total + n) AS total_age_sum;

Observed Neo4j result:

90

Observed ArcadeDB 26.4.1-SNAPSHOT / 26.4.2 result:

<row present, but `total_age_sum` missing>

This suggests the same underlying issue can show up either as a wrong numeric result or as a dropped projection value, depending on the aggregation shape.

Activity

  1. robfrank
    self-assigned this
    on May 6, 2026
  2. robfrank
    added this to the 26.5.1 milestone on May 6, 2026
  3. lvca
    added a commit that references this issue on May 6, 2026

    fix: Cypher mixed issues

    f353edf
  4. lvca
    assigned
    lvca
    and unassigned
    robfrank
    on May 6, 2026
  5. lvca
    added the
    Bug
    issue type on May 6, 2026
  6. lvca commented on May 6, 2026

    @lvca
    lvca
    on May 6, 2026
    Member
    More actions

    Fixed.

  7. lvca
    closed this as completedon May 6, 2026
  8. tae898
    added a commit that references this issue on May 10, 2026

    fix: Cypher mixed issues

    6401964
  9. robfrank
    added
    opencypher
    on May 10, 2026
  10. robfrank
    added a commit that references this issue on May 12, 2026

    fix: Cypher mixed issues

    7d74feb
  11. tae898
    added 3 commits that reference this issue on Jun 28, 2026

    chore(studio-deps)(deps): bump swagger-ui-dist from 5.30.2 to 5.30.3 …

    a31d765

    chore(deps): bump com.google.api.grpc:proto-google-common-protos from…

    4d0c0e2

    fix: Cypher mixed issues

    dbf9e94
  12. mergify
    added a commit that references this issue on Aug 30, 2026

    chore(deps): bump the github-actions group with 5 updates [skip ci]

    a12f5d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

opencypher

Type

Bug

Projects

No projects

    Milestone

    • 26.5.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.