Repository navigation
Conversation
…a new variable In MATCH clauses with several comma-separated patterns, a path pattern after the first one always continued from the plan built so far, even when its start node was a variable that no earlier pattern had bound. The start node was never scanned, so its columns, and the columns of nodes reached from it, were missing, and the query failed with "No field named ..." errors. Scan such a start node and join it with the plan so far. When the path then reaches an already-bound node, the existing variable-reuse filter connects the two patterns. Closes lance-format#117
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.
Closes #117
In a
MATCHwith several comma-separated patterns,LogicalPlanner::plan_pathalways continued a later path from the plan built so far, even when the path's start node is a variable that no earlier pattern bound. That start node was never scanned. For the query in #117 the logical plan was:so the columns of
p, and of nodes reached from it, were missing. Onmainthe query from the issue fails withFailed to build filter: Schema error: No field named h__name, and the simplerfails with
No field named p__id.The fix: when a later path starts at an unbound variable (or an anonymous node), plan a
ScanByLabelfor it and join it with the plan so far. As before, a path that starts at an already-bound variable continues from the plan. When the path then reaches an already-bound node (cabove), the existing variable-reuse filter injoin_relationship_to_targetconnects the two patterns, so the result is correct. The join is a cross join followed by that filter; a join on the relationship could be planned more cheaply, but I kept this change to fixing correctness.Tests (
tests/test_multi_match_where.rs), run on the DataFusion executor with three people, two cities, two countries and two hobbies:main);p: returns both people in France (fails onmain);p(already passed; kept as coverage).Commands run in
crates/lance-graph:cargo test(all unit, integration and doc tests pass),cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings.I used an AI assistant (Claude) while working on this; I reviewed and tested the change.