Repository navigation
fix(cypher): filter variable-length paths by their property map - #192
Merged
Merged
Conversation
A property map on a variable-length relationship, such as
[:R*1..3 {day: 5}], was dropped while planning, so every path matched.
Keep the map on VariableLengthExpand and apply it to each hop of the
fixed-length branches. The CSR walk can't filter relationship
properties, so such a path uses those branches instead, as a single
hop with a property map already does.
Fixes #178
Deploying lance-csr with
|
| Latest commit: |
e1c4ff1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7013ddde.lance-csr.pages.dev |
| Branch Preview URL: | https://fix-var-length-rel-propertie.lance-csr.pages.dev |
prrao87
marked this pull request as ready for review
November 21, 2026 21:42
Member
Author
Benchmarks on this branchRelease wheel built from e1c4ff1 ( This measures the branch only. No Machine: Apple M5, 24 GB, macOS 26.6.2. Benchmark commits: graph-benchmark-ldbc 1998520, graph-benchmark-ldbc-complex 220e956, graph-benchmark 995a6ad.
Per-query means: graph-benchmark-ldbc, memory
graph-benchmark-ldbc, lazy
graph-benchmark-ldbc-complex, memory
graph-benchmark-ldbc-complex, lazy
graph-benchmark, memory
|
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
A property map on a variable-length relationship was silently ignored.
MATCH (a:N {id: 1})-[:R*1..3 {day: 5}]->(b:N)returned every reachable node, as if the map weren't there, with and without the CSR. On a real graph the result was off by orders of magnitude (1.55 billion rows instead of 9,040), and nothing warned that it was wrong. The same map on a single hop filtered correctly.With this change the map must hold for every relationship on the path, the same rows as
WHERE all(r IN relationships(p) WHERE r.day = 5).Fixes #178.
What changed
*0..) has no relationship to check, so the start node still matches itself.The issue suggested rejecting the map with an error until it was supported. Carrying it through took about as much code and gives the right answer, so I did that instead.
Validation
*0..3, and a named path. The first three return unfiltered rows on 0.13.1; the named path was already correct, since it plans through a different operator, and stays as a guard.cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,make test(1756 passed, 1 skipped),make lint, the strict docs build andtyposall pass locally.User impact
Queries that put a property map on a variable-length relationship now return the filtered rows. Before, they returned every path. The variable-length section of the Cypher guide says how the map applies.
🤖 Generated with Claude Code