Repository navigation
Parser: Fix exponential parse time on nested qualified keyword calls - #3006
Open
SAMARTHJAISWAL wants to merge 2 commits into
Open
SAMARTHJAISWAL wants to merge 2 commits into
SAMARTHJAISWAL wants to merge 2 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.
Fixes #3001.
Nested schema-qualified calls to a keyword function doubled the parse time per level:
After a
., a word followed by(was first parsed speculatively withparse_prefix. ForCEIL,FLOOR,SUBSTRINGorTRIMthat returns the keyword's own expression, which the validator rejects, and theNonebranch then parsed the same arguments again as a function call.A word after
.now skips the speculative parse, as a word not followed by(already did, and theNonebranch reads it as an identifier or a function call. That branch now checks for the outer join operator, sot.c (+)is still an identifier.Not fixed here: #3002 (DuckDB
u.u(k=u.u(k=...) still doubles after this change, so it has another cause.Tests: a hang guard for the four keyword calls nested 30 deep, and a fuzz seed.
cargo test --all-featuresandcargo fmtpass.AI assistance: I used an AI assistant to find the cause and to write the change and the test. I have read and understood all of it and ran the tests myself.