-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Replace Irony-based SqlParser with Parlot SqlParser #18503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,844
−1,134
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
42ab9fd
Initial plan
Copilot 95033e8
Add Parlot package and initial SqlAst, SqlParser, SqlTranslator struc…
Copilot 77163d7
Add working ParlotSqlParser with 74/98 tests passing
Copilot 012f595
Improve parameter parser priority (still 74/98 tests passing)
Copilot 6d1fb64
Update Parlot to version 1.5.1
Copilot 5d729b9
Revert ZeroOrOne to Optional API (Parlot 1.5.1)
Copilot be7c96f
Cleanup grammar
sebastienros 6b0395e
Add trailing comma
hishamco 02b7eb4
Add static when it's possible
hishamco 62ec7fd
Update Parlot 1.5.2
hishamco 67e466e
Fix unit tests
sebastienros 513529b
Merge branch 'main' into copilot/replace-sqlparser-with-parlot
sebastienros 228efdd
Nits
sebastienros 63f640b
Use new WhiteSpace parser
sebastienros 8fbd1a4
Perf improvements
sebastienros 671ce54
Formatting
Piedone 553f94c
Fix NRE when error is null and add ORDER BY LIMIT tests
Copilot f9c7dd2
Fix OneOrMany regression and document WHERE+ORDER BY parsing issue
Copilot 6b298a6
Merge main branch and resolve conflicts - update to .NET 10.0
Copilot 4c3d7cd
Merge remote-tracking branch 'origin/main' into copilot/replace-sqlpa…
Piedone 52f342d
Add tests for WHERE + ORDER BY parsing issue
Copilot e509319
Use Keyword parser to prevent OR/ORDER conflict
sebastienros 80558ca
Remove leftover backup files
Piedone da81c7f
Improve performance and allocations
sebastienros 46f1e73
Merge branch 'main' into copilot/replace-sqlparser-with-parlot
sebastienros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using OrchardCore.Queries.Sql; | ||
|
|
||
| var sqls = new[] | ||
| { | ||
| "select a where a = @b", | ||
| "select a where a = @b limit 10", | ||
| "select a where a = @b limit @limit", | ||
| "select a limit @limit", | ||
| }; | ||
|
|
||
| foreach (var sql in sqls) | ||
| { | ||
| Console.WriteLine($"\nTesting: {sql}"); | ||
| if (ParlotSqlParser.TryParse(sql, out var result, out var error)) | ||
| { | ||
| Console.WriteLine("✓ Parse successful"); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine($"✗ Parse failed"); | ||
| if (error != null) | ||
| { | ||
| Console.WriteLine($" Error: {error.Message}"); | ||
| } | ||
| } | ||
| } |
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
439 changes: 439 additions & 0 deletions
439
src/OrchardCore.Modules/OrchardCore.Queries/Sql/ParlotSqlParser.cs
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left here deliberately, @sebastienros?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, forgot to remove.
I have some pending changes to improve performance significantly (verified in Parlot). Will update later and then it will be ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with the perf gains, ready for merging if tests pass.