Parser: fix exponential parse time on named-arg chains#2349
Open
LucaCappelletti94 wants to merge 4 commits into
Open
Parser: fix exponential parse time on named-arg chains#2349LucaCappelletti94 wants to merge 4 commits into
LucaCappelletti94 wants to merge 4 commits into
Conversation
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.
parse_function_argswrappedparse_exprinmaybe_parsefor the<expr> <op> <expr>named-arg path on PostgreSQL/MSSQL, so rollback re-walked nested function calls and cost compounded to ~2^N. Same shape as #2344 at a different parser site.Fix: parse the leading expression once with
parse_wildcard_expr, thenmaybe_parseonly the<op> <expr>tail.Bench on
PostgreSqlDialect:Adds a timeout-based regression test and criterion bench mirroring #2344.
If anyone is curious as to how I am finding these, the TLDR is that I am fuzzing libraries downhill which use sqlparser, and keep getting timeouts because of these exponential cases. Unfortunately, there are still several to be deal with, but there is only so much time in a day.