Skip to content

Cypher: a property with several values repeats rows, where openCypher's model has one value #2089

Open

Description

@aaj3f

openCypher has no multi-valued properties, so it never repeats a row for one. We do, because a property read joins every value of the property. #2006 kept today's rows on purpose (they match MATCH … WHERE) and pinned them, so a model change flips those tests deliberately rather than by accident. It changes results across the Cypher surface, so it needs a decision on the model before code.

What a property with several values does today:

  • WHERE gives the row once per value that passes: MATCH (p:P) WHERE p.age > 30 RETURN count(p) is 4 over three people when one of them has two ages above 30.

  • ORDER BY gives the row once per value; WITH DISTINCT keeps those copies (the sort key is projected with them), while RETURN DISTINCT removes them.

  • An aggregate in a later clause counts each copy.

  • A read inside an aggregate's argument (collect(p.age), avg(n.age)) is joined before grouping, so it repeats the group's rows for every aggregate of that clause: WITH p, count(f) AS c, collect(p.age) AS ages counts each friend once per age.

  • Decide the model. Matching openCypher means WHERE as a semi-join, a sort key of one value per row, and aggregate arguments read per row.

  • Implement it in the explicit-WITH and MATCH paths at once, so the two don't diverge.

  • Flip fix(query): evaluate grouped SELECT expressions once per group #2006's pinned rows to the new model.

From #2006 (Follow-ups: Cypher properties with several values).

Activity

  1. added
    enhancement
    P3
    triage:needs-decision
    area:query
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:queryenhancementtriage:needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions