fix(dql): support IRI-ref at query start#9667
Open
eileenaaa wants to merge 5 commits intodgraph-io:mainfrom
Open
fix(dql): support IRI-ref at query start#9667eileenaaa wants to merge 5 commits intodgraph-io:mainfrom
eileenaaa wants to merge 5 commits intodgraph-io:mainfrom
Conversation
Refactor lexing logic for less than operator
Fix method name from backup to Backup
shiva-istari
approved these changes
Mar 26, 2026
| for it.Next() { | ||
| item := it.Item() | ||
| require.NotEqual(t, item.Typ, lex.ItemError, "Error: %v", item.String()) | ||
| t.Log(item.String()) |
Contributor
There was a problem hiding this comment.
The test only asserts absence of errors but doesn't verify the IRI ref was actually parsed. A broken implementation that silently drops the token would still pass. Add a positive assertion that "user-query" was emitted as a token value (similar to TestNumberInLang), and drop the t.Log.
Suggested change
| t.Log(item.String()) | |
| var foundIRI bool | |
| for it.Next() { | |
| item := it.Item() | |
| require.NotEqual(t, item.Typ, lex.ItemError, "Error: %v", item.String()) | |
| if item.Val == "user-query" { | |
| foundIRI = true | |
| } | |
| } | |
| require.True(t, foundIRI, "expected IRI ref 'user-query' to be lexed")``` |
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.
Description
This PR fixes a regression in DQL lexing where queries starting with an IRI-ref (names wrapped in
< >, e.g.,<caseNodeDel_xxx>) would fail with anUnexpected character: U+003C '<'error.Root Cause:
In v25, the state function
lexIdentifyMutationOrQuerywas introduced to distinguish between mutations and queries. However, it lacked a case for thelsThan(<) character, causing the lexer to fail when a query block started with an IRI-ref instead of a standard name or keyword.Changes:
lexIdentifyMutationOrQueryindql/state.goto handle thelsThan(<) case.lex.IRIRefand transitions tolexQuery.Fixes #9666
Checklist
fix:,feat:,chore:,ci:, etc.