Repository navigation
fix(query): support bound string predicates and untyped relationships across labels - #120
Merged
Merged
Conversation
Resolve omitted relationship types from configured endpoints and retain typed boundary-node identities for whole-node returns.
…tern detection A reused relationship variable such as `(c)-[r]->(d)` takes its type from where `r` was first written with one (#83). Detecting untyped patterns from the raw AST counted it as untyped and sent the query down the typed-node-value path, which failed with a duplicate `r` field.
prrao87
marked this pull request as ready for review
November 4, 2026 01:34
This was referenced Nov 4, 2026
prrao87
added a commit
that referenced
this pull request
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two kinds of Cypher query that applications send still fail on 0.7.0:
MATCH (p:Person) WHERE p.name CONTAINS $name RETURN p, fail with a parse error atWHERE.CONTAINS,STARTS WITHandENDS WITHonly accepted a quoted literal.MATCH (a)-[]-(b) RETURN a, b, fail withNode label 'Node' doesn't exist.This brings in the two fixes from the
codex/bound-string-predicatesbranch by @stugorf, rebased onto currentmain(after the planner and CSR changes in #87, #109, #113, #115 and #118), plus one planner fix for a regression the rebase exposed.What changed
Bound string predicates. The right-hand side of
CONTAINS,STARTS WITHandENDS WITHcan be any expression: a parameter, a property or a function call. Matching is now an exact, case-sensitive substring, prefix or suffix check for literals too, instead of a rewrite toLIKE.This changes results for some queries that already ran:
p.name CONTAINS '50%'%is a wildcard50%p.name STARTS WITH 'a_b'_matches any charactera_bp.age CONTAINS 'x'(non-string operand)An empty search string matches every non-null string.
id, or a label's id field, is now also accepted as a property on a variable with several labels.Untyped relationships across labels. An omitted relationship type ranges over every configured relationship type. Unlabeled endpoints resolve from each relationship's source and target mappings, without combining identities from different node tables. Undirected matches include both orientations, a self-loop appears once, and parallel edges stay distinct. Whole-node returns in these queries come back as typed entity records, with or without the CSR.
Reused relationship variables. Untyped-pattern detection now ignores a relationship variable that is written with a type elsewhere in the query, as in
MATCH (a)-[r:KNOWS]->(b), (c)-[r]->(d). Without this, the rebased fix sent those queries down the untyped path, and they failed withduplicate unqualified field name r.docs/cypher.mddocuments both features.Validation
cargo test --workspace: all suites pass, including the new engine tests for both fixes, with and without the CSR.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --all --check: clean.embedded_queryexample runs.pytest -n auto python/tests/ --doctest-modules python/lance_csrpasses (1704 tests), including the newtest_string_parameters.pyandtest_engine_alternation.pycases.ruffandpyrightare clean.contains/starts_with/ends_withinstead ofLIKE. I haven't checked whether Lance still pushes these filters into the scan, or whether benchmarks move.🤖 Generated with Claude Code