Skip to content

feat(gfql/cypher): execute WHERE NOT (pattern) via anti-semi row filtering (#1031 slice 2 phase 2b) - #1238

Merged
lmeyerov merged 2 commits into
masterfrom
m4-1031-slice-2-phase-2b
Apr 30, 2026
Merged

lmeyerov merged 2 commits into
masterfrom
m4-1031-slice-2-phase-2b

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1235
Parent: #1031

Summary

  • Execute WHERE NOT (pattern) by lowering negated WherePatternPredicate to a new row pre-filter call: anti_semi_apply
  • Apply this lowering in both general MATCH lowering and connected OPTIONAL MATCH clause lowering
  • Add row-pipeline runtime support for anti_semi_apply + call-safelist validation entry
  • Preserve base-graph context on row-table transitions so correlated binding-ops evaluation can execute from row stages
  • Add compile/runtime tests for NOT-pattern and mixed row+NOT behavior
  • Amplify connected optional coverage with OPTIONAL MATCH ... WHERE NOT (pattern) tests (selective keep + null-fill fallback)

Key details

  • Replaces the two lowering unsupported hooks for negated predicates with executable lowering
  • Enforces per-predicate validation for negated patterns:
    • pattern must include a relationship
    • pattern cannot introduce new aliases
    • pattern must share at least one bound alias
  • Emits row pre-filters via LoweredCypherMatch.row_pre_filters and runs them before row WHERE expressions

Validation

  • UV_CACHE_DIR=/tmp/uv-cache PYTHONPATH=. uv run --no-project --with lark --with pytest python -m pytest graphistry/tests/compute/gfql/cypher/test_lowering.py -k "issue_1024_where_not_pattern_on_optional_match or negated_pattern or anti_semi" -q
  • UV_CACHE_DIR=/tmp/uv-cache PYTHONPATH=. uv run --no-project --with lark --with pytest python -m pytest graphistry/tests/compute/gfql/cypher/test_lowering.py -q
  • MYPY_CACHE_DIR=/tmp/mypy_cache ./bin/mypy.sh graphistry/compute/ast.py graphistry/compute/gfql/row/pipeline.py graphistry/compute/gfql/cypher/lowering.py graphistry/compute/gfql/call/validation.py

Follow-ups

@lmeyerov
lmeyerov merged commit bd420d6 into master Apr 30, 2026
133 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gfql/cypher: anti-semi-join lowering for WHERE NOT pattern (#1031 slice 2 phase 2b)

1 participant