Skip to content

Cypher/GFQL WHERE cannot mix generic row predicates with pattern predicates #1031

Closed

Description

@lmeyerov

Problem

Current local Cypher/GFQL validation rejects WHERE clauses that mix a generic row predicate with a pattern predicate in the same boolean expression.

Current measured error:

[unsupported-cypher-query] Cypher WHERE pattern predicates cannot yet be mixed with generic row expressions

Benchmark Impact

This is now benchmark-backed from pyg-bench on current master 14dafaf6b951954d8de840f9236f3e874249ebac.

Official LDBC SNB Interactive lane:

  • interactive-complex-10 / common-interest-score
  • artifact: /home/lmeyerov/Work/pyg-bench/results/runs/dgx-spark-snb-interactive-ic10-origin-master-14dafaf6b9-fresh-r1
  • direct Cypher: primitive_gap
  • GFQL: workaround-backed partial under #880

Minimal Shape

MATCH (person:Person {id: $personId})-[:KNOWS*2..2]-(friend),
      (friend)-[:IS_LOCATED_IN]->(city:City)
WHERE NOT friend=person AND
      NOT (friend)-[:KNOWS]-(person)
RETURN friend.id

The important part is the mixed WHERE condition:

  • generic row expression: NOT friend=person
  • pattern predicate: NOT (friend)-[:KNOWS]-(person)

Why This Matters

This is a real official benchmark blocker on current master, not just a parser nicety:

  • exact-2-hop recommendation shapes are common benchmark work
  • the official query is otherwise staged and measurable in the benchmark harness
  • the failure happens before direct execution, so it blocks clean benchmark coverage for the direct Cypher path

Expected Direction

Support mixed WHERE boolean expressions that combine:

  • generic row comparisons / equality predicates
  • pattern predicates

without forcing the benchmark harness to rewrite the official query into a non-faithful form.

Related

  • benchmark coverage meta issue: #992
  • residual GFQL workaround umbrella: #880
  • benchmark artifact: /home/lmeyerov/Work/pyg-bench/results/runs/dgx-spark-snb-interactive-ic10-origin-master-14dafaf6b9-fresh-r1

Activity

  1. lmeyerov commented on Apr 6, 2026

    @lmeyerov
    ContributorAuthor

    Confirmed still reproducible on pin cd707f0 (0.54.0, 2026-04-06, sf1):

    • Run: pyg-bench dgx-spark-ic10-rebaseline-2026-04-06
    • Status: primitive_gap, latency 153ms (fast fail at validation)
    • Error: [unsupported-cypher-query] Cypher WHERE pattern predicates cannot yet be mixed with generic row expressions
    • GFQL workaround (expand 1..2-hop + local scoring): partial, 1272ms

    The ic10 probe is now in the runner with proper issue_ref tracking. The #880 GFQL workaround is the current floor for IC10.

  2. lmeyerov commented on Apr 28, 2026

    @lmeyerov
    ContributorAuthor

    Slice 1 of N landed via #1217 (merged commit b22ad744, sibling tck-gfql graphistry/tck-gfql#28).

    What slice 1 delivered

    • Switched the Cypher parser from Lark LALR(1) → Earley.
    • Retired the LALR-induced workarounds: 3 dedicated pattern-shape where_clause grammar alternatives, _canonicalize_where_single_pattern_and_expr, _mixed_where_pattern_expr_error, and the parse_cypher except LarkError retry block.
    • Added pattern_atom transformer + BooleanExpr.op="pattern" + _split_top_level_and_pattern_leaves / _rebuild_and_tree / _build_where_with_pattern_lift to lift pattern leaves from expr_tree into WhereClause.predicates as WherePatternPredicate entries.
    • Bumped with_where_clause.2 Lark priority to resolve Earley ambiguity that re-routed WITH … WHERE into MATCH-clause WHERE.
    • Paired comparison-string mixin (_StringAllowingComparisonMixin) on NE/GT/LT/GE/LE so mixed label+property+string-comparison shapes work end-to-end.

    What's still in scope under this issue

    Slices 2/3/4 emit explicit unsupported E108 errors at the lift step today — they're surfaced but not implemented:

    • Slice 2: WHERE NOT (n)-[:R]->() (anti-semi-join lowering — original LDBC SNB unblock).
    • Slice 3: WHERE (n)-[:R*]->() AND (n)-[:T*]->() (multi-positive-pattern composition).
    • Slice 4: WHERE (n)-[:R]->() OR n.x = 1 and WHERE (n)-[:R]->() XOR n.x = 1 (OR/XOR-around-pattern; needs a row-level pattern-existence column).

    Issue stays open to track those remaining slices.

  3. lmeyerov commented on Apr 29, 2026

    @lmeyerov
    ContributorAuthor

    Status update (2026-04-29):

    Shipped

    Opened remaining sub-issues for explicit tracking

    Planning docs

    • plans/1031-slices-2-3-4/plan.md
    • plans/1031-slices-2-3-4/HANDOFF.md

    Execution now is focused on #1235 first (critical path).

  4. lmeyerov commented on Apr 29, 2026

    @lmeyerov
    ContributorAuthor

    Status update (2026-04-29):\n\n- Slice 2 phase 2b implementation PR is up: #1238.\n- CI red triage complete: tck-gfql drift on expr-pattern1-19; pairing patch pushed in tck-gfql (fb57977).\n- Failed checks rerun on #1238 (run 25098679675) is in-flight on tck-gfql.\n- Review flow completed on #1238: 0 BLOCKER, 0 IMPORTANT, 1 non-blocking test suggestion.\n\nOnce the rerun turns green, this is ready to merge; follow-ups remain #1237 (2c) and #1236 (slice 4).

  5. lmeyerov commented on Apr 30, 2026

    @lmeyerov
    ContributorAuthor

    Status update (2026-04-29 PT):

    Meta remains open until #1237 and #1236 are complete.

  6. lmeyerov commented on Apr 30, 2026

    @lmeyerov
    ContributorAuthor

    Meta-status update:

    Recent merge commits:

    Remaining tracked work for #1031 is slice 4 / OR-XOR-around-pattern lane (#1236).

  7. lmeyerov commented on May 1, 2026

    @lmeyerov
    ContributorAuthor

    Final status update (2026-05-01):\n\nAll tracked slices under this meta are now landed.\n\nCompleted\n- #1235 (slice 2 phase 2b) via PR #1238 (merged, commit )\n- #1237 (slice 2 phase 2c) via PR #1243 (merged, commit )\n- #1236 (slice 4 OR/XOR-around-pattern lowering) via PR #1244 (merged, commit )\n\nValidation summary for #1244 lane included green CI and DGX RAPIDS targeted checks ( with , and ).\n\nClosing this meta issue.

  8. lmeyerov commented on May 1, 2026

    @lmeyerov
    ContributorAuthor

    Correction to previous comment (shell formatting issue):

    Final status update (2026-05-01):

    All tracked slices under this meta are now landed.

    Completed

    Validation summary for #1244 lane included green CI and DGX RAPIDS targeted checks (25.02 with NUMBA_CUDA_USE_NVIDIA_BINDING=1, and 26.02).

    Meta issue remains correctly closed.

  9. lmeyerov commented on May 4, 2026

    @lmeyerov
    ContributorAuthor

    Follow-up note for historical parent context: #1219 residual hardening slice is now merged via PR #1281.

    Scope was pushdown null-safety classifier hardening for quoted-literal false-safe cases. Remaining row-boolean residual tracking continues under #1219.

  10. lmeyerov commented on May 4, 2026

    @lmeyerov
    ContributorAuthor

    Traceability note: #1219 follow-up PR #1282 is now merged.

    Scope was cross-alias OR topology stress amplification (cartesian + broader fanout locks) as part of the row-boolean residual tail under #1219.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions