Skip to content

Cypher self-join on the same edge type can return incorrect empty results on a populated graph #3758

Description

@tae898

@lvca

I'm running some queries on stackoverflow dataset that I shared wtih you.

We are seeing what looks like a Cypher engine bug in embedded ArcadeDB, not a client binding issue.

Environment:

  • ArcadeDB 26.4.1-SNAPSHOT

A co-occurrence query over a populated property graph sometimes returns an empty result set even though the graph clearly contains matching data.

Query under test:

MATCH (q:Question)-[:TAGGED_WITH]->(t1:Tag)
MATCH (q)-[:TAGGED_WITH]->(t2:Tag)
WHERE t1.Id < t2.Id
RETURN t1.TagName AS tag1, t2.TagName AS tag2, count(*) AS cooccurs
ORDER BY cooccurs DESC, tag1 ASC, tag2 ASC
LIMIT 10

Expected behavior:

  • Return the top co-occurring tag pairs.
  • On our dataset this result is non-empty.

Observed behavior:

  • Neo4j and LadybugDB return the same non-empty top-10 result for this query.
  • ArcadeDB has produced an empty result set for the same logical dataset and query shape.

Why this looks like an ArcadeDB issue:

  • Two other graph engines, Neo4j and LadybugDB, return the same result.
  • The graph is definitely populated.
  • A manual reconstruction against the same ArcadeDB database produces the expected non-empty top-10 result.
  • In a fresh repro, the exact same Cypher query can also return the correct result in ArcadeDB, which suggests the problem may be intermittent or state/plan dependent rather than a syntax issue.

Manual validation logic:

  1. Fetch all tags with their ids and names.
  2. Fetch all (Question)-[:TAGGED_WITH]->(Tag) pairs.
  3. Group tags by question.
  4. Count unique ordered pairs (t1, t2) where t1.Id < t2.Id.
  5. Sort by cooccurs DESC, tag1 ASC, tag2 ASC.
  6. This produces the same non-empty top-10 result that Neo4j and LadybugDB return.

Additional note:
A different equivalent-looking formulation using collect()/UNWIND also produced obviously wrong output in ArcadeDB:

MATCH (q:Question)-[:TAGGED_WITH]->(t:Tag)
WITH q, collect(t) AS tags
UNWIND tags AS t1
UNWIND tags AS t2
WITH t1, t2
WHERE t1.Id < t2.Id
RETURN t1.TagName AS tag1, t2.TagName AS tag2, count(*) AS cooccurs
ORDER BY cooccurs DESC, tag1 ASC, tag2 ASC
LIMIT 10

In that case we observed a single row with null tag names and a large count, which also points to a Cypher execution issue around this pattern.

Activity

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

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions