Repository navigation
Description
Summary
Found while fixing #8377. With a Graph Analytical View READY, every multi-hop Cypher pattern whose hops share an edge type ignores Cypher relationship uniqueness (a relationship may be bound only once per MATCH). The CSR holds adjacency ids, not edge identities, so GAVExpandAll and GAVFusedChainOperator cannot tell a hop's edge from one a preceding same-clause hop already bound. GAVExpandInto already declines for this reason (CypherOptimizer.createExpandIntoOperator, the sameClausePrecedingRelVars guard), but createExpandAllOperator picks GAVExpandAll for any hop whose edge is not materialized, and an anonymous hop in the needsEdgeTracking set is exactly that. Since the GAV hop registers no synthetic edge-tracking variable, a later ExpandInto/GAVExpandInto/VarLengthExpand of the same clause and the cross-component RelationshipUniquenessFilter see no preceding edges either.
Repro
30 P vertices, each with a self-loop and 3 random K edges; CREATE GRAPH ANALYTICAL VIEW pv VERTEX TYPES (P) EDGE TYPES (K) PROPERTIES (id):
| query | no view | view |
|---|---|---|
MATCH (a:P)-[:K]->(b:P)-[:K]->(c:P) RETURN count(*) |
448 | 480 |
MATCH (a:P)-[:K]-(b:P)-[:K]-(c:P) RETURN count(*) |
1320 | 2006 |
MATCH (a:P)-[:K]->(b:P), (a)-[:K]->(c:P) RETURN count(*) |
360 | 480 |
MATCH (a:P)-[:K]->(b:P)-[:K]->(c:P)-[:K]->(d:P) RETURN count(*) |
1685 | 1920 |
MATCH (a:P {id:1})-[:K]-(b:P)-[:K]-(c:P) RETURN count(*) |
39 | 58 |
The undirected friends-of-friends shape is the most exposed: every c = a reached back over the same edge is returned. A directed chain is hit through self-loops, a branching pattern whenever both branches land on the same neighbour.
Direction
Two options:
- Decline GAV for any hop in
needsEdgeTracking(and never fuse such a chain). Correct, but it gives up the view for same-type chains, which is its main use case. - Give the GAV operators edge identities. An anonymous hop never exposes its edge, so a canonical label is enough:
(edgeType, src, tgt, occurrence), where occurrence is the rank of this parallel edge among entries equal to the neighbour in the per-type adjacency list being walked. A hop conflicts with a bound edge only when the endpoints match, so the check stays an int comparison against at mostdepthentries on the hot path. The occurrence is computed only on a match. The GAV hops then have to expose these identities to the later same-clause operators (ExpandInto, VarLengthExpand, the cross-component filter), or the optimizer keeps those hops off GAV when a GAV hop precedes them.
Option 2 is the right one. It needs per-type neighbour lists from the provider (today getNeighborIds(node, dir, types) concatenates types, so equal neighbours from different types would collide).
Activity
fix(#8394,#8403): close the watch of a blocking build on an Error too…
fix(#8394): an untyped tracked hop walks every edge type of the schem…
fix(#8403,#8394): a superseded blocking build reports the newer build…
fix(#8394): a fused GAV chain expands a source the view does not map …
test(#8394): relationship uniqueness at a hub with 150+ parallel edge…
fix(#8403,#8394): a blocking build outlived by shutdown fails instead…
test(#8394): pin the parallel-relationship numbering invariant with a…
fix(#8403,#8394): awaitReady() no longer spins once no build is on th…
fix(#8403,#8394): a rebuild adopting the outcome of one a shutdown cu…
fix(#8394,#8137,#8403): one view per tracked clause; zero-copy tracke…
Merge pull request #8425 from ArcadeData/fix/8403-8394-7875-8137-gav-…
lvca commentedon Sep 26, 2026
Fixed in #8425 (26.10.1).
With a Graph Analytical View, a multi-hop pattern such as
MATCH (a)-[:KNOWS]-(b)-[:KNOWS]-(c)could use the same relationship twice, returning more rows than the same query without the view. The view now remembers which relationship each hop took, so results always match the query without the view, still served from the view.A clause falls back to the regular (non-view) traversal when it needs the actual edge: a named relationship variable, a variable-length relationship, or an edge type with sub-types. An undirected chain that counted a self-loop twice is fixed too.
A related gap with edge sub-types is tracked in #8426.
❤️ 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.
fix(ArcadeData#8394,ArcadeData#8403,ArcadeData#7875,ArcadeData#8137):…
fix(opencypher): auto-commit statement atomicity, null write patterns…
fix(opencypher): auto-commit statement atomicity, null write patterns…