SAMARTHJAISWAL opened a new pull request, #3006:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/3006

   Fixes #3001.
   
   Nested schema-qualified calls to a keyword function doubled the parse time 
per level:
   
       SELECT a.CEIL(a.CEIL(a.CEIL(x)))   -- 22 levels: ~7 s
   
   After a `.`, a word followed by `(` was first parsed speculatively with 
`parse_prefix`. For `CEIL`, `FLOOR`, `SUBSTRING` or `TRIM` that returns the 
keyword's own expression, which the validator rejects, and the `None` branch 
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 the `None` branch reads it as an identifier or a function 
call. That branch now checks for the outer join operator, so `t.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-features` and `cargo fmt` pass.
   
   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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to