Repository navigation
Conversation
…e type A relationship pattern without a type, such as -[]-> or -[*1..2]->, can follow any relationship type. The planner passed an empty type list on, so a single hop failed with "No field named ..." and a variable-length path with "Expand requires at least one relationship type". When the graph configures exactly one relationship type, use it. With several types, fail with an error that names them and asks for a type, until expanding over several types is supported.
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.
Related: #104
A relationship pattern without a type (
-[]->,-[*1..2]->) means "any relationship type" in Cypher. The logical planner passed the empty type list straight toExpand/VariableLengthExpand, so onmain:MATCH (a:Person {id: 1})-[]->(b:Person) RETURN b.idfails withFailed to build projection: Schema error: No field named b__id(the expand is skipped becausebuild_expandfinds no type);MATCH (a:Person)-[*1..2]->(b:Person) ..., the query from feat: Support variable-length relationships (*1..2) without explicit relationship types #104, fails withExpand requires at least one relationship type.This resolves the types in
LogicalPlanner::plan_path:FOLLOWS), for single hops and variable-length paths.UnsupportedFeatureerror naming the configured types and asking for one, e.g.... graph has 2 relationship types (BLOCKS, FOLLOWS); specify the type, e.g. -[:BLOCKS]->, instead of the schema error above.Expanding over several types at once (a union of per-type expands, which also needs aligned schemas when the relationship's properties differ between types, and the same for each hop of a variable-length path) is a larger change, so I left it out; this PR does not close #104. Happy to work on that next if this direction looks right.
Tests (
tests/test_relationship_types.rs, DataFusion executor):FOLLOWS(1→2, 2→3):-[]->from 1 returns[2],-[*1..2]->returns[2, 3];FOLLOWSandBLOCKS: both untyped queries return the new error, and a typed-[:BLOCKS]->still returns[3].Both tests fail on
main(with theNo field named b__iderror) and pass with the change.Commands run in
crates/lance-graph:cargo test(572 tests across 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.