Skip to content

Cypher parser rejects zero-hop open range *0.. variable-length relationships #983

Closed

Description

@lmeyerov

Summary

The Cypher parser currently rejects zero-hop open-range variable-length relationship syntax like *0.., which is needed for official LDBC SNB Interactive IS2-style queries.

Environment used for repro:

  • repo: graphistry/pygraphistry
  • sha: ebe7d0ae827d724a8779e123c3965ec723581015
  • host runtime: uv run python ...

Minimal repro

import pandas as pd
from graphistry.tests.test_compute import CGFull

g = CGFull().nodes(
    pd.DataFrame({
        'id': ['message', 'post'],
        'label__Message': [True, False],
        'label__Post': [False, True],
    }),
    'id',
).edges(
    pd.DataFrame({
        's': ['message'],
        'd': ['post'],
        'type': ['REPLY_OF'],
    }),
    's',
    'd',
)

query = "MATCH (message:Message)-[:REPLY_OF*0..]->(post:Post) RETURN post.id AS postId"
print(g.gfql(query)._nodes)

Observed behavior

This fails with:

GFQLSyntaxError [invalid-cypher-syntax] Invalid Cypher query syntax

Expected behavior

Either:

  1. parse and execute *0.. as standard zero-or-more syntax, or
  2. fail fast with an explicit validation error that this syntax is intentionally unsupported.

Right now it looks like a parser-level syntax rejection.

Why this matters

SNB IS2 uses REPLY_OF*0.. so the same pattern can match either:

  • a post directly, or
  • a comment chain that eventually reaches a post

Without *0.., the official query text cannot be expressed directly.

Related

#973 explicitly leaves *0 / *0..n out of scope. This issue tracks that specific gap separately.

Activity

  1. changed the title [-]Cypher parser rejects zero-hop open range variable-length relationships[/-] [+]Cypher parser rejects zero-hop open range `*0..` variable-length relationships[/+] on Mar 30, 2026
  2. lmeyerov commented on Mar 31, 2026

    @lmeyerov
    ContributorAuthor

    Another measured SNB manifestation from pyg-bench on 2026-03-31:

    • LDBC SNB Interactive interactive-complex-12 (Expert search) still fails on direct Cypher with:
    [invalid-cypher-syntax] Invalid Cypher query syntax
    

    The relevant official pattern is:

    MATCH (tag:Tag)-[:HAS_TYPE|IS_SUBCLASS_OF*0..]->(baseTagClass:TagClass)

    So the earlier improvement after #984 does not appear to fully close the zero-hop open-range family. The relationship-alternation form [:HAS_TYPE|IS_SUBCLASS_OF*0..] is still benchmark-blocking.

    Current measured status for interactive-complex-12:

    • GFQL: partial via local tag-class-expanded reply aggregation workaround under #880
    • Cypher: parser_gap under #983
  3. lmeyerov commented on Apr 5, 2026

    @lmeyerov
    ContributorAuthor

    PR: #1064 — fixes *0..N bounded zero-min varlen relationships. One-line parser fix (<= 0 → < 0 in _rel_hops()) + guard in rel_range_exact() to keep *0 rejected. RED→GREEN, full cypher suite passing.

  4. added 4 commits that reference this issue on Apr 6, 2026
  5. lmeyerov commented on Apr 6, 2026

    @lmeyerov
    ContributorAuthor

    Follow-on test amplification and DRY for this fix landed in PR #1070 (squash-merged 2026-04-06):

    • Negative bounds (*-1, *-5..10, *1..-3) now tested to raise GFQLSyntaxError specifically
    • *0..1 (seed + direct neighbors) and *0..100 (large bound stops at graph depth) confirmed
    • *0..0 boundary behavior documented (parses, returns empty)
    • TCK contract correction: match5-8 (*0..0) was incorrectly tagged GFQLValidationError on tck-gfql main; corrected to success_wrong_rows
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions