Repository navigation
fix(query): ask for a label when a node pattern has none - #188
Merged
Merged
Conversation
A node pattern with no label and no relationship to infer one from failed with "Node label 'Node' doesn't exist", naming an internal default the user never wrote. Say what to do instead, and document the rule and the message in the Cypher guide. Closes #181
Deploying lance-csr with
|
| Latest commit: |
c4f6c46
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d37ab5c7.lance-csr.pages.dev |
| Branch Preview URL: | https://docs-unlabeled-node-error.lance-csr.pages.dev |
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 node pattern with no label, and nothing to infer one from, is rejected. The rule was only stated in the graph schema page, and the error named a label the user never wrote:
Nodeis the planner's internal default for unlabeled nodes, so searching the docs for the message found nothing. Closes #181.What changed
The error now says what to do. Both places that reject an unknown label (the logical planner for
RETURN n, and the scan planner for property reads, filters and counts) share one message:MATCH (n) RETURN nNode label 'Node' doesn't existA node pattern has no label and no relationship to infer one from: add a label, e.g. `(n:Person)`MATCH (n) RETURN n.nameNode label 'Node' not found in catalog. Ensure the label is registered in your GraphConfig with .node_table()Unknown labels the user did write still name the label, with a hint that isn't Python-specific (
.node_table()doesn't exist in the TypeScript package).The Cypher guide explains, under Supported Cypher, that every node needs a label from the pattern or from a relationship mapping, quotes the new error, and links to "Labels in patterns".
One edge: a pattern that literally writes
(n:Node)with noNodetable now gets the "needs a label" message, since the planner can't tell it apart from the default. That seemed an acceptable trade for the common case.Validation
cargo test -p lance-csr: passes, with a new planner test forMATCH (n) RETURN n.cargo clippy -p lance-csr --all-targets -- -D warnings: clean.make testinpython/: 1744 passed, 1 skipped, including a new test for three unlabeled queries on both join and CSR engines.make lint,zensical build --strict,typos: clean.🤖 Generated with Claude Code