Skip to content

Parser: Fix exponential parse time on nested named function arguments - #3068

Open
yussypu wants to merge 1 commit into
apache:mainfrom
yussypu:named-arg-blowup
Open

yussypu wants to merge 1 commit into
apache:mainfrom
yussypu:named-arg-blowup

Conversation

@yussypu

@yussypu yussypu commented Nov 28, 2026

Copy link
Copy Markdown

Fixes exponential parse time for nested calls with named arguments.

parse_function_args wrapped name <operator> value in a single
maybe_parse. When value failed, the whole argument was parsed again
on the unnamed path, doubling work per nesting level. Only
name <operator> is speculative now, so the value is parsed once.

SELECT u.u(k=u.u(k=... unclosed, 22 levels: 17.6s before, 0.3ms after.
Root cause is separate from #3006, which notes #3002 still doubles there.

Dialects: all that support named function arguments (reported on DuckDB).
Adds a regression test and a fuzz seed.

Closes #3002

`parse_function_args` parsed `name <operator> value` inside one
`maybe_parse`. When the value failed, the whole argument was parsed
again on the unnamed path, so every nesting level doubled the work.
`SELECT u.u(k=u.u(k=...` with 22 unclosed levels took about 17s.

Only `name <operator>` is speculative now. Once the operator matches,
the value is parsed directly, so a failure inside it is reported once.

Closes apache#3002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DuckDB: exponential parse time on unclosed nested qualified calls with a named argument (regression from #2685)

1 participant